fix: 客户端缓存导致界面设置 Logo 不能正常显示 (#7048)

Refs #7020
This commit is contained in:
2024-11-14 16:18:02 +08:00 committed by GitHub
parent bfa667584a
commit 7aad2cf4af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 6 deletions

View File

@ -15,6 +15,6 @@ export const useLogo = async () => {
const link = (document.querySelector("link[rel*='icon']") || document.createElement('link')) as HTMLLinkElement;
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = globalStore.themeConfig.favicon ? '/api/v1/images/favicon' : '/public/favicon.png';
link.href = globalStore.themeConfig.favicon ? `/api/v1/images/favicon?t=${Date.now()}` : '/public/favicon.png';
document.getElementsByTagName('head')[0].appendChild(link);
};

View File

@ -1,13 +1,18 @@
<template>
<div class="logo" style="cursor: pointer" @click="goHome">
<template v-if="isCollapse">
<img v-if="globalStore.themeConfig.logo" :src="'/api/v1/images/logo'" style="cursor: pointer" alt="logo" />
<img
v-if="globalStore.themeConfig.logo"
:src="`/api/v1/images/logo?t=${Date.now()}`"
style="cursor: pointer"
alt="logo"
/>
<MenuLogo v-else />
</template>
<template v-else>
<img
v-if="globalStore.themeConfig.logoWithText"
:src="'/api/v1/images/logoWithText'"
:src="`/api/v1/images/logoWithText?t=${Date.now()}`"
style="cursor: pointer"
alt="logo"
/>

View File

@ -32,9 +32,9 @@ export function initFavicon() {
</svg>
`;
goldLink = `data:image/svg+xml,${encodeURIComponent(svg)}`;
link.href = favicon ? '/api/v1/images/favicon' : goldLink;
link.href = favicon ? `/api/v1/images/favicon?t=${Date.now()}` : goldLink;
} else {
link.href = favicon ? '/api/v1/images/favicon' : '/public/favicon.png';
link.href = favicon ? `/api/v1/images/favicon?t=${Date.now()}` : '/public/favicon.png';
}
document.head.appendChild(link);
}

View File

@ -4,7 +4,11 @@
<template #main>
<div style="text-align: center; margin-top: 20px">
<div style="justify-self: center" class="logo">
<img v-if="globalStore.themeConfig.logo" style="width: 80px" :src="'/api/v1/images/logo'" />
<img
v-if="globalStore.themeConfig.logo"
style="width: 80px"
:src="`/api/v1/images/logo?t=${Date.now()}`"
/>
<PrimaryLogo v-else />
</div>
<h3 class="description">{{ globalStore.themeConfig.title || $t('setting.description') }}</h3>