|
@@ -30,7 +30,7 @@
|
|
|
<v-window v-model="tab">
|
|
|
<!-- 验证码登录 -->
|
|
|
<v-window-item :value="1">
|
|
|
- <phoneFrom ref="phoneRef" @handleEnter="handleLogin"></phoneFrom>
|
|
|
+ <phoneFrom ref="phoneRef" :openCaptcha="true" :captchaStr="captchaStr" @getCaptchaStr="getCode" @handleEnter="handleLogin"></phoneFrom>
|
|
|
</v-window-item>
|
|
|
<!-- 账号密码登录 -->
|
|
|
<v-window-item :value="2">
|
|
@@ -55,6 +55,8 @@
|
|
|
{{ $t('login.login') }}
|
|
|
</v-btn>
|
|
|
<div class="login-tips mt-3">
|
|
|
+ <v-icon v-if="isAgree" size="18" color="primary" class="mr-2" @click="isAgree = !isAgree">mdi-check-circle</v-icon>
|
|
|
+ <v-icon v-else size="18" color="grey" class="mr-2" @click="isAgree = !isAgree">mdi-check-circle-outline</v-icon>
|
|
|
{{ $t('login.agreeLogin') }}
|
|
|
<span class="color" style="cursor: pointer;" @click="router.push('/userAgreement')"> [{{ $t('login.userAgreement') }}] </span>和
|
|
|
<span class="color" style="cursor: pointer;" @click="router.push('/privacyPolicy')">[{{ $t('login.privacyPolicy') }}]</span>
|
|
@@ -105,6 +107,7 @@ const { t } = useI18n()
|
|
|
const router = useRouter()
|
|
|
const tab = ref(1)
|
|
|
const tab1 = ref(1)
|
|
|
+const isAgree = ref(false)
|
|
|
const isEnterpriseLogin = ref(route.query?.entLogin || false)
|
|
|
|
|
|
const handleChangeLogin = () => {
|
|
@@ -134,7 +137,8 @@ const handleCheckEnterprise = async () => {
|
|
|
const handleLogin = async () => {
|
|
|
const { valid } = isEnterpriseLogin.value ? await entPassRef.value.passwordForm.validate() : tab.value === 1 ? await phoneRef.value.phoneForm.validate() : await passRef.value.passwordForm.validate()
|
|
|
if (!valid) return
|
|
|
- if (!captchaVerification) {
|
|
|
+ if (!isAgree.value) return Snackbar.warning('请阅读并勾选底部协议')
|
|
|
+ if (!captchaStr.value) {
|
|
|
getCode() // 验证码组件
|
|
|
return
|
|
|
}
|
|
@@ -143,10 +147,11 @@ const handleLogin = async () => {
|
|
|
try {
|
|
|
let params, api = {}
|
|
|
// if (tab.value === 1) { params = { ...phoneRef.value.loginData }; api = 'handleSmsLogin'}
|
|
|
- // else { params = { ...passRef.value.loginData, captchaVerification }; api = 'handlePasswordLogin'}
|
|
|
- if (isEnterpriseLogin.value) { params = { ...entPassRef.value.loginData, captchaVerification }; api = 'handlePasswordLogin'}
|
|
|
- else { params = tab.value === 1 ? { ...phoneRef.value.loginData, captchaVerification } : { ...passRef.value.loginData, captchaVerification }; api = tab.value === 1 ? 'handleSmsLogin' : 'handlePasswordLogin'}
|
|
|
-
|
|
|
+ // else { params = { ...passRef.value.loginData }; api = 'handlePasswordLogin'}
|
|
|
+ if (isEnterpriseLogin.value) { params = { ...entPassRef.value.loginData }; api = 'handlePasswordLogin'}
|
|
|
+ else { params = tab.value === 1 ? { ...phoneRef.value.loginData } : { ...passRef.value.loginData }; api = tab.value === 1 ? 'handleSmsLogin' : 'handlePasswordLogin'}
|
|
|
+ if (captchaStr.value) params.captchaVerification = captchaStr.value // 人机验证
|
|
|
+
|
|
|
// 邮箱为企业招聘, 手机号为个人求职
|
|
|
if (isEnterpriseLogin.value) {
|
|
|
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
@@ -221,10 +226,14 @@ const getCode = async () => {
|
|
|
verify.value.show()
|
|
|
}
|
|
|
|
|
|
-let captchaVerification = ''
|
|
|
+const captchaStr = ref('')
|
|
|
const verifySuccess = (params) => {
|
|
|
- captchaVerification = params.captchaVerification
|
|
|
- handleLogin()
|
|
|
+ captchaStr.value = params.captchaVerification
|
|
|
+ if (!isEnterpriseLogin.value && tab.value === 1 && phoneRef.value) {
|
|
|
+ nextTick(() => { phoneRef.value.handleCode() }) // 在获取验证码之前加人机验证
|
|
|
+ } else {
|
|
|
+ handleLogin()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</script>
|
|
@@ -284,7 +293,10 @@ const verifySuccess = (params) => {
|
|
|
.login-tips {
|
|
|
width: 100%;
|
|
|
font-size: 12px;
|
|
|
- text-align: center;
|
|
|
+ // text-align: center;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
.tips {
|
|
|
span:hover {
|