MrShi
8 小时以前 bff05c941230c57f0a1ed8d0e3c4f9c7b2b8af13
admin/src/components/common/CommonHeader.vue
@@ -35,7 +35,7 @@
            show-password></el-input>
        </el-form-item>
        <el-form-item label="新密码" prop="newPwd" required>
          <el-input v-model="changePwdData.form.newPwd" type="password" placeholder="请输入新密码,密码需包含字母、数字及特殊字符中的至少两种"
          <el-input v-model="changePwdData.form.newPwd" type="password" placeholder="请输入新密码,至少包括数字、大写字母、小写字母、特殊字符中的三种字符,且至少8位数"
            maxlength="20" show-password></el-input>
        </el-form-item>
        <!-- <div style="font-size: 12px;color:#999999">密码需包含字母、数字及特殊字符中的至少两种</div> -->
@@ -66,7 +66,6 @@
    return {
      title: process.env.VUE_APP_TITLE,
      headerNavData: {},
      currentIndex: 0,
      visible: {
        // 修改密码
        changePwd: false
@@ -99,7 +98,7 @@
    }
  },
  computed: {
    ...mapState(['menuData', 'userInfo', 'topMenuList'])
    ...mapState(['menuData', 'userInfo', 'topMenuList', 'currentIndex'])
    // title () {
    //   return this.$route.meta.title
    // }
@@ -126,7 +125,7 @@
    }
  },
  methods: {
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent']),
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent', 'setCurrentIndex']),
    // 修改密码
    changePwd () {
      this.visible.changePwd = true
@@ -138,25 +137,36 @@
      if (!value) {
        callback(new Error('请输入密码'))
      } else {
        const lengthValid = /^.{6,20}$/.test(value)
        const hasLetter = /[a-zA-Z]/.test(value)
        const hasNumber = /[0-9]/.test(value)
        const hasSpecial = /[!@#$%^&*(),.?":{}|<>]/.test(value)
        const typesCount = [hasLetter, hasNumber, hasSpecial].filter(Boolean).length
        if (!lengthValid) {
          callback(new Error('密码长度需为6到20个字符'))
        } else if (typesCount < 2) {
          callback(new Error('密码需包含字母、数字及特殊字符中的至少两种'))
        // const lengthValid = /^.{6,20}$/.test(value)
        // const hasLetter = /[a-zA-Z]/.test(value)
        // const hasNumber = /[0-9]/.test(value)
        // const hasSpecial = /[!@#$%^&*(),.?":{}|<>]/.test(value)
        //
        // const typesCount = [hasLetter, hasNumber, hasSpecial].filter(Boolean).length
        //
        // if (!lengthValid) {
        //   callback(new Error('密码长度需为6到20个字符'))
        // } else if (typesCount < 2) {
        //   callback(new Error('密码需包含字母、数字及特殊字符中的至少两种'))
        // } else {
        //   callback() // 验证通过
        // }
        let typeCount = 0;
        if (/[a-z]/.test(value)) typeCount++; // 小写字母
        if (/[A-Z]/.test(value)) typeCount++; // 大写字母
        if (/\d/.test(value)) typeCount++;    // 数字
        if (/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(value)) typeCount++; // 特殊字符
        if (typeCount >= 3) {
          callback()
        } else {
          callback() // 验证通过
          callback(new Error('至少包括数字、大写字母、小写字母、特殊字符中的三种字符,且至少8位数'))
        }
      }
    },
    getHeaderNav (item,index) {
      this.currentIndex = index
      this.setCurrentIndex(index)
      if(item.linkType === 0){
        console.log('setTopMenuCurrent')
        this.setTopMenuCurrent(item)
      }else{
        if (item.url && item.url === 'goHKAF' && item.params != null) {