到第三方登录页面时先删除之前的token

This commit is contained in:
dongq107 2023-05-18 15:12:31 +08:00
parent d09e415720
commit ce62a19aa0
2 changed files with 6 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import store from '@/store/index';
import router from './router/index'; import router from './router/index';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; 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 { getFrontProjectConfigByLogin} from '@/api/projectConfig';
import localStore from 'storejs'; import localStore from 'storejs';
import { handlerUrl } from '@/utils/baseUrl'; import { handlerUrl } from '@/utils/baseUrl';
@ -84,6 +84,9 @@ function handleRoute(to, next, loginPath) {
// } // }
// } // }
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
if (to.path == '/thirdLogin') { // 到第三方登录页面时先删除之前的token
removeToken();
}
// 判断第三方登陆 // 判断第三方登陆
if (to.query.thirdJump) { if (to.query.thirdJump) {
setToken(to.query.key); setToken(to.query.key);

View File

@ -53,8 +53,7 @@ export default {
deviceCode:deviceCode deviceCode:deviceCode
}, LoginParams.LianKeTang); }, LoginParams.LianKeTang);
this.message = '正在登陆中......'; this.message = '正在登陆中......';
// const tokenKey = getToken(); const tokenKey = getToken();
const tokenKey = '';
if (tokenKey) { if (tokenKey) {
const header = { group: '', 'X-Token': tokenKey }; const header = { group: '', 'X-Token': tokenKey };
this.$store.dispatch('setToken', tokenKey); this.$store.dispatch('setToken', tokenKey);