This commit is contained in:
xinbowang
2020-08-30 20:37:40 +08:00
parent 5699960caf
commit db8269b947
9 changed files with 431 additions and 5 deletions

View File

@ -14,7 +14,7 @@ NProgress.configure({
})
//const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
const whiteList = ['/login']
const whiteList = ['/login', '/experience/apply/', '/experience/result/', '/experience/content/', '/activity', 'week', 'month', ', term', 'play']
router.beforeEach((to, from, next) => {
NProgress.start()
@ -64,9 +64,17 @@ router.beforeEach((to, from, next) => {
}
}
} else {
//console.log(whiteList.indexOf(to.path));
// 没有token
if (whiteList.indexOf(to.path) !== -1 ||to.path.indexOf("/experience/apply/") != -1||to.path.indexOf("/experience/result/") != -1||to.path.indexOf("/experience/content/") != -1||to.path.indexOf("/activity") != -1) {
// if (whiteList.indexOf(to.path) !== -1 ||to.path.indexOf("/experience/apply/") != -1||to.path.indexOf("/experience/result/") != -1||to.path.indexOf("/experience/content/") != -1||to.path.indexOf("/activity") != -1||to.path.indexOf("/week") != -1) {
let whiteBool = false;
for (let path of whiteList) {
// console.log(to.path.indexOf(path) > -1);
if (to.path.indexOf(path) > -1) {
whiteBool = true;
break;
}
}
if (whiteBool) {
// 在免登录白名单,直接进入
next()
} else {