|
|
|
@ -3,7 +3,7 @@ import store from './store'
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
import NProgress from 'nprogress'
|
|
|
|
|
import 'nprogress/nprogress.css'
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
import { getToken, setAdminId, setToken } from '@/utils/auth'
|
|
|
|
|
import { isRelogin } from '@/utils/request'
|
|
|
|
|
|
|
|
|
|
NProgress.configure({ showSpinner: false })
|
|
|
|
@ -12,6 +12,21 @@ const whiteList = ['/login', '/auth-redirect', '/bind', '/register',"/forgetPass
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
NProgress.start()
|
|
|
|
|
// 获取当前URL
|
|
|
|
|
var url = new URL(window.location.href);
|
|
|
|
|
|
|
|
|
|
// 获取minid的值
|
|
|
|
|
if (url.searchParams.has('minid')) {
|
|
|
|
|
var adminId = url.searchParams.get("minid");
|
|
|
|
|
var token = url.searchParams.get("tk");
|
|
|
|
|
setToken(token);
|
|
|
|
|
setAdminId(adminId);
|
|
|
|
|
store.commit("SET_TOKEN", token);
|
|
|
|
|
store.commit("SET_ADMINID",adminId);
|
|
|
|
|
var baseUrl = url.origin + url.pathname + url.hash;
|
|
|
|
|
console.log(baseUrl);
|
|
|
|
|
window.location.href = baseUrl
|
|
|
|
|
}else {
|
|
|
|
|
if (getToken()) {
|
|
|
|
|
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
|
|
|
|
/* has token*/
|
|
|
|
@ -49,6 +64,8 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
NProgress.done()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
router.afterEach(() => {
|
|
|
|
|