管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2022-12-21 ec3342e1b34dd02f33dae9bed2db16a14ae8096d
src/components/navMenu.vue
@@ -64,7 +64,7 @@
import { logout, selectMenuRecursive } from '@/api/api';
import { removeToken, getToken } from '@/utils/auth';
import customElMenu from '../components/customElMenu.vue';
import { queryMenuTree } from '../api/api';
import { queryMenuTree, getPerms } from '../api/api';
import colorChange from '../views/maintenance/colorChange.vue';
import { containsCoordinate } from 'ol/extent';
import Vue from 'vue';
@@ -94,7 +94,7 @@
      itemdetail: {},
      formLabelWidth: '70px',
      count: 5,
      changeSelectStyle: 5,
      changeSelectStyle: null,
      changeliSelect: null,
      changeSelectdiv: false,
      listMenu: [
@@ -126,6 +126,30 @@
  },
  computed: {},
  methods: {
    async getCookies() {
      var boolean = this.getTimeCookies();
      if (boolean != true) {
        this.$router.push('/login');
        return;
      }
      if (this.$store.state.permsEntity.length == 0) {
        const data = await getPerms();
        this.$store.state.permsEntity = data.result;
      }
      this.$store.state.uname = JSON.parse(
        localStorage.getItem('LFToken')
      ).uname;
      this.$router.push('/');
    },
    getTimeCookies() {
      var time1 = new Date(JSON.parse(localStorage.getItem('LFToken')).time);
      var time2 = new Date();
      if (time2 > time1) {
        return false;
      } else {
        return true;
      }
    },
    //主题切换
    setThemeColors() {},
    //鼠标移入菜单事件
@@ -136,7 +160,7 @@
        this.$router.push(item.url);
        if (this.showFlag != null) {
          this.setShowFalseDiv(false);
          this.changeliSelect = '呵呵';
          this.changeliSelect = '%%';
          this.showFlag = null;
        }
      } else {
@@ -152,6 +176,7 @@
      this.changeSelectStyle = index;
    },
    setShowFalseDiv(bolean) {
      var index = this.showFlag;
      let newItem = this.listMenu[index];
@@ -165,6 +190,7 @@
      this.$store.commit('currentPerms', res.perms);
    },
    async getMenuTree() {
      this.getCookies();
      const data = await queryMenuTree();
      var that = this;
      if (data.code == 200) {
@@ -189,8 +215,15 @@
          res[i].children = result.result.filter((value) => {
            return value.pid == res[i].id;
          });
          this.listMenu.push(res[i]);
          this.changeSelectStyle = this.listMenu.length - 1;
          var strartMneu = res[i].children[0];
          this.$store.commit('currentPerms', strartMneu.perms);
          this.changeliSelect = strartMneu.cnName;
          this.$bus.$emit('currentPerms', strartMneu.perms);
        } else {
          this.listMenu.push(res[i]);
        }
        this.listMenu.push(res[i]);
      }
    },
    treeData(source) {
@@ -508,7 +541,7 @@
  }
  .secondMenuDiv {
    position: absolute;
    z-index: 30;
    z-index: 1024;
    margin-top: 10px;
    border: 1px solid white;
    border-radius: 5px;