This commit is contained in:
lcw
2025-10-09 21:33:58 +08:00
parent 93c711dca6
commit 5e18952b55
69 changed files with 421 additions and 152 deletions

View File

@ -1,15 +1,16 @@
import router from './router'
import Base64 from "base-64";
import store from './store'
import {
unifiedLogin
} from "@/api/user-manage";
import {
setItem,
getItem,
removeAllItem
} from "@/utils/storage";
import {
getCookie
} from "@/utils/cookie";
// 白名单
const whiteList = ['/login', '/oatuh_login', '/404', '/401', '/focusExploration', '/clueVerification', '/deploymentApproval']
const whiteList = ['/login', '/oatuh_login', '/404', '/401', '/zeroTrust_login', '/focusExploration', '/clueVerification', '/deploymentApproval']
/**
* 路由前置守卫
* to 去哪里
@ -43,16 +44,22 @@ router.beforeEach(async (to, from, next) => {
}
// 利用 addRoute 循环添加
} else {
const isOatuh = getItem('isOatuh')
// 没有token的情况下可以进入白名单
if (whiteList.indexOf(to.path) > -1) {
next()
} else {
if (isOatuh) {
const idEntityCard = getItem('idEntityCard')
next(`/oatuh_login?token=${Base64.encode(idEntityCard)}`)
const cookie = getCookie("clientKey");
if (cookie) {
next(`/zeroTrust_login`)
} else {
next('/login')
const isOatuh = getItem('isOatuh')
// 没有token的情况下可以进入白名单
if (isOatuh) {
const idEntityCard = getItem('idEntityCard')
next(`/oatuh_login?token=${Base64.encode(idEntityCard)}`)
} else {
next('/login')
}
}
}
}