Commit 053e4122 by 李乾广

修改bug

1 parent eb87db47
...@@ -119,8 +119,20 @@ const router = createRouter( ...@@ -119,8 +119,20 @@ const router = createRouter(
) )
// 全局路由守卫 // 全局路由守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if ((Cookies.get('userrole_type')&&Cookies.get('userrole_type')==-1)||to.path == '/404') { // 加密获取userType
next(); let tokenArr = Cookies.get("atoken").split('')
let tokenArr1 = Cookies.get("atoken").split('-')
let usertypeArr = Cookies.get("userrole_type").split('-')
if(tokenArr1[0]==usertypeArr[0]&&tokenArr1[1]==usertypeArr[1]&&tokenArr1[2]==usertypeArr[2]){
let usertype = usertypeArr[3]
for(let yy=1;yy<tokenArr.length;yy++){
usertype = usertype - (tokenArr[yy].charCodeAt(0)*1)
}
if (usertype==-1||to.path == '/404') {
next();
} else {
router.push('/404');
}
} else { } else {
router.push('/404'); router.push('/404');
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!