Merge remote-tracking branch 'soybean/main' into dev

# Conflicts:
#	src/layouts/modules/global-header/index.vue
This commit is contained in:
xlsea 2025-06-05 21:48:46 +08:00
commit 538a04b894
7 changed files with 36 additions and 11 deletions

View File

@ -45,7 +45,7 @@ const tenantId = ref<CommonType.IdType>(authStore.userInfo?.user?.tenantId || '0
</div> </div>
<div class="h-full flex-y-center justify-end"> <div class="h-full flex-y-center justify-end">
<TenantSelect v-if="!appStore.isMobile" v-model:value="tenantId" class="mr-12px w-150px" /> <TenantSelect v-if="!appStore.isMobile" v-model:value="tenantId" class="mr-12px w-150px" />
<GlobalSearch /> <GlobalSearch v-if="themeStore.header.globalSearch.visible" />
<MessageButton /> <MessageButton />
<FullScreen v-if="!appStore.isMobile" :full="isFullscreen" @click="toggle" /> <FullScreen v-if="!appStore.isMobile" :full="isFullscreen" @click="toggle" />
<LangSwitch <LangSwitch

View File

@ -130,6 +130,9 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
<SettingItem key="9" :label="$t('theme.header.multilingual.visible')"> <SettingItem key="9" :label="$t('theme.header.multilingual.visible')">
<NSwitch v-model:value="themeStore.header.multilingual.visible" /> <NSwitch v-model:value="themeStore.header.multilingual.visible" />
</SettingItem> </SettingItem>
<SettingItem key="10" :label="$t('theme.header.globalSearch.visible')">
<NSwitch v-model:value="themeStore.header.globalSearch.visible" />
</SettingItem>
</TransitionGroup> </TransitionGroup>
</template> </template>

View File

@ -135,6 +135,9 @@ const local: App.I18n.Schema = {
}, },
multilingual: { multilingual: {
visible: 'Display multilingual button' visible: 'Display multilingual button'
},
globalSearch: {
visible: 'Display GlobalSearch button'
} }
}, },
tab: { tab: {

View File

@ -135,6 +135,9 @@ const local: App.I18n.Schema = {
}, },
multilingual: { multilingual: {
visible: '显示多语言按钮' visible: '显示多语言按钮'
},
globalSearch: {
visible: '显示全局搜索按钮'
} }
}, },
tab: { tab: {

View File

@ -25,8 +25,8 @@ export function setupAppVersionNotification() {
const buildTime = await getHtmlBuildTime(); const buildTime = await getHtmlBuildTime();
// If build time hasn't changed, no update is needed // If failed to get build time or build time hasn't changed, no update is needed.
if (buildTime === BUILD_TIME) { if (!buildTime || buildTime === BUILD_TIME) {
return; return;
} }
@ -88,16 +88,22 @@ export function setupAppVersionNotification() {
} }
} }
async function getHtmlBuildTime() { async function getHtmlBuildTime(): Promise<string | null> {
const baseUrl = import.meta.env.VITE_BASE_URL || '/'; const baseUrl = import.meta.env.VITE_BASE_URL || '/';
const res = await fetch(`${baseUrl}index.html?time=${Date.now()}`); try {
const res = await fetch(`${baseUrl}index.html?time=${Date.now()}`);
const html = await res.text(); if (!res.ok) {
console.error('getHtmlBuildTime error:', res.status, res.statusText);
return null;
}
const match = html.match(/<meta name="buildTime" content="(.*)">/); const html = await res.text();
const match = html.match(/<meta name="buildTime" content="(.*)">/);
const buildTime = match?.[1] || ''; return match?.[1] || null;
} catch (error) {
return buildTime; console.error('getHtmlBuildTime error:', error);
return null;
}
} }

View File

@ -30,6 +30,9 @@ export const themeSettings: App.Theme.ThemeSetting = {
}, },
multilingual: { multilingual: {
visible: true visible: true
},
globalSearch: {
visible: true
} }
}, },
tab: { tab: {

View File

@ -58,6 +58,10 @@ declare namespace App {
/** Whether to show the multilingual */ /** Whether to show the multilingual */
visible: boolean; visible: boolean;
}; };
globalSearch: {
/** Whether to show the GlobalSearch */
visible: boolean;
};
}; };
/** Tab */ /** Tab */
tab: { tab: {
@ -415,6 +419,9 @@ declare namespace App {
multilingual: { multilingual: {
visible: string; visible: string;
}; };
globalSearch: {
visible: string;
};
}; };
tab: { tab: {
visible: string; visible: string;