|
|
@ -6,13 +6,15 @@ import { obtainUrlPathParameterTarget } from '@/utils/index.js' |
|
|
|
import { getToken, removeToken } from '@/utils/auth' |
|
|
|
import { getToken, removeToken } from '@/utils/auth' |
|
|
|
import { Notify } from 'vant' |
|
|
|
import { Notify } from 'vant' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let whiteList = ['/home'] |
|
|
|
|
|
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => { |
|
|
|
router.beforeEach(async (to, from, next) => { |
|
|
|
//pinia挂载顺序问题异步处理路由拦截
|
|
|
|
//pinia挂载顺序问题异步处理路由拦截
|
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
let store = useStore() //获取状态
|
|
|
|
let store = useStore() //获取状态
|
|
|
|
let token = getToken() //获取cookie
|
|
|
|
let token = getToken() //获取cookie
|
|
|
|
// removeToken()
|
|
|
|
// removeToken()
|
|
|
|
// store.getPosition()
|
|
|
|
!whiteList.includes(to.path) && store.getPosition() |
|
|
|
|
|
|
|
|
|
|
|
if (!token) { |
|
|
|
if (!token) { |
|
|
|
let paramsTarget = obtainUrlPathParameterTarget(location.href) |
|
|
|
let paramsTarget = obtainUrlPathParameterTarget(location.href) |
|
|
|