浏览代码

心理胜任能力密码部分Bug修改

zhangzhang 3 月之前
父节点
当前提交
6068d9063a
共有 2 个文件被更改,包括 50 次插入21 次删除
  1. 20 20
      src/components/manage/ContainerSys.vue
  2. 30 1
      src/views/Welcome.vue

+ 20 - 20
src/components/manage/ContainerSys.vue

@@ -163,16 +163,16 @@ export default {
     const systemVersion = process.env.VUE_APP_VERSION
     const systemVersion = process.env.VUE_APP_VERSION
     //修改密码***
     //修改密码***
     const validatePassOld = (rule, value, callback) => {
     const validatePassOld = (rule, value, callback) => {
-      // if (value === "") {
+      if (value === "") {
-      //   callback(new Error("请输入密码"));
+        callback(new Error("请输入密码"));
-      // } else {
+      } else {
-      //   let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,16}$/;
+        let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,16}$/;
-      //   if (!juPassword.test(this.ruleForm.oldpass)) {
+        if (!juPassword.test(this.ruleForm.oldpass)) {
-      //     callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)8-16位"));
+          callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)8-16位"));
-      //   } else {
+        } else {
-      //     callback();
+          callback();
-      //   }
+        }
-      // }
+      }
       if (value === "") {
       if (value === "") {
         callback(new Error("请输入旧密码"))
         callback(new Error("请输入旧密码"))
       } else {
       } else {
@@ -185,16 +185,16 @@ export default {
       }
       }
     }
     }
     const validatePass = (rule, value, callback) => {
     const validatePass = (rule, value, callback) => {
-      // if (value === "") {
+      if (value === "") {
-      //   callback(new Error("请输入密码"));
+        callback(new Error("请输入密码"));
-      // } else {
+      } else {
-      //   let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,16}$/;
+        let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,16}$/;
-      //   if (!juPassword.test(this.ruleForm.pass)) {
+        if (!juPassword.test(this.ruleForm.pass)) {
-      //     callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)8-16位"));
+          callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)8-16位"));
-      //   } else {
+        } else {
-      //     callback();
+          callback();
-      //   }
+        }
-      // }
+      }
       if (value === "") {
       if (value === "") {
         callback(new Error("请输入新密码"))
         callback(new Error("请输入新密码"))
       } else {
       } else {

+ 30 - 1
src/views/Welcome.vue

@@ -544,7 +544,28 @@ export default {
         {value: 1, name: "认知任务"}
         {value: 1, name: "认知任务"}
       ]
       ]
     }
     }
-
+    const validatePassOld = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("请输入密码"));
+      } else {
+        let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{6,18}$/;
+        if (!juPassword.test(this.ruleForm.oldpass)) {
+          callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)6-18位"));
+        } else {
+          callback();
+        }
+      }
+      if (value === "") {
+        callback(new Error("请输入旧密码"))
+      } else {
+        if (value.length < 6 || value.length > 18) {
+          callback(new Error("密码长度需在6~18位之间"))
+        } else {
+          this.$refs.ruleForm.validateField("pass")
+        }
+        callback()
+      }
+    }
     const checkBrigade = (rule, value, callback) => {
     const checkBrigade = (rule, value, callback) => {
       if (value) {
       if (value) {
         if (this.isOtherDepartment) {
         if (this.isOtherDepartment) {
@@ -690,6 +711,14 @@ export default {
         password: [
         password: [
           {required: true, validator: validatePassword, trigger: "blur"}
           {required: true, validator: validatePassword, trigger: "blur"}
         ],
         ],
+        oldPassword:[
+          // {required: true, validator: validatePassword, trigger: "blur"}
+          { required: true, validator: validatePassOld, trigger: "blur" }
+        ],
+        pass: [ { required: true, validator: validatePass, trigger: "blur" } ],
+        checkPass: [
+          { required: true, validator: validatePass2, trigger: "blur" }
+        ],
         passwordCheck: [
         passwordCheck: [
           {
           {
             required: true,
             required: true,