diff --git a/core/core-frontend/src/permission.ts b/core/core-frontend/src/permission.ts index 6481aa0d65..bee8270353 100644 --- a/core/core-frontend/src/permission.ts +++ b/core/core-frontend/src/permission.ts @@ -7,7 +7,7 @@ import { usePermissionStoreWithOut, pathValid, getFirstAuthMenu } from '@/store/ import { usePageLoading } from '@/hooks/web/usePageLoading' import { getRoleRouters } from '@/api/common' import { useCache } from '@/hooks/web/useCache' -import { isMobile } from '@/utils/utils' +import { isMobile, checkPlatform } from '@/utils/utils' import { interactiveStoreWithOut } from '@/store/modules/interactive' import { useAppearanceStoreWithOut } from '@/store/modules/appearance' import { useEmbedded } from '@/store/modules/embedded' @@ -28,6 +28,7 @@ const embeddedRouteWhiteList = ['/dataset-embedded', '/dataset-form', '/dataset- router.beforeEach(async (to, from, next) => { start() loadStart() + checkPlatform() if (isMobile()) { done() loadDone() diff --git a/core/core-frontend/src/utils/logout.ts b/core/core-frontend/src/utils/logout.ts index a408f36de4..ddce738b2a 100644 --- a/core/core-frontend/src/utils/logout.ts +++ b/core/core-frontend/src/utils/logout.ts @@ -27,7 +27,6 @@ export const logoutHandler = (justClean?: boolean) => { return } if (wsCache.get('out_auth_platform') === 'oidc') { - localStorage.removeItem('out_auth_platform') window.location.href = '/oidcbi/oidc/logout' return } diff --git a/core/core-frontend/src/utils/utils.ts b/core/core-frontend/src/utils/utils.ts index 644b101501..75630a07f8 100644 --- a/core/core-frontend/src/utils/utils.ts +++ b/core/core-frontend/src/utils/utils.ts @@ -1,5 +1,7 @@ import { BusiTreeNode } from '@/models/tree/TreeNode' +import { useCache } from '@/hooks/web/useCache' +const { wsCache } = useCache() export function deepCopy(target) { if (target === null || target === undefined) { return target @@ -87,6 +89,24 @@ export const isPlatformClient = () => { return !!getQueryString('client') || getQueryString('state')?.includes('client') } +export const checkPlatform = () => { + const flagArray = ['/casbi', 'oidcbi'] + const pathname = window.location.pathname + if ( + !flagArray.some(flag => pathname.includes(flag)) && + !isLarkPlatform() && + !isPlatformClient() + ) { + return cleanPlatformFlag() + } + return true +} +export const cleanPlatformFlag = () => { + const platformKey = 'out_auth_platform' + wsCache.delete(platformKey) + return false +} + export function isMobile() { return ( navigator.userAgent.match( diff --git a/core/core-frontend/src/views/login/index.vue b/core/core-frontend/src/views/login/index.vue index f6a4623a65..1d3303c4e6 100644 --- a/core/core-frontend/src/views/login/index.vue +++ b/core/core-frontend/src/views/login/index.vue @@ -16,7 +16,7 @@ import { XpackComponent } from '@/components/plugin' import { logoutHandler } from '@/utils/logout' import DeImage from '@/assets/login-desc-de.png' import elementResizeDetectorMaker from 'element-resize-detector' -import { isLarkPlatform, isPlatformClient } from '@/utils/utils' +import { checkPlatform, cleanPlatformFlag } from '@/utils/utils' import xss from 'xss' const { wsCache } = useCache() const appStore = useAppStoreWithOut() @@ -134,23 +134,6 @@ const showLoginImage = computed(() => { return !(loginContainerWidth.value < 889) }) -const checkPlatform = () => { - const flagArray = ['/casbi', 'oidcbi'] - const pathname = window.location.pathname - if ( - !flagArray.some(flag => pathname.includes(flag)) && - !isLarkPlatform() && - !isPlatformClient() - ) { - cleanPlatformFlag() - } -} -const cleanPlatformFlag = () => { - const platformKey = 'out_auth_platform' - wsCache.delete(platformKey) - preheat.value = false -} - const preheat = ref(true) const showLoginErrorMsg = () => { if (!loginErrorMsg.value) { @@ -219,7 +202,9 @@ const loadArrearance = () => { } onMounted(() => { loadArrearance() - checkPlatform() + if (!checkPlatform()) { + preheat.value = false + } if (localStorage.getItem('DE-GATEWAY-FLAG')) { const msg = localStorage.getItem('DE-GATEWAY-FLAG') loginErrorMsg.value = decodeURIComponent(msg)