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
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 class="h-full flex-y-center justify-end">
<TenantSelect v-if="!appStore.isMobile" v-model:value="tenantId" class="mr-12px w-150px" />
<GlobalSearch />
<GlobalSearch v-if="themeStore.header.globalSearch.visible" />
<MessageButton />
<FullScreen v-if="!appStore.isMobile" :full="isFullscreen" @click="toggle" />
<LangSwitch

View File

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

View File

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

View File

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

View File

@ -25,8 +25,8 @@ export function setupAppVersionNotification() {
const buildTime = await getHtmlBuildTime();
// If build time hasn't changed, no update is needed
if (buildTime === BUILD_TIME) {
// If failed to get build time or build time hasn't changed, no update is needed.
if (!buildTime || buildTime === BUILD_TIME) {
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 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 buildTime = match?.[1] || '';
return buildTime;
const html = await res.text();
const match = html.match(/<meta name="buildTime" content="(.*)">/);
return match?.[1] || null;
} catch (error) {
console.error('getHtmlBuildTime error:', error);
return null;
}
}

View File

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

View File

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