diff --git a/index.html b/index.html index 0748eba..fafd3c1 100644 --- a/index.html +++ b/index.html @@ -408,6 +408,25 @@ if (sub) sub.textContent = copy.sub; if (retry) retry.textContent = copy.retry; + /* 冷启动优先用缓存吉祥物,避免等 Vue/API(与 brandLogo.ts MASCOT_CACHE_KEY 一致) */ + try { + var cachedMascot = (localStorage.getItem('oms_brand_mascot_url') || '').trim(); + var logoImg = boot.querySelector('.boot-logo'); + if ( + logoImg && + cachedMascot && + (/^https?:\/\//i.test(cachedMascot) || + cachedMascot.charAt(0) === '/' || + cachedMascot.indexOf('data:') === 0) + ) { + logoImg.src = cachedMascot; + root.style.setProperty( + '--app-mascot-bg', + 'url("' + cachedMascot.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '")', + ); + } + } catch (eMascot) {} + window.__dismissAppBoot = function () { if (!boot || boot.classList.contains('is-leaving')) return; boot.classList.add('is-leaving'); diff --git a/src/api/system/otherConfig.ts b/src/api/system/otherConfig.ts index 5081745..dc39fc9 100644 --- a/src/api/system/otherConfig.ts +++ b/src/api/system/otherConfig.ts @@ -76,14 +76,16 @@ export async function uploadPaymentReceiveQr(channel: PaymentReceiveQrChannel, f return unwrapData(res.data) } -export type BrandLogoChannel = 'portal' | 'site' +export type BrandLogoChannel = 'portal' | 'site' | 'favicon' | 'mascot' export interface BrandLogoDto { portalUrl?: string siteUrl?: string + faviconUrl?: string + mascotUrl?: string } -/** 获取品牌 Logo(系统顶栏 / 官网)可访问地址 */ +/** 获取品牌 Logo(系统顶栏 / 官网 / 标签 / 吉祥物)可访问地址 */ export async function getBrandLogo() { const res = await axiosInstance.get(omsUrl('/system/other-config/brand-logo')) return unwrapData(res.data) diff --git a/src/assets/style/global.less b/src/assets/style/global.less index 947803c..bc71e9e 100644 --- a/src/assets/style/global.less +++ b/src/assets/style/global.less @@ -51,7 +51,7 @@ body { width: 36px; height: 36px; margin: 0 auto; - background: url('/app-mascot.png') center / contain no-repeat; + background: var(--app-mascot-bg, url('/app-mascot.png')) center / contain no-repeat; filter: grayscale(1) brightness(1.08) contrast(0.92); opacity: 0.78; } diff --git a/src/components/AppMascotState/index.vue b/src/components/AppMascotState/index.vue index 7ee579d..3c0a38c 100644 --- a/src/components/AppMascotState/index.vue +++ b/src/components/AppMascotState/index.vue @@ -3,7 +3,7 @@