forked from github/dataease
feat(X-Pack): 导航栏右侧部分按钮可配置显隐 #9483
This commit is contained in:
parent
00fc6cc287
commit
b9146cc28a
@ -25,6 +25,9 @@ interface LinkItem {
|
||||
method?: string
|
||||
}
|
||||
const linkList = ref([{ id: 5, label: t('common.about'), method: 'toAbout' }] as LinkItem[])
|
||||
if (!appearanceStore.getShowAbout) {
|
||||
linkList.value.splice(0, 1)
|
||||
}
|
||||
|
||||
const inPlatformClient = computed(() => !!wsCache.get('de-platform-client'))
|
||||
|
||||
@ -118,7 +121,7 @@ if (uid.value === '1') {
|
||||
<el-popover
|
||||
ref="popoverRef"
|
||||
:virtual-ref="buttonRef"
|
||||
trigger="hover"
|
||||
trigger="click"
|
||||
title=""
|
||||
virtual-triggering
|
||||
placement="bottom-start"
|
||||
|
@ -18,6 +18,7 @@ import AiComponent from '@/layout/components/AiComponent.vue'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { findBaseParams } from '@/api/aiComponent'
|
||||
import AiTips from '@/layout/components/AiTips.vue'
|
||||
|
||||
const appearanceStore = useAppearanceStoreWithOut()
|
||||
const { push } = useRouter()
|
||||
const route = useRoute()
|
||||
@ -39,6 +40,7 @@ const activeIndex = computed(() => {
|
||||
}
|
||||
return route.path
|
||||
})
|
||||
|
||||
const permissionStore = usePermissionStore()
|
||||
|
||||
const routers: any[] = formatRoute(permissionStore.getRoutersNotHidden as AppCustomRouteRecordRaw[])
|
||||
@ -109,16 +111,27 @@ onMounted(() => {
|
||||
</el-menu>
|
||||
<div class="operate-setting" v-if="!desktop">
|
||||
<XpackComponent jsname="c3dpdGNoZXI=" />
|
||||
<el-icon style="margin: 0 10px" class="ai-icon" v-if="aiBaseUrl && !showOverlay">
|
||||
<el-icon
|
||||
style="margin: 0 10px"
|
||||
class="ai-icon"
|
||||
v-if="aiBaseUrl && !showOverlay && appearanceStore.getShowAi"
|
||||
>
|
||||
<Icon name="dv-ai" @click="handleAiClick" />
|
||||
</el-icon>
|
||||
<ai-tips @confirm="aiTipsConfirm" v-if="showOverlay" class="ai-icon-tips"></ai-tips>
|
||||
<ai-tips
|
||||
@confirm="aiTipsConfirm"
|
||||
v-if="showOverlay && appearanceStore.getShowAi"
|
||||
class="ai-icon-tips"
|
||||
/>
|
||||
<ToolboxCfg v-if="showToolbox" />
|
||||
<TopDoc />
|
||||
<TopDoc v-if="appearanceStore.getShowDoc" />
|
||||
<SystemCfg v-if="showSystem" />
|
||||
<AccountOperator />
|
||||
<ai-component v-if="aiBaseUrl" :base-url="aiBaseUrl"></ai-component>
|
||||
<div v-if="showOverlay" class="overlay"></div>
|
||||
<ai-component
|
||||
v-if="aiBaseUrl && appearanceStore.getShowAi"
|
||||
:base-url="aiBaseUrl"
|
||||
></ai-component>
|
||||
<div v-if="showOverlay && appearanceStore.getShowAi" class="overlay"></div>
|
||||
</div>
|
||||
</el-header>
|
||||
</template>
|
||||
|
@ -2,8 +2,10 @@
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const appearanceStore = useAppearanceStoreWithOut()
|
||||
const navigateBg = computed(() => appearanceStore.getNavigateBg)
|
||||
const showDoc = computed(() => appearanceStore.getShowDoc)
|
||||
const { push, resolve } = useRouter()
|
||||
const redirectUser = () => {
|
||||
const sysMenu = resolve('/system')
|
||||
@ -14,7 +16,13 @@ const redirectUser = () => {
|
||||
|
||||
<template>
|
||||
<el-tooltip class="box-item" effect="dark" content="组织管理中心" placement="top">
|
||||
<div class="sys-setting" :class="{ 'is-light-setting': navigateBg && navigateBg === 'light' }">
|
||||
<div
|
||||
class="sys-setting"
|
||||
:class="{
|
||||
'is-light-setting': navigateBg && navigateBg === 'light',
|
||||
'in-iframe-setting': !showDoc
|
||||
}"
|
||||
>
|
||||
<el-icon @click="redirectUser">
|
||||
<Icon class="icon-setting" name="icon-setting" />
|
||||
</el-icon>
|
||||
@ -35,6 +43,9 @@ const redirectUser = () => {
|
||||
background-color: #1e2738;
|
||||
}
|
||||
}
|
||||
.in-iframe-setting {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
.is-light-setting {
|
||||
&:hover {
|
||||
background-color: var(--ed-menu-hover-bg-color) !important;
|
||||
|
@ -6,12 +6,16 @@ import colorFunctions from 'less/lib/less/functions/color.js'
|
||||
import colorTree from 'less/lib/less/tree/color.js'
|
||||
const basePath = import.meta.env.VITE_API_BASEPATH
|
||||
const baseUrl = basePath + '/appearance/image/'
|
||||
import { isBtnShow } from '@/utils/utils'
|
||||
interface AppearanceState {
|
||||
themeColor?: string
|
||||
customColor?: string
|
||||
navigateBg?: string
|
||||
navigate?: string
|
||||
help?: string
|
||||
showAi?: string
|
||||
showDoc?: string
|
||||
showAbout?: string
|
||||
bg?: string
|
||||
login?: string
|
||||
slogan?: string
|
||||
@ -33,6 +37,9 @@ export const useAppearanceStore = defineStore('appearanceStore', {
|
||||
navigateBg: '',
|
||||
navigate: '',
|
||||
help: '',
|
||||
showDoc: '0',
|
||||
showAi: '0',
|
||||
showAbout: '0',
|
||||
bg: '',
|
||||
login: '',
|
||||
slogan: '',
|
||||
@ -106,6 +113,15 @@ export const useAppearanceStore = defineStore('appearanceStore', {
|
||||
},
|
||||
getCommunity(): boolean {
|
||||
return this.community
|
||||
},
|
||||
getShowAi(): boolean {
|
||||
return isBtnShow(this.showAi)
|
||||
},
|
||||
getShowDoc(): boolean {
|
||||
return isBtnShow(this.showDoc)
|
||||
},
|
||||
getShowAbout(): boolean {
|
||||
return isBtnShow(this.showAbout)
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@ -160,6 +176,9 @@ export const useAppearanceStore = defineStore('appearanceStore', {
|
||||
}
|
||||
this.navigate = data.navigate
|
||||
this.help = data.help
|
||||
this.showAi = data.showAi
|
||||
this.showDoc = data.showDoc
|
||||
this.showAbout = data.showAbout
|
||||
this.navigateBg = data.navigateBg
|
||||
this.themeColor = data.themeColor
|
||||
this.customColor = data.customColor
|
||||
|
@ -106,7 +106,24 @@ export const cleanPlatformFlag = () => {
|
||||
wsCache.delete(platformKey)
|
||||
return false
|
||||
}
|
||||
export const isInIframe = () => {
|
||||
try {
|
||||
return window.top !== window.self
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
export const isBtnShow = (val: string) => {
|
||||
if (!val || val === '0') {
|
||||
return true
|
||||
} else if (val === '1') {
|
||||
return false
|
||||
} else {
|
||||
return !isInIframe()
|
||||
}
|
||||
}
|
||||
export function isMobile() {
|
||||
return (
|
||||
navigator.userAgent.match(
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit cb5bf055a1d173157fb1c291aba95710e47e6c10
|
||||
Subproject commit b8cde42ed5b9ff0bcc23f5138a944c086a236f5a
|
Loading…
Reference in New Issue
Block a user