MrShi
2025-12-17 52ff9606751d2912719e246c8ce86249f2934548
admin/src/components/common/CommonHeader.vue
@@ -10,18 +10,48 @@
        </div>
      </div>
      <div class="user">
        <el-dropdown v-if="isLogined" trigger="click">
          <span class="el-dropdown-link">
            <!-- <img v-if="userInfo != null" :src="userInfo.avatar == null ? `${require('@/assets/avatar/man.png')}` : userInfo.avatar" alt="">{{userInfo | displayName}}<i class="el-icon-arrow-down el-icon--right"></i> -->
            <img v-if="userInfo != null" style="width: 30px !important" src="@/assets/avatar/man.png" alt="" />{{
              userInfo | displayName
            }}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="changePwd">修改密码</el-dropdown-item>
            <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
          <div class="user-search">
              <div class="user-search-left">
                <span>全部</span>
                  <img src="@/assets/icons/xl.png" alt="">
              </div>
              <div class="user-search-right">
                  <input type="text" placeholder="请输入" />
                  <img src="@/assets/icons/sousuo.png" alt="">
              </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_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_7.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);">
              {{ userInfo | displayName }}
              <i class="el-icon-arrow-down el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="changePwd">修改密码</el-dropdown-item>
              <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
<!--        <el-dropdown v-if="isLogined" trigger="click">-->
<!--          <span class="el-dropdown-link">-->
<!--            &lt;!&ndash; <img v-if="userInfo != null" :src="userInfo.avatar == null ? `${require('@/assets/avatar/man.png')}` : userInfo.avatar" alt="">{{userInfo | displayName}}<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i> &ndash;&gt;-->
<!--            <img v-if="userInfo != null" style="width: 30px !important" src="@/assets/avatar/man.png" alt="" />{{-->
<!--              userInfo | displayName-->
<!--            }}<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
<!--          </span>-->
<!--          <el-dropdown-menu slot="dropdown">-->
<!--            <el-dropdown-item @click.native="changePwd">修改密码</el-dropdown-item>-->
<!--            <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>-->
<!--          </el-dropdown-menu>-->
<!--        </el-dropdown>-->
      </div>
    </div>
    <!-- 修改密码 -->
@@ -35,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> -->
@@ -66,6 +96,7 @@
    return {
      title: process.env.VUE_APP_TITLE,
      headerNavData: {},
      currentIndex: 0,
      visible: {
        // 修改密码
        changePwd: false
@@ -98,7 +129,7 @@
    }
  },
  computed: {
    ...mapState(['menuData', 'userInfo', 'topMenuList', 'currentIndex'])
    ...mapState(['menuData', 'userInfo', 'topMenuList'])
    // title () {
    //   return this.$route.meta.title
    // }
@@ -125,7 +156,7 @@
    }
  },
  methods: {
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent', 'setCurrentIndex']),
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent']),
    // 修改密码
    changePwd () {
      this.visible.changePwd = true
@@ -137,34 +168,24 @@
      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)
      this.currentIndex = index
      if(item.linkType === 0){
        this.setTopMenuCurrent(item)
      }else{
@@ -179,9 +200,9 @@
      getAppHeaderNav(type).then(res => {
        if (label === '安防中心') {
          let openWindow = window.open(res, '_blank')
          setTimeout(() => {
            openWindow.close()
          }, 7 * 1000)
          // setTimeout(() => {
          //   openWindow.close()
          // }, 7 * 1000)
        } else {
          window.open(res, '_blank')
        }
@@ -304,7 +325,7 @@
@import "@/assets/style/variables.scss";
.common-header {
  background-color: #2080f7;
  background-color: #1E7FFF;
}
.list {
@@ -314,14 +335,14 @@
    display: flex;
    align-items: center;
    .item {
      margin-right: 40px;
      margin-right: 24px;
      font-size: 16px;
      font-weight: 400;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      height: 40px;
      height: 49px;
      cursor: pointer;
      .linellae {
@@ -349,7 +370,7 @@
    box-sizing: border-box;
    min-width: 360px;
    height: 56px;
    padding: 10px 20px;
    padding: 10px 12px;
    // flex-shrink: 0;
    line-height: 36px;
    font-size: 22px;
@@ -382,15 +403,83 @@
  }
  .user {
    width: 152px;
    /*width: 152px;*/
    box-sizing: border-box;
    height: 56px;
    padding-right: 25px;
    background: url("../../assets/images/top_ic_bolang@2x.png") no-repeat;
    /*background: url("../../assets/images/top_ic_bolang@2x.png") no-repeat;*/
    flex-shrink: 0;
    text-align: right;
    cursor: pointer;
    display: flex;
    align-items: center;
    .user-search {
        width: 346px;
        height: 32px;
        border-radius: 30px;
        border: 1px solid rgba(255,255,255,.56);
        margin-right: 15px;
        display: flex;
        align-items: center;
        .user-search-left {
            flex-shrink: 0;
            width: 106px;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            span {
                font-size: 14px;
                font-weight: 400;
                color: rgba(255,255,255,.56);
                margin-right: 10px;
            }
            img {
                top: 0;
                margin: 0;
                width: 20px;
                height: 16px;
            }
        }
        .user-search-right {
            flex: 1;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding-right: 10px;
            box-sizing: border-box;
            input {
                flex: 1;
                height: 100%;
                font-size: 14px;
                font-weight: 400;
                color: rgba(255,255,255,.56);
                border: none;
                outline: none;
                background-color: rgba(0,0,0,0);
                &::placeholder {
                    color: rgba(255,255,255,.56);
                }
            }
            img {
                top: 0;
                margin: 0;
                width: 20px;
                height: 20px;
            }
        }
    }
    .user-images {
        height: 100%;
        display: flex;
        align-items: center;
        img {
            top: 0 !important;
            width: 18px;
            height: 18px;
            margin-right: 12px;
        }
    }
    .el-dropdown {
      top: 2px;
      color: #fff;