forked from github/dataease
Merge pull request #9476 from dataease/pr@dev-v2@fix_platform_login
fix: oidc登录之后关闭页面再次访问de报错
This commit is contained in:
commit
eae47f6e3a
@ -7,7 +7,7 @@ import { usePermissionStoreWithOut, pathValid, getFirstAuthMenu } from '@/store/
|
|||||||
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
||||||
import { getRoleRouters } from '@/api/common'
|
import { getRoleRouters } from '@/api/common'
|
||||||
import { useCache } from '@/hooks/web/useCache'
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
import { isMobile } from '@/utils/utils'
|
import { isMobile, checkPlatform } from '@/utils/utils'
|
||||||
import { interactiveStoreWithOut } from '@/store/modules/interactive'
|
import { interactiveStoreWithOut } from '@/store/modules/interactive'
|
||||||
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
|
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
|
||||||
import { useEmbedded } from '@/store/modules/embedded'
|
import { useEmbedded } from '@/store/modules/embedded'
|
||||||
@ -28,6 +28,7 @@ const embeddedRouteWhiteList = ['/dataset-embedded', '/dataset-form', '/dataset-
|
|||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
start()
|
start()
|
||||||
loadStart()
|
loadStart()
|
||||||
|
checkPlatform()
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
done()
|
done()
|
||||||
loadDone()
|
loadDone()
|
||||||
|
@ -27,7 +27,6 @@ export const logoutHandler = (justClean?: boolean) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (wsCache.get('out_auth_platform') === 'oidc') {
|
if (wsCache.get('out_auth_platform') === 'oidc') {
|
||||||
localStorage.removeItem('out_auth_platform')
|
|
||||||
window.location.href = '/oidcbi/oidc/logout'
|
window.location.href = '/oidcbi/oidc/logout'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { BusiTreeNode } from '@/models/tree/TreeNode'
|
import { BusiTreeNode } from '@/models/tree/TreeNode'
|
||||||
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
|
|
||||||
|
const { wsCache } = useCache()
|
||||||
export function deepCopy(target) {
|
export function deepCopy(target) {
|
||||||
if (target === null || target === undefined) {
|
if (target === null || target === undefined) {
|
||||||
return target
|
return target
|
||||||
@ -87,6 +89,24 @@ export const isPlatformClient = () => {
|
|||||||
return !!getQueryString('client') || getQueryString('state')?.includes('client')
|
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() {
|
export function isMobile() {
|
||||||
return (
|
return (
|
||||||
navigator.userAgent.match(
|
navigator.userAgent.match(
|
||||||
|
@ -16,7 +16,7 @@ import { XpackComponent } from '@/components/plugin'
|
|||||||
import { logoutHandler } from '@/utils/logout'
|
import { logoutHandler } from '@/utils/logout'
|
||||||
import DeImage from '@/assets/login-desc-de.png'
|
import DeImage from '@/assets/login-desc-de.png'
|
||||||
import elementResizeDetectorMaker from 'element-resize-detector'
|
import elementResizeDetectorMaker from 'element-resize-detector'
|
||||||
import { isLarkPlatform, isPlatformClient } from '@/utils/utils'
|
import { checkPlatform, cleanPlatformFlag } from '@/utils/utils'
|
||||||
import xss from 'xss'
|
import xss from 'xss'
|
||||||
const { wsCache } = useCache()
|
const { wsCache } = useCache()
|
||||||
const appStore = useAppStoreWithOut()
|
const appStore = useAppStoreWithOut()
|
||||||
@ -134,23 +134,6 @@ const showLoginImage = computed<boolean>(() => {
|
|||||||
return !(loginContainerWidth.value < 889)
|
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 preheat = ref(true)
|
||||||
const showLoginErrorMsg = () => {
|
const showLoginErrorMsg = () => {
|
||||||
if (!loginErrorMsg.value) {
|
if (!loginErrorMsg.value) {
|
||||||
@ -219,7 +202,9 @@ const loadArrearance = () => {
|
|||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadArrearance()
|
loadArrearance()
|
||||||
checkPlatform()
|
if (!checkPlatform()) {
|
||||||
|
preheat.value = false
|
||||||
|
}
|
||||||
if (localStorage.getItem('DE-GATEWAY-FLAG')) {
|
if (localStorage.getItem('DE-GATEWAY-FLAG')) {
|
||||||
const msg = localStorage.getItem('DE-GATEWAY-FLAG')
|
const msg = localStorage.getItem('DE-GATEWAY-FLAG')
|
||||||
loginErrorMsg.value = decodeURIComponent(msg)
|
loginErrorMsg.value = decodeURIComponent(msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user