diff --git a/src/permission.js b/src/permission.js index b0dff606c..ab779ede4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -3,7 +3,7 @@ import store from '@/store/index'; import router from './router/index'; import NProgress from 'nprogress'; import 'nprogress/nprogress.css'; -import { setToken, getToken, getSessionStorage, setSessionStorage } from '@/utils/auth'; +import { setToken, getToken, getSessionStorage, setSessionStorage, removeToken } from '@/utils/auth'; import { getFrontProjectConfigByLogin} from '@/api/projectConfig'; import localStore from 'storejs'; import { handlerUrl } from '@/utils/baseUrl'; @@ -83,7 +83,10 @@ function handleRoute(to, next, loginPath) { // store.dispatch('subscribe', {header, type: getSessionStorage('project')}); // } // } -router.beforeEach( async (to, from, next) => { +router.beforeEach(async (to, from, next) => { + if (to.path == '/thirdLogin') { // 到第三方登录页面时先删除之前的token + removeToken(); + } // 判断第三方登陆 if (to.query.thirdJump) { setToken(to.query.key); diff --git a/src/views/thirdLogin/index.vue b/src/views/thirdLogin/index.vue index 0a1638019..e6343cea4 100644 --- a/src/views/thirdLogin/index.vue +++ b/src/views/thirdLogin/index.vue @@ -53,8 +53,7 @@ export default { deviceCode:deviceCode }, LoginParams.LianKeTang); this.message = '正在登陆中......'; - // const tokenKey = getToken(); - const tokenKey = ''; + const tokenKey = getToken(); if (tokenKey) { const header = { group: '', 'X-Token': tokenKey }; this.$store.dispatch('setToken', tokenKey);