src/components/tools/UserPassword.vue
@@ -88,8 +88,12 @@
        username:"",
      }
    },
    created(){
      // this.initDictData('password_length')
    watch:{
      visible:{
        handler(value){
          if(value) this.initDictData('password_length')
        }
      }
    },
    methods: {
      show(uname){
@@ -103,19 +107,14 @@
        }
      },
      initDictData(dictCode) {
        //优先从缓存中读取字典配置
        if (getDictItemsFromCache(dictCode)) {
          return getDictItemsFromCache(dictCode);
        }
        //根据字典Code, 初始化字典数组
        ajaxGetDictItems(dictCode, null).then((res) => {
          if (res.success) {
            const regx = new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{12,}$/);
            const regExp = new RegExp("^(?=.*[a-zA-Z])(?=.*\\\d)(?=.*[~!@#$%^&*()_+`\\-={}:\";'<>?,./]).{"+Number(res.result[0].value)+",}$");
            this.validatorRules.password.rules[2]={
              pattern: regx,
              message: '密码由8位数字、大小写字母和特殊符号组成!',
              pattern: regExp,
              message: `密码由${res.result[0].value}位数字、大小写字母和特殊符号组成!`,
            }
            return res.result
          }
        })
      },