diff --git a/index.html b/index.html index fafd3c1..bce0cbe 100644 --- a/index.html +++ b/index.html @@ -108,8 +108,6 @@ } })(); - - +
@@ -412,14 +432,35 @@ try { var cachedMascot = (localStorage.getItem('oms_brand_mascot_url') || '').trim(); var logoImg = boot.querySelector('.boot-logo'); - if ( + var logoText = boot.querySelector('.boot-text-logo'); + var isLegacyDefault = + !cachedMascot || + cachedMascot === '/app-mascot.png' || + cachedMascot.indexOf('/app-mascot.png?') === 0 || + cachedMascot.indexOf('app-mascot.png') >= 0 || + cachedMascot === '/empty-placeholder.svg' || + cachedMascot.indexOf('/empty-placeholder.svg') === 0; + if (isLegacyDefault) { + try { + localStorage.removeItem('oms_brand_mascot_url'); + } catch (eClear) {} + root.classList.remove('has-app-mascot'); + root.style.removeProperty('--app-mascot-bg'); + if (logoImg) { + logoImg.hidden = true; + logoImg.removeAttribute('src'); + } + if (logoText) logoText.removeAttribute('hidden'); + } else if ( logoImg && - cachedMascot && (/^https?:\/\//i.test(cachedMascot) || cachedMascot.charAt(0) === '/' || cachedMascot.indexOf('data:') === 0) ) { + logoImg.hidden = false; logoImg.src = cachedMascot; + if (logoText) logoText.setAttribute('hidden', ''); + root.classList.add('has-app-mascot'); root.style.setProperty( '--app-mascot-bg', 'url("' + cachedMascot.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '")', diff --git a/nginx-k3s.conf b/nginx-k3s.conf index 64837cf..a62addc 100644 --- a/nginx-k3s.conf +++ b/nginx-k3s.conf @@ -36,7 +36,7 @@ server { } location = /favicon.ico { - try_files /favicon.png /favicon.ico =404; + try_files /favicon.ico =404; expires 7d; add_header Cache-Control "public"; access_log off; diff --git a/public/app-mascot.png b/public/app-mascot.png deleted file mode 100644 index a5ba78c..0000000 Binary files a/public/app-mascot.png and /dev/null differ diff --git a/public/favicon.png b/public/favicon.png deleted file mode 100644 index 3f851af..0000000 Binary files a/public/favicon.png and /dev/null differ diff --git a/public/site/img/logo1.png b/public/site/img/logo1.png deleted file mode 100644 index 3f851af..0000000 Binary files a/public/site/img/logo1.png and /dev/null differ diff --git a/scripts/postbuild-cleanup-dist.js b/scripts/postbuild-cleanup-dist.js index d7ddf43..68f4e05 100644 --- a/scripts/postbuild-cleanup-dist.js +++ b/scripts/postbuild-cleanup-dist.js @@ -10,9 +10,3 @@ if (fs.existsSync(legacyLoginDir)) { fs.rmSync(legacyLoginDir, { recursive: true, force: true }); console.log('[postbuild] removed dist/login (conflicts with SPA route /login)'); } - -const faviconSrc = path.join(dist, 'site', 'img', 'logo1.png'); -if (fs.existsSync(faviconSrc)) { - fs.copyFileSync(faviconSrc, path.join(dist, 'favicon.png')); - console.log('[postbuild] copied favicon.png from site logo'); -} diff --git a/src/api/oms/common.ts b/src/api/oms/common.ts index 139cc52..16431ac 100644 --- a/src/api/oms/common.ts +++ b/src/api/oms/common.ts @@ -129,11 +129,26 @@ function toCosSameOriginProxyUrl(absoluteUrl: string): string | null { } } +/** + * 开发态 `/__cos__/` 必须留在 Vite 同源。 + * 已改写过的地址再进 resolve 时,不能再拼 VITE_API_ASSET_ORIGIN,否则变成 + * `https://api.../admin/__cos__/...`,空态背景图加载失败。 + */ +function restoreDevCosProxyPath(value: string): string | null { + if (!import.meta.env.DEV) return null + if (value.startsWith('/__cos__/')) return value + const embedded = value.match(/\/__cos__\/.+$/) + if (embedded && /^https?:\/\//i.test(value)) return embedded[0] + return null +} + /** 将 /uploads/... 相对路径转为可访问 URL(同源相对,或 VITE_API_ASSET_ORIGIN 绝对前缀) */ export function resolveOmsAssetUrl(path?: string | null): string { if (!path) return '' const value = path.trim() if (!value) return '' + const devCos = restoreDevCosProxyPath(value) + if (devCos) return devCos if (/^https?:\/\//i.test(value) || value.startsWith('data:') || value.startsWith('blob:')) { const cosProxied = toCosSameOriginProxyUrl(value) if (cosProxied) return cosProxied diff --git a/src/api/system/otherConfig.ts b/src/api/system/otherConfig.ts index dc39fc9..41b0c2e 100644 --- a/src/api/system/otherConfig.ts +++ b/src/api/system/otherConfig.ts @@ -76,6 +76,14 @@ export async function uploadPaymentReceiveQr(channel: PaymentReceiveQrChannel, f return unwrapData(res.data) } +/** 清除指定渠道充值收款码 */ +export async function clearPaymentReceiveQr(channel: PaymentReceiveQrChannel) { + const res = await axiosInstance.post( + omsUrl(`/system/other-config/payment-qr/clear?channel=${encodeURIComponent(channel)}`), + ) + return unwrapData(res.data) +} + export type BrandLogoChannel = 'portal' | 'site' | 'favicon' | 'mascot' export interface BrandLogoDto { @@ -102,6 +110,14 @@ export async function uploadBrandLogo(channel: BrandLogoChannel, file: File) { return unwrapData(res.data) } +/** 清除指定渠道品牌 Logo(前端回退文字 LOGO) */ +export async function clearBrandLogo(channel: BrandLogoChannel) { + const res = await axiosInstance.post( + omsUrl(`/system/other-config/brand-logo/clear?channel=${encodeURIComponent(channel)}`), + ) + return unwrapData(res.data) +} + /** 轨迹服务默认配置编码 */ export const TRACK_SERVICE_CONFIG_CODE = 'track_service' diff --git a/src/assets/500x500.png b/src/assets/500x500.png deleted file mode 100644 index b3d579a..0000000 Binary files a/src/assets/500x500.png and /dev/null differ diff --git a/src/assets/images/app-mascot.png b/src/assets/images/app-mascot.png deleted file mode 100644 index a5ba78c..0000000 Binary files a/src/assets/images/app-mascot.png and /dev/null differ diff --git a/src/assets/style/global.less b/src/assets/style/global.less index bc71e9e..368e168 100644 --- a/src/assets/style/global.less +++ b/src/assets/style/global.less @@ -39,22 +39,26 @@ body { -moz-osx-font-smoothing: grayscale; } -/* 全局空态:用吉祥物替换 Arco Empty 默认图标 */ +/* 全局空态:未配置吉祥物时不占位;有配置才显示图片 */ .arco-empty-image { .arco-icon { display: none !important; } +} - &::after { - content: ''; - display: block; - width: 36px; - height: 36px; - margin: 0 auto; - 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; - } +html:not(.has-app-mascot) .arco-empty-image { + display: none; +} + +html.has-app-mascot .arco-empty-image::after { + content: ''; + display: block; + width: 36px; + height: 36px; + margin: 0 auto; + background: var(--app-mascot-bg) center / contain no-repeat; + filter: grayscale(1) brightness(1.08) contrast(0.92); + opacity: 0.78; } .arco-empty-image img { diff --git a/src/components/AppMascotState/index.vue b/src/components/AppMascotState/index.vue index 3c0a38c..7e8b5d0 100644 --- a/src/components/AppMascotState/index.vue +++ b/src/components/AppMascotState/index.vue @@ -1,6 +1,11 @@ @@ -983,6 +990,7 @@ filter: grayscale(1) brightness(1.08) contrast(0.92); opacity: 0.78; } + } .empty-text { diff --git a/src/components/agent-side-rail/index.vue b/src/components/agent-side-rail/index.vue index 1a8fe14..7b70f98 100644 --- a/src/components/agent-side-rail/index.vue +++ b/src/components/agent-side-rail/index.vue @@ -20,8 +20,15 @@ :title="t('brand.fullName')" @click.prevent="goOfficialSite" > - - {{ t('brand.name') }} + +
@@ -110,7 +117,7 @@ import { CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH, CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH, } from '@/utils/customer-portal-nav' -import navLogo from '@/assets/logo2.png' +import { BRAND_TEXT_LOGO, loadBrandLogoUrls } from '@/utils/brandLogo' const AGENT_SIDE_RAIL_COLLAPSED_WIDTH = CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH const AGENT_SIDE_RAIL_EXPANDED_WIDTH = CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH @@ -126,6 +133,10 @@ type AgentNavItem = { const { t } = useI18n() const route = useRoute() const router = useRouter() +const navLogoSrc = ref('') +void loadBrandLogoUrls().then((urls) => { + navLogoSrc.value = urls.portal || '' +}) const collapsed = ref(readCollapsed()) const compactLayout = ref(collapsed.value) @@ -342,6 +353,15 @@ onUnmounted(() => { white-space: nowrap; } + &__brand-mark { + font-size: 15px; + font-weight: 700; + letter-spacing: 0.12em; + line-height: 1; + color: var(--color-text-3, #86909c); + user-select: none; + } + &__scroll { flex: 1; min-height: 0; diff --git a/src/components/customer-side-rail/index.vue b/src/components/customer-side-rail/index.vue index 2e425c2..5db3129 100644 --- a/src/components/customer-side-rail/index.vue +++ b/src/components/customer-side-rail/index.vue @@ -21,8 +21,15 @@ :title="t('brand.fullName')" @click.prevent="goOfficialSite" > - - {{ t('brand.name') }} + +
@@ -199,7 +206,7 @@ import { useHiprintClientState, } from '@/utils/hiprint/hiprintClientState' import { PRINT_CONTROL_DOWNLOAD_URL } from '@/constants/printControl' -import navLogo from '@/assets/logo2.png' +import { BRAND_TEXT_LOGO, loadBrandLogoUrls } from '@/utils/brandLogo' import { resolveCurrentCustomer } from '@/api/customer/resolve' import { CUSTOMER_BALANCE_CHANGED_EVENT } from '@/api/customer/accountFlow' import { getMapIdFromAccessToken } from '@/utils/jwt' @@ -235,6 +242,11 @@ const printConnectionState = useHiprintClientState() /** 与 CSS transition 时长一致(Linear 风格约 300ms) */ const RAIL_ANIM_MS = 300 +const navLogoSrc = ref('') +void loadBrandLogoUrls().then((urls) => { + navLogoSrc.value = urls.portal || '' +}) + const collapsed = ref(readCustomerSideRailCollapsed(false)) /** 布局紧凑态:动画结束后再切,避免收起中途图标跳动 */ const compactLayout = ref(collapsed.value) @@ -684,6 +696,15 @@ onUnmounted(() => { white-space: nowrap; } + &__brand-mark { + font-size: 15px; + font-weight: 700; + letter-spacing: 0.12em; + line-height: 1; + color: var(--color-text-3, #86909c); + user-select: none; + } + &__scroll { flex: 1; min-height: 0; diff --git a/src/components/top-nav/index.vue b/src/components/top-nav/index.vue index e70d868..d018aa1 100644 --- a/src/components/top-nav/index.vue +++ b/src/components/top-nav/index.vue @@ -2,7 +2,13 @@
-