Commit 053e4122 by 李乾广

修改bug

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