|
@@ -2,6 +2,7 @@ import * as vueRouter from 'vue-router'
|
|
|
import baseData from './modules/base'
|
|
|
import { getToken } from '~src/api/auth'
|
|
|
import { getRouterData } from './routers'
|
|
|
+import { getStoreValue } from '~src/utils/storage'
|
|
|
import NProgress from 'nprogress'
|
|
|
import '~src/styles/app/nprogress.scss'
|
|
|
|
|
@@ -14,7 +15,7 @@ const router = vueRouter.createRouter({
|
|
|
//路由拦截
|
|
|
router.beforeResolve(async (to) => {
|
|
|
NProgress.start()
|
|
|
- const token = getToken(), auth = ['/login-main', '/new-login', '/login', '/auth', '/auth-token']
|
|
|
+ const token = getToken(), auth = ['/login-main', '/new-login', '/login', '/auth', '/auth-token', '/403', '/404', '/500']
|
|
|
if (auth.indexOf(to.path) !== -1) {
|
|
|
return true
|
|
|
} else if (!token) {
|
|
@@ -24,7 +25,13 @@ router.beforeResolve(async (to) => {
|
|
|
if (res) {
|
|
|
return true
|
|
|
} else {
|
|
|
- return '/login-main'
|
|
|
+ const isSource = getStoreValue('isSource') || ''
|
|
|
+ if (isSource === 'hezuo') {
|
|
|
+ window.$message?.error('您暂无相关权限,请联系管理员')
|
|
|
+ return '/403'
|
|
|
+ } else {
|
|
|
+ return '/login-main'
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|