zhanghua
2024-01-21 e1aa0ecffbabd618c71e4ad94370fb8dffe6ee1c
src/views/layout/components/Header/index.vue
@@ -6,6 +6,17 @@
      <div class="menu-left__item" v-for="(item, index) in menuLeftList" :key="item.id" @click="changeActive(index)">
        <span :class="item.checked ? 'my-active' : 'my-activeno'" @click="menuChange(item)">{{ item.label }}</span>
      </div>
      <div class="menu-left__item" v-for="(item, index) in menuLinkList" :key="item.id+index" >
        <span class="link-active" @click="menuOpen(item)">{{ item.name }}</span>
      </div>
      <el-dropdown trigger="click" @command="handleCommand" v-if="linkLeng">
      <span class="el-dropdown-link">
        <i class="el-icon-arrow-down el-icon--right"></i>
      </span>
        <el-dropdown-menu slot="dropdown" >
          <el-dropdown-item  v-for="(i,dx) in menuLinkLists" :key="i.id+dx" :command="i">{{i.name}}</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <!-- 右侧菜单 -->
    <div class="header-right">
@@ -37,7 +48,7 @@
      <div class="menu-right__item user" @mousemove="flag.user = true" @mouseleave="flag.user = false">
        <span class="user-span">|</span>
        <el-avatar :size="20" :src="user.user.icon" v-if="user.user.icon"></el-avatar>
        <el-avatar :size="20" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" v-else>
        <el-avatar :size="20" src="../../../../assets/imgs/login/3ea6beec64369c2642b92c6726f1epng.png" v-else>
        </el-avatar>
        <span style="padding: 0 5px;">{{ user.user.username }}</span>
@@ -123,6 +134,7 @@
import updatePassword from "./updatePassword";
import users from "@/api/users";
import { Message } from "element-ui";
import {searchexternalLinks} from "@/api/system/portal/externalLinks";
export default {
  components: {
@@ -130,6 +142,9 @@
  },
  data() {
    return {
      linkLeng:false,
      menuLinkLists:[],
      menuLinkList:[],
      baseInformationVisible: false,
      updatePasswordDialog: false,
      channelSettingVisible: false,
@@ -138,7 +153,7 @@
        {
          label: '驾驶舱',
          checked: false,
          url: '',
          url: 'http://111.1.140.92:28081/cockpit/dist/board.html#/share-board/ze5EdUnw',
          id: '1f'
        },
        {
@@ -152,6 +167,12 @@
          checked: false,
          url: '',
          id: '3f',
        },
        {
          label: '油烟检测',
          checked: false,
          url: 'http://116.62.234.187:8120/#/SpecificLogin?subname=sccgj',
          id: '4f',
        },
      ],
      flag: {
@@ -171,6 +192,12 @@
  },
  created() {
    this.setLoginInfo();
    this.getExternalLinks()
  },
  mounted(){
    window.eventBus.$on('setFeaturesData', ()=>{ // 不带参数
      this.getExternalLinks()
    })
  },
  watch:{
    $route() {
@@ -180,6 +207,32 @@
    },
  },
  methods: {
    handleCommand(e){
      console.log(e)
      this.menuOpen(e)
    },
    menuOpen(row){
      window.open('http://'+row.url, '_blank');
    },
    async getExternalLinks() {
      await searchexternalLinks().then((res) => {
        let that = this
        that.menuLinkList=[]
        if (res.length > 5) {
          that.linkLeng = true
        }
        that.menuLinkLists = res
        for (let i = 0; i < res.length; i++) {
          that.menuLinkList.push(res[i])
          if (i == 4) {
            break;
          }
        }
        // console.log(that.menuLinkLists)
        // this.menuLinkList = res
      });
    },
    cancelChannel(){
      this.channelSettingVisible=false
    },
@@ -300,7 +353,7 @@
    },
    menuChange(data) {
      if (data.id === '1f') {
        window.open('http://cockpit.patstech.net:28081/cockpit/dist/board.html#/share-board/zfu0LsJ9', '_blank');
        window.open('http://111.1.140.92:28081/cockpit/dist/board.html#/share-board/ze5EdUnw', '_blank');
      }
      if (data.id === '2f') {
        this.$router.push({ path: "/home/video" })
@@ -308,12 +361,20 @@
      if (data.id === '3f') {
        this.$router.push({ path: "/home/operate/casepool/pool" })
      }
      if (data.id === '4f') {
        window.open('http://116.62.234.187:8120/#/SpecificLogin?subname=sccgj', '_blank');
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}
::v-deep .el-form {
  padding: 3vh 5vw;
@@ -335,7 +396,7 @@
  .header-left {
    display: flex;
    flex: 1;
align-items: center;
    .menu-left__item {
      width: 120px;
@@ -350,7 +411,19 @@
        }
      }
    }
.link-active{
  overflow:hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  -o-text-overflow:ellipsis;
}
    .link-active:hover{
      color: #2f54eb;
      background-color: #313350;
    }
    .my-active {
      border-radius: 20px;
      color: #2f54eb;
@@ -397,7 +470,7 @@
    .user {
      //margin-left: 20px;
      flex: 1;
      flex: 2;
      display: flex;
      align-items: center;
      justify-content: center;