|
|
@ -62,10 +62,23 @@ router.beforeEach(async (to, from, next) => { |
|
|
|
if (whiteList.indexOf(to.path) !== -1) { |
|
|
|
if (whiteList.indexOf(to.path) !== -1) { |
|
|
|
next() |
|
|
|
next() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const tenantId = getTenantId() |
|
|
|
const tenantId = getTenantId() || to.query?.tenantId |
|
|
|
const appId = getAppId() |
|
|
|
const appId = getAppId() || to.query?.appId |
|
|
|
if (tenantId && appId) { |
|
|
|
if (tenantId && appId) { |
|
|
|
next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
|
|
|
let redirectPath = to.fullPath |
|
|
|
|
|
|
|
const p = to.fullPath.split('?') |
|
|
|
|
|
|
|
if (p.length > 1) { |
|
|
|
|
|
|
|
// 过滤掉query参数中的tenantId和appId
|
|
|
|
|
|
|
|
redirectPath = |
|
|
|
|
|
|
|
p[0] + |
|
|
|
|
|
|
|
'?' + |
|
|
|
|
|
|
|
p[1] |
|
|
|
|
|
|
|
.split('&') |
|
|
|
|
|
|
|
.filter((item) => !item.startsWith('tenantId=') && !item.startsWith('appId=')) |
|
|
|
|
|
|
|
.join('&') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${redirectPath}`) // 否则全部重定向到登录页
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// next(`/login?redirect=${to.fullPath}`)
|
|
|
|
// next(`/login?redirect=${to.fullPath}`)
|
|
|
|
// 否则全部重定向到平台登陆页
|
|
|
|
// 否则全部重定向到平台登陆页
|
|
|
|