马宇豪
2024-01-08 15315b1772036eb5168792aac0121f6e9005b11e
src/views/loginPage/component/accountLogin.vue
@@ -85,7 +85,7 @@
import { useUserInfo } from '/@/stores/userInfo';
import type { FormInstance, FormRules } from 'element-plus'
import {workApplyApi} from "/@/api/specialWorkSystem/workApply";
import {verifyPhone,verifyIdCard} from "/@/utils/toolsValidate"
import {verifyPhone,verifyIdCard,verifyPwd} from "/@/utils/toolsValidate"
import { Base64 } from 'js-base64'
export default defineComponent({
    name: 'accountLogin',
@@ -150,18 +150,31 @@
                }else callback();
            }, 400)
        }
        // 修改密码
        const validatePass = (rule: any, value: any, callback: any) => {
            if (value === '') {
                callback(new Error('该内容不能为空'))
            } else {
                if (state.identity.rePassword !== '') {
                    if (!identifyRef.value) return
                    identifyRef.value.validateField('rePassword', () => null)
                }
                callback()
        let validatePwd = (rule: any, value: any, callback: any)=>{
          if(value === ''){
            callback(new Error('请输入密码'))
          }else{
            if(!verifyPwd(value)){
              callback(new Error('密码须包含字母、数字、特殊字符,长度在6-16之间'))
            }else{
              callback()
            }
          }
        }
        // 修改密码
        // const validatePass = (rule: any, value: any, callback: any) => {
        //     if (value === '') {
        //         callback(new Error('该内容不能为空'))
        //     } else {
        //         if (state.identity.rePassword !== '') {
        //             if (!identifyRef.value) return
        //             identifyRef.value.validateField('rePassword', () => null)
        //         }
        //         callback()
        //     }
        // }
        const validatePass2 = (rule: any, value: any, callback: any) => {
            if (value === '') {
                callback(new Error('该内容不能为空'))
@@ -175,7 +188,7 @@
            realName: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            identify: [{ required: true, validator: checkCode, trigger: 'blur'}],
            phone: [{ required: true, validator: checkPhone, trigger: 'blur' }],
            password: [{ required: true, validator: validatePass, trigger: 'blur' }],
            password: [{ required: true, validator: validatePwd, trigger: 'blur' }],
            rePassword: [{ required: true, validator: validatePass2, trigger: 'blur' }]
        });