MrShi
2025-12-16 66510450a254daed07b97cc10698cb1a228d716f
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>
@@ -21,14 +21,14 @@
              </div>
          </div>
          <div class="user-images">
<!--              <img src="@/assets/icons/ic_1.jpg" alt="">-->
<!--              <img src="@/assets/icons/ic_2.png" alt="">-->
              <img src="@/assets/icons/ic_1.jpg" alt="">
              <img src="@/assets/icons/ic_2.png" alt="">
              <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,10 +199,10 @@
    getHKAFHeaderNav (type, label) {
      getAppHeaderNav(type).then(res => {
        if (label === '安防中心') {
          const openWindow = window.open(res, '_blank')
          // setTimeout(() => {
          //   openWindow.close()
          // }, 7 * 1000)
          let openWindow = window.open(res, '_blank')
          setTimeout(() => {
            openWindow.close()
          }, 7 * 1000)
        } else {
          window.open(res, '_blank')
        }
@@ -344,7 +325,7 @@
@import "@/assets/style/variables.scss";
.common-header {
  background-color: #1E7FFF;
  background-color: #2080f7;
}
.list {
@@ -354,14 +335,14 @@
    display: flex;
    align-items: center;
    .item {
      margin-right: 24px;
      margin-right: 40px;
      font-size: 16px;
      font-weight: 400;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      height: 49px;
      height: 40px;
      cursor: pointer;
      .linellae {
@@ -389,7 +370,7 @@
    box-sizing: border-box;
    min-width: 360px;
    height: 56px;
    padding: 10px 12px;
    padding: 10px 20px;
    // flex-shrink: 0;
    line-height: 36px;
    font-size: 22px;
@@ -494,9 +475,9 @@
        align-items: center;
        img {
            top: 0 !important;
            width: 18px;
            height: 18px;
            margin-right: 12px;
            width: 24px;
            height: 24px;
            margin-right: 15px;
        }
    }
    .el-dropdown {