|
@@ -1,7 +1,7 @@
|
|
|
import router from '@/router'
|
|
|
import store from '@/store'
|
|
|
import { getToken, getUserInfo, initGoPage } from '@/utils/auth'
|
|
|
-import getPageTitle from './utils/get-page-title'
|
|
|
+// import getPageTitle from './utils/get-page-title'
|
|
|
|
|
|
// 获取用户信息
|
|
|
const userInfo = getUserInfo()
|
|
@@ -11,17 +11,18 @@ if (userInfo) {
|
|
|
|
|
|
// 路由白名单
|
|
|
const whiteList = ['/login']
|
|
|
-const shareList = ['/share', '/share/pay', '/share/pay-success', '/share/pay-faild']
|
|
|
+const shareList = ['Share', 'SharePayVip', 'SharePaySuccess', 'SharePayFaild']
|
|
|
|
|
|
// 路由拦截器
|
|
|
router.beforeEach(async(to, from, next) => {
|
|
|
// 获取token
|
|
|
const hasToken = getToken()
|
|
|
// 设置页面标题
|
|
|
- document.title = getPageTitle(to.meta.title)
|
|
|
-
|
|
|
- if (shareList.indexOf(to.path) > -1) {
|
|
|
+ // document.title = getPageTitle(to.meta.title)
|
|
|
+ console.log(to)
|
|
|
+ if (shareList.indexOf(to.name) > -1) {
|
|
|
next()
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
if (hasToken) {
|
|
@@ -38,7 +39,6 @@ router.beforeEach(async(to, from, next) => {
|
|
|
next()
|
|
|
} else {
|
|
|
try {
|
|
|
- console.log(to)
|
|
|
// 代理状态更换时清空全部页面标签
|
|
|
if (store.getters.isChangeProxy) {
|
|
|
store.commit('tagsView/CLEAR_ALL_VIEW')
|
|
@@ -50,8 +50,10 @@ router.beforeEach(async(to, from, next) => {
|
|
|
const accessRoutes = await store.dispatch('permission/generateRoutes')
|
|
|
// 添加路由配置
|
|
|
router.addRoutes(accessRoutes)
|
|
|
+ // debugger
|
|
|
+ console.log(to)
|
|
|
// 放行
|
|
|
- next({ ...to, replace: true })
|
|
|
+ next({ ...to, path: '/', replace: true })
|
|
|
} catch (err) {
|
|
|
store.dispatch('user/logout')
|
|
|
}
|