Xiao_123 7 mesiacov pred
rodič
commit
2072a1f5e9

+ 1 - 0
src/components/CtForm/index.vue

@@ -16,6 +16,7 @@
                 :item="item"
                 @blur="item.blur"
                 @change="handleChange(item)"
+                @appendInnerClick="item.appendInnerClick"
               ></textUI>
               <autocompleteUI
                 v-if="item.type === 'autocomplete'"

+ 1 - 1
src/components/FormUI/TextInput/index.vue

@@ -87,7 +87,7 @@ const appendClick = () => {
 }
 const appendInnerClick = () => {
   if (item.appendInnerClick) item.appendInnerClick(value.value)
-  emit('appendInnerClick', value.value)
+  else emit('appendInnerClick', value.value)
 }
 
 const handleClear = () => {

+ 1 - 1
src/utils/validate.js

@@ -66,4 +66,4 @@ export const checkEmail = (email) => {
 const USCIReg = /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/;  
 export const checkUSCI = (code) => {  
   return USCIReg.test(code)
-} 
+}

+ 12 - 4
src/views/login/components/editPassword.vue

@@ -23,7 +23,7 @@
         prepend-inner-icon="mdi-lock-outline" 
         :append-inner-icon="show ? 'mdi-eye-outline' : 'mdi-eye-off-outline'"
         :type="show ? 'text' : 'password'"
-        :rules="[v=> !!v || '请再次输入新密码', passwordCheck]"
+        :rules="secondaryConfirmation"
         @click:append-inner="show = !show"
       ></v-text-field>
     </v-form>
@@ -67,14 +67,22 @@ const loading = ref(false)
 const passwordType = ref(false)
 const phoneRef = ref()
 
+const secondaryConfirmation = ref([
+  value => {
+    if (value) return true
+    return '请再次输入密码'
+  },
+  value => {
+    if (value === query.password) return true
+    return '两次输入密码不一致'
+  }
+])
+
 // 密码效验
 const regex = /^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,16}$/
 const validPassword = computed(() => {
   return regex.test(query.password) || '请输入8-16位数由数字、大小写字母组成的密码'
 })
-const passwordCheck = computed(() => {
-  return (query.checkPassword === query.password && regex.test(query.checkPassword)) || '两次密码输入不一致'
-})
 
 
 const handleClose = () => {

+ 24 - 8
src/views/recruit/entRegister/register.vue

@@ -3,7 +3,7 @@
     <v-card class="pa-5" :class="isMobile? 'mobileBox' : 'default-width'" :elevation="isMobile? '0' : '3'">
       <!-- 标题 -->
       <div class="mt-3">
-        <v-btn v-if="pageType !== 'noLoginToRegister'" color="black" variant="text" @click="router.push('/recruitHome')">{{ `<< 回到首页` }}</v-btn>
+        <v-btn v-if="pageType !== 'noLoginToRegister'" color="primary" variant="text" @click="router.push('/recruitHome')">{{ `<< 回到首页` }}</v-btn>
         <div v-else style="height: 30px;"></div>
       </div>
       <!-- 表单 -->
@@ -95,6 +95,18 @@ const isPrepareChange = () => {
   }
 }
 
+const handleSecondConfirm = () => {
+  const obj = formItems.value.options.find(e => e.key === 'passwordConfirm')
+  obj.type = obj.type === 'password' ? 'text' : 'password'
+  obj.appendInnerIcon = obj.type === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
+}
+
+const handlePassword = () => {
+  const obj = formItems.value.options.find(e => e.key === 'password')
+  obj.type = obj.type === 'password' ? 'text' : 'password'
+  obj.appendInnerIcon = obj.type === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
+}
+
 const formItems = ref({
   options: [
     {
@@ -147,36 +159,40 @@ const formItems = ref({
       ]
     },
     {
-      type: 'text',
+      type: 'password',
       key: 'password',
       value: '',
+      appendInnerIcon: 'mdi-eye-off-outline',
       label: '邮箱登录密码(用于企业招聘邮箱登录) *',
       placeholder: '请输入邮箱登录密码(用于企业招聘邮箱登录)',
+      appendInnerClick: handlePassword,
       rules: [
         value => {
           if (value) return true
           return '请输入邮箱登录密码(用于企业招聘邮箱登录)'
         },
         value => {
-          if (!(/^[\s]+$/.test(value))) return true
-          return '请输入邮箱登录密码(用于企业招聘邮箱登录)'
+          if (/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,16}$/.test(value)) return true
+          return '请输入8-16位数由数字、大小写字母组成的密码'
         }
       ]
     },
     {
-      type: 'text',
+      type: 'password',
       key: 'passwordConfirm',
       value: '',
+      appendInnerIcon: 'mdi-eye-off-outline',
       label: '请再次输入邮箱登录密码 *',
       placeholder: '请再次输入邮箱登录密码',
+      appendInnerClick: handleSecondConfirm,
       rules: [
         value => {
           if (value) return true
-          return '请再次输入邮箱登录密码'
+          return '请再次输入密码(用于企业招聘邮箱登录)'
         },
         value => {
-          if (!(/^[\s]+$/.test(value))) return true
-          return '请再次输入邮箱登录密码'
+          if (value === formItems.value.options.find(e => e.key === 'password').value) return true
+          return '两次输入密码不一致'
         }
       ]
     },