Commit 52434ba7 authored by xuezezhan's avatar xuezezhan

权限

parent cffd6bda
/*
* @Descripttion:
* @Author: 薛泽展
* @Date: 2021-10-12 12:29:05
* @Since: JDK1.8
*/
import router from './router'
import store from './store'
import { Message } from 'element-ui'
......@@ -8,7 +14,7 @@ import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist
const whiteList = ['/prov-register', '/city-register', '/login', '/auth-redirect'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
// start progress bar
......@@ -63,11 +69,13 @@ router.beforeEach(async(to, from, next) => {
}
} else {
/* has no token*/
console.info('=========================111' + to.path)
if (whiteList.indexOf(to.path) !== -1) {
// in the free login whitelist, go directly
console.info('=========================2222')
next()
} else {
console.info('=========================3333')
// other pages that do not have permission to access are redirected to the login page.
next(`/login?redirect=${to.path}`)
NProgress.done()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment