zs 6 ay önce
ebeveyn
işleme
0743cdedc9
1 değiştirilmiş dosya ile 13 ekleme ve 4 silme
  1. 13 4
      src/views/center/findPassword.vue

+ 13 - 4
src/views/center/findPassword.vue

@@ -158,8 +158,17 @@ const validatePassword = (rule, value, callback) => {
     callback()
   }
 }
+const passwordValValidate = (rule, value, callback) => {
+  if (!value) {
+    return callback(new Error('请输入新密码'))
+  } else if (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[._~!@#$^&*])[A-Za-z0-9._~!@#$^&*]{8,16}$/g.test(value)) {
+    return callback()
+  } else {
+    return callback(new Error('请输入包含英文字母大小写、数字和特殊符号的 8-16 位组合'))
+  }
+}
 const rules = reactive({
-  password: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
+  password: [{ required: true, validator: passwordValValidate, trigger: 'blur' }],
   refpassword: [{ required: true, validator: validatePassword, trigger: 'blur' }]
 })
 const rules1 = reactive({
@@ -243,9 +252,9 @@ const disabledVerify = computed(() => {
   if (verify.count < 60) return true
   else {
     const type = select.value === '1' ? 'phone' : 'email'
-    const val = get(form,`value.${type}`)
-    if(val) return false;
-    else return true;
+    const val = get(form, `value.${type}`)
+    if (val) return false
+    else return true
   }
 })
 const getVerifyCode = async () => {