Browse Source

update1.0

huac 3 years ago
parent
commit
e6e75d1479
3 changed files with 43 additions and 12 deletions
  1. 26 10
      src/components/main.vue
  2. 1 1
      src/config/routerBefore.js
  3. 16 1
      src/store/index.js

+ 26 - 10
src/components/main.vue

@@ -1146,16 +1146,32 @@ export default {
                         // window.location.href = './index.html';
                         // /*
                         // ajax
-                        this.store.dispatch('loginOut').then(function (res) {
-                            instance.confirmButtonText = '确定';
-                            instance.confirmButtonLoading = false;
-                            done();
-                            window.location.href = './index.html';
-                        }).catch(function () {
-                            instance.confirmButtonText = '确定';
-                            instance.confirmButtonLoading = false;
-                            done();
-                        });
+                        if (getCookie('ticket')) {
+                            let res = this.axios.get('pass/logout', {
+                                params: {
+                                    authorization: getCookie('accessToken')
+                                }
+                                });
+                                res.then(function (res) {
+                                    console.log(111)
+                                    instance.confirmButtonText = "确定";
+                                    instance.confirmButtonLoading = false;
+                                    done();
+                                    window.location.href = "./index.html";
+                                    })
+                            }
+                            else {
+                            this.store.dispatch('loginOut').then(function (res) {
+                                instance.confirmButtonText = '确定';
+                                instance.confirmButtonLoading = false;
+                                done();
+                                window.location.href = './index.html';
+                            }).catch(function () {
+                                instance.confirmButtonText = '确定';
+                                instance.confirmButtonLoading = false;
+                                done();
+                            });                                
+                            }
                         // */
                     } else {
                         done();

+ 1 - 1
src/config/routerBefore.js

@@ -129,7 +129,7 @@ const routerBefore = function (router, constantRouterMap) {
       DoneCookie(to, from, next, flag)
     }
     //
-    function DoneCookie (to, from, next, flag) {
+    function DoneCookie (to, from, next, a) {
       if (getCookie('accessToken')) { // 判断是否有token
         if (window.top.document.URL === window.document.URL && !window.top.localStorage.getItem('ownPrivilege')) {
           store.dispatch('getOwnMenuUrl');

+ 16 - 1
src/store/index.js

@@ -78,7 +78,8 @@ const state = {
   },
   // 拥有权限信息
   ownPrivilege: [],
-  token: ''
+  token: '',
+  loginInfo: null
 
 };
 
@@ -112,6 +113,9 @@ const mutations = {
   refreshOwnPrivilege (state, ownPrivilege) {
     state.ownPrivilege = ownPrivilege
   },
+  loginInfo (state, loginInfo) {
+    state.loginInfo = loginInfo;
+  },
   //  用户详情
   userInfo (state, userInfo) {
     state.userInfo = userInfo;
@@ -149,6 +153,17 @@ const actions = {
     });
     return res;
   },
+  getLoginInfo ({
+    commit,
+    state
+  }) {
+    let res = axios.post(proPath + 'auth/remoteauthentication/token');
+    res.then(res => {
+      //   放入东西
+      commit('loginInfo', res.data);
+    });
+    return res;
+  },
   getOwnMenuUrl ({
     commit,
     state