Browse Source

拉取代码

朱鑫波 3 years ago
parent
commit
c9462f7883
2 changed files with 28 additions and 5 deletions
  1. 2 0
      src/store/modules/user.js
  2. 26 5
      src/views/bossDataKanban/index.vue

+ 2 - 0
src/store/modules/user.js

@@ -319,6 +319,8 @@ const user = {
         commit('SET_PERMISSIONLIST', [])
         Vue.ls.remove(ACCESS_TOKEN)
         localStorage.removeItem("roleCode")
+        commit('SET_INFO', [])
+        Vue.ls.remove(USER_INFO)
         //console.log('logoutToken: '+ logoutToken)
         logout(logoutToken).then(() => {
           resolve()

+ 26 - 5
src/views/bossDataKanban/index.vue

@@ -468,13 +468,34 @@
             }
         },
         created() {
-         let userInfo=localStorage.getItem('pro__Login_Userinfo')
-         if (!userInfo) {
-         this.$router.push({ path: '/user/login'})
-         }
-
+        //  let userInfo=localStorage.getItem('pro__Login_Userinfo')
+        //  if (!userInfo) {
+        //  this.$router.push({ path: '/user/login'})
+        //  }
+            if(!this.userInfo()){
+                this.$router.push({ path: '/user/login'})
+            }
 
         },
+        // updated(){
+
+        
+        // },
+        beforeRouteLeave (to, from) {
+            if(!this.userInfo()){
+                this.$confirm({
+                    title: '提示',
+                    content: '当前登录已失效,请重新登陆',
+                    onOk() {
+                       
+                        window.location.href="/";
+                       
+                    },
+                    onCancel() {
+                    },
+                });
+            }
+        },
 
         mounted() {