Commit 526d1e8c by 李乾广

修改bug

1 parent 7b864f34
...@@ -123,10 +123,22 @@ const router = createRouter( ...@@ -123,10 +123,22 @@ 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
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(); next();
} else { } else {
router.push('/404'); router.push('/404');
} }
} else {
router.push('/404');
}
}); });
export default router export default router
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!