perf(X-Pack): 客户端免登录禁用登出和改密

This commit is contained in:
fit2cloud-chenyw 2024-04-11 16:04:49 +08:00
parent 6f7ac6ee7e
commit 44819280ce
5 changed files with 23 additions and 5 deletions

View File

@ -26,6 +26,8 @@ interface LinkItem {
} }
const linkList = ref([{ id: 5, label: t('common.about'), method: 'toAbout' }] as LinkItem[]) const linkList = ref([{ id: 5, label: t('common.about'), method: 'toAbout' }] as LinkItem[])
const inPlatformClient = computed(() => !!wsCache.get('de-platform-client'))
const logout = async () => { const logout = async () => {
await logoutApi() await logoutApi()
logoutHandler() logoutHandler()
@ -43,6 +45,14 @@ const xpackLinkLoaded = items => {
} }
} }
items.forEach(item => linkList.value.push(item)) items.forEach(item => linkList.value.push(item))
if (inPlatformClient.value) {
len = linkList.value.length
while (len--) {
if (linkList.value[len]?.id === 2) {
linkList.value.splice(len, 1)
}
}
}
linkList.value.sort(compare('id')) linkList.value.sort(compare('id'))
} }
@ -153,7 +163,7 @@ if (uid.value === '1') {
</div> </div>
</div> </div>
<el-divider /> <el-divider />
<div class="uinfo-footer"> <div class="uinfo-footer" v-if="!inPlatformClient">
<div class="uinfo-main-item de-container" @click="logout"> <div class="uinfo-main-item de-container" @click="logout">
<span>{{ t('common.exit_system') }}</span> <span>{{ t('common.exit_system') }}</span>
</div> </div>

View File

@ -39,7 +39,7 @@ export const logoutHandler = (justClean?: boolean) => {
const removeCache = () => { const removeCache = () => {
const keys = Object.keys(wsCache['storage']) const keys = Object.keys(wsCache['storage'])
keys.forEach(key => { keys.forEach(key => {
if (key.startsWith('de-plugin-')) { if (key.startsWith('de-plugin-') || key === 'de-platform-client') {
wsCache.delete(key) wsCache.delete(key)
} }
}) })

View File

@ -83,6 +83,10 @@ export const isLarkPlatform = () => {
return !!getQueryString('state') && !!getQueryString('code') return !!getQueryString('state') && !!getQueryString('code')
} }
export const isPlatformClient = () => {
return !!getQueryString('client') || getQueryString('state')?.includes('client')
}
export function isMobile() { export function isMobile() {
return navigator.userAgent.match( return navigator.userAgent.match(
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i

View File

@ -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 } from '@/utils/utils' import { isLarkPlatform, isPlatformClient } from '@/utils/utils'
import xss from 'xss' import xss from 'xss'
const { wsCache } = useCache() const { wsCache } = useCache()
const appStore = useAppStoreWithOut() const appStore = useAppStoreWithOut()
@ -137,7 +137,11 @@ const showLoginImage = computed<boolean>(() => {
const checkPlatform = () => { const checkPlatform = () => {
const flagArray = ['/casbi', 'oidcbi'] const flagArray = ['/casbi', 'oidcbi']
const pathname = window.location.pathname const pathname = window.location.pathname
if (!flagArray.some(flag => pathname.includes(flag)) && !isLarkPlatform()) { if (
!flagArray.some(flag => pathname.includes(flag)) &&
!isLarkPlatform() &&
!isPlatformClient()
) {
cleanPlatformFlag() cleanPlatformFlag()
} }
} }

@ -1 +1 @@
Subproject commit 4394504d95c59ae8a44883a771d77ad0cdc187a8 Subproject commit 553dad60ba69dd3be3551919d00ab1124d070ce4