|
@@ -57,10 +57,24 @@ router.beforeEach(async (to, from, next) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(loginType == 'backurl'){
|
|
if(loginType == 'backurl'){
|
|
- //如果是backurl
|
|
|
|
- const backurl = getBackUrlValue(window.location.href)
|
|
|
|
- //带着token返回原网站
|
|
|
|
- window.location.href = backurl + '?backurl=' + backurl + '&admintoken=' + getToken()
|
|
|
|
|
|
+ //此时分为两种情况,如果这个用户的token被放入了黑名单,此时不能允许用户带着token返回原网站
|
|
|
|
+ //否则他就会一直登录不了,这个时候应该让他重新登录
|
|
|
|
+ if(userInfo.code == 400){
|
|
|
|
+ //跳转到登录页面
|
|
|
|
+ if (to.path !== '/no-permission') {
|
|
|
|
+ //避免重复跳转
|
|
|
|
+ next({path:'/no-permission'})
|
|
|
|
+ } else {
|
|
|
|
+ //已经在无权限页面,不再跳转
|
|
|
|
+ next()
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ //如果不是400,说明用户的这个token是可以用的,可以带着token返回C端
|
|
|
|
+ //如果是backurl
|
|
|
|
+ const backurl = getBackUrlValue(window.location.href)
|
|
|
|
+ //带着token返回原网站
|
|
|
|
+ window.location.href = backurl + '?backurl=' + backurl + '&admintoken=' + getToken()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//3.4.2 如果有token,但是没在登录页面
|
|
//3.4.2 如果有token,但是没在登录页面
|
|
@@ -69,7 +83,7 @@ router.beforeEach(async (to, from, next) => {
|
|
if (hasRoles) {
|
|
if (hasRoles) {
|
|
const userInfo = await getInfo();
|
|
const userInfo = await getInfo();
|
|
//如果用户没有权限登录该网站,返回登录页面
|
|
//如果用户没有权限登录该网站,返回登录页面
|
|
- if(userInfo.code == -1){
|
|
|
|
|
|
+ if(userInfo.code == 400){
|
|
console.log("用户没有访问权限,将跳转到无权限页面!")
|
|
console.log("用户没有访问权限,将跳转到无权限页面!")
|
|
if (to.path !== '/no-permission') {
|
|
if (to.path !== '/no-permission') {
|
|
//避免重复跳转
|
|
//避免重复跳转
|