MrShi
2025-12-17 52ff9606751d2912719e246c8ce86249f2934548
admin/src/components/common/CommonHeader.vue
@@ -2,7 +2,7 @@
  <div class="common-header">
    <div class="header">
      <div class="logo">
        <div class="title"> <img src="@/assets/system.png" alt="" />{{sysConfig.subtitle || title }}</div>
        <div class="title"> <img src="@/assets/system.png" alt="" />{{ title }}</div>
        <div class="list">
            <div  :class="index==currentIndex?'item active':'item'" v-for="(item,index) in topMenuList.list" :key="item.id"  @click="getHeaderNav(item,index)" :index="index">{{item.label}}
              <div v-if="index==currentIndex" class="linellae"></div>
@@ -26,9 +26,9 @@
              <img src="@/assets/icons/ic_3.jpg" alt="">
              <img src="@/assets/icons/ic_4.jpg" alt="">
              <img src="@/assets/icons/ic_5.jpg" alt="">
<!--              <img src="@/assets/icons/ic_6.jpg" alt="">-->
              <img src="@/assets/icons/ic_6.jpg" alt="">
              <img src="@/assets/icons/ic_7.jpg" alt="">
<!--              <img src="@/assets/icons/ic_8.jpg" alt="">-->
              <img src="@/assets/icons/ic_8.jpg" alt="">
          </div>
          <el-dropdown v-if="isLogined" trigger="click">
            <span class="el-dropdown-link" style="cursor: pointer; color: rgba(255,255,255,.56);">
@@ -65,7 +65,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="请输入新密码,至少包括数字、大写字母、小写字母、特殊字符中的三种字符,且至少8位数"
          <el-input v-model="changePwdData.form.newPwd" type="password" placeholder="请输入新密码,密码需包含字母、数字及特殊字符中的至少两种"
            maxlength="20" show-password></el-input>
        </el-form-item>
        <!-- <div style="font-size: 12px;color:#999999">密码需包含字母、数字及特殊字符中的至少两种</div> -->
@@ -81,7 +81,7 @@
<script>
import { mapState, mapMutations } from 'vuex'
import GlobalAlertWindow from './GlobalAlertWindow'
import { getSystemConfig, logout, updatePwd } from '@/api/system/common'
import { logout, updatePwd } from '@/api/system/common'
import { getAppHeaderNav } from '@/api'
export default {
  name: 'CommonHeader',
@@ -96,6 +96,7 @@
    return {
      title: process.env.VUE_APP_TITLE,
      headerNavData: {},
      currentIndex: 0,
      visible: {
        // 修改密码
        changePwd: false
@@ -128,13 +129,13 @@
    }
  },
  computed: {
    ...mapState(['menuData', 'userInfo', 'topMenuList', 'currentIndex', 'sysConfig'])
    ...mapState(['menuData', 'userInfo', 'topMenuList'])
    // title () {
    //   return this.$route.meta.title
    // }
  },
  created () {
    this.getSystemConfig()
  },
  mounted () {
    // needChangePwd 0 : 默认密码需要修改,1 不需要
@@ -155,7 +156,7 @@
    }
  },
  methods: {
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent', 'setCurrentIndex', 'setSysconfig']),
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent']),
    // 修改密码
    changePwd () {
      this.visible.changePwd = true
@@ -163,51 +164,31 @@
        this.$refs.changePwdDataForm.resetFields()
      })
    },
    getSystemConfig () {
      if (!this.sysConfig.subTitle) {
        getSystemConfig()
          .then((res) => {
            if (res && res.subtitle) {
              this.setSysconfig(res)
            }
          })
      }
    },
    validatePassword (rule, value, callback) {
      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('密码需包含字母、数字及特殊字符中的至少两种'))
        // } 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()
        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(new Error('至少包括数字、大写字母、小写字母、特殊字符中的三种字符,且至少8位数'))
          callback() // 验证通过
        }
      }
    },
    getHeaderNav (item, index) {
      this.setCurrentIndex(index)
      if (item.linkType === 0) {
    getHeaderNav (item,index) {
      this.currentIndex = index
      if(item.linkType === 0){
        this.setTopMenuCurrent(item)
      } else {
      }else{
        if (item.url && item.url === 'goHKAF' && item.params != null) {
          this.getHKAFHeaderNav(item.params, item.label)
        } else if (item.url && item.url.indexOf('http') === 0) {
@@ -218,7 +199,7 @@
    getHKAFHeaderNav (type, label) {
      getAppHeaderNav(type).then(res => {
        if (label === '安防中心') {
          const openWindow = window.open(res, '_blank')
          let openWindow = window.open(res, '_blank')
          // setTimeout(() => {
          //   openWindow.close()
          // }, 7 * 1000)