From 693c63dd4ea80db16f97c569df851a0f6fcf7906 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期六, 03 十二月 2022 17:37:50 +0800
Subject: [PATCH] bug修改

---
 src/components/navMenu.vue |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/components/navMenu.vue b/src/components/navMenu.vue
index 4a84824..c9c21bc 100644
--- a/src/components/navMenu.vue
+++ b/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';
@@ -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() {},
     //榧犳爣绉诲叆鑿滃崟浜嬩欢
@@ -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) {
@@ -508,7 +534,7 @@
   }
   .secondMenuDiv {
     position: absolute;
-    z-index: 30;
+    z-index: 1024;
     margin-top: 10px;
     border: 1px solid white;
     border-radius: 5px;

--
Gitblit v1.9.3