Merge pull request '2026111902' (#28) from test into master
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m17s

Reviewed-on: https://git.ideship.com/ideship/front/pulls/28
This commit is contained in:
zzh 2026-11-19 19:57:43 +08:00
commit c0bc9628cf
31 changed files with 873 additions and 285 deletions

View File

@ -108,8 +108,6 @@
} }
})(); })();
</script> </script>
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="preload" href="/app-mascot.png" as="image" />
<meta <meta
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
@ -196,8 +194,11 @@
flex-shrink: 0; flex-shrink: 0;
} }
#app-boot .boot-logo-wrap { #app-boot .boot-logo-wrap {
width: 96px; min-width: 96px;
height: 96px; min-height: 72px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0; border-radius: 0;
background: transparent; background: transparent;
box-shadow: none; box-shadow: none;
@ -212,6 +213,22 @@
object-fit: contain; object-fit: contain;
animation: app-boot-bounce 1.4s ease-in-out infinite; animation: app-boot-bounce 1.4s ease-in-out infinite;
} }
#app-boot .boot-logo[hidden] {
display: none !important;
}
#app-boot .boot-text-logo {
display: block;
font-size: 36px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1;
color: #86909c;
animation: app-boot-bounce 1.4s ease-in-out infinite;
user-select: none;
}
#app-boot .boot-text-logo[hidden] {
display: none !important;
}
#app-boot .boot-status { #app-boot .boot-status {
margin-top: 12px; margin-top: 12px;
width: 100%; width: 100%;
@ -252,7 +269,8 @@
border-color: var(--app-primary-color, #054f74); border-color: var(--app-primary-color, #054f74);
color: var(--app-primary-color, #054f74); color: var(--app-primary-color, #054f74);
} }
#app-boot.is-timeout .boot-logo { #app-boot.is-timeout .boot-logo,
#app-boot.is-timeout .boot-text-logo {
animation: none; animation: none;
} }
#app-boot.is-timeout .boot-retry { #app-boot.is-timeout .boot-retry {
@ -321,7 +339,8 @@
} }
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
#app-boot .boot-logo { #app-boot .boot-logo,
#app-boot .boot-text-logo {
animation: none; animation: none;
} }
} }
@ -334,13 +353,14 @@
<div class="boot-logo-wrap"> <div class="boot-logo-wrap">
<img <img
class="boot-logo" class="boot-logo"
src="/app-mascot.png"
width="96" width="96"
height="96" height="96"
alt="" alt=""
decoding="sync" decoding="sync"
fetchpriority="high" fetchpriority="high"
hidden
/> />
<span class="boot-text-logo" aria-hidden="true">LOGO</span>
</div> </div>
</div> </div>
<div class="boot-status"> <div class="boot-status">
@ -412,14 +432,35 @@
try { try {
var cachedMascot = (localStorage.getItem('oms_brand_mascot_url') || '').trim(); var cachedMascot = (localStorage.getItem('oms_brand_mascot_url') || '').trim();
var logoImg = boot.querySelector('.boot-logo'); 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 && logoImg &&
cachedMascot &&
(/^https?:\/\//i.test(cachedMascot) || (/^https?:\/\//i.test(cachedMascot) ||
cachedMascot.charAt(0) === '/' || cachedMascot.charAt(0) === '/' ||
cachedMascot.indexOf('data:') === 0) cachedMascot.indexOf('data:') === 0)
) { ) {
logoImg.hidden = false;
logoImg.src = cachedMascot; logoImg.src = cachedMascot;
if (logoText) logoText.setAttribute('hidden', '');
root.classList.add('has-app-mascot');
root.style.setProperty( root.style.setProperty(
'--app-mascot-bg', '--app-mascot-bg',
'url("' + cachedMascot.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '")', 'url("' + cachedMascot.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '")',

View File

@ -36,7 +36,7 @@ server {
} }
location = /favicon.ico { location = /favicon.ico {
try_files /favicon.png /favicon.ico =404; try_files /favicon.ico =404;
expires 7d; expires 7d;
add_header Cache-Control "public"; add_header Cache-Control "public";
access_log off; access_log off;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -10,9 +10,3 @@ if (fs.existsSync(legacyLoginDir)) {
fs.rmSync(legacyLoginDir, { recursive: true, force: true }); fs.rmSync(legacyLoginDir, { recursive: true, force: true });
console.log('[postbuild] removed dist/login (conflicts with SPA route /login)'); 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');
}

View File

@ -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 绝对前缀) */ /** 将 /uploads/... 相对路径转为可访问 URL(同源相对,或 VITE_API_ASSET_ORIGIN 绝对前缀) */
export function resolveOmsAssetUrl(path?: string | null): string { export function resolveOmsAssetUrl(path?: string | null): string {
if (!path) return '' if (!path) return ''
const value = path.trim() const value = path.trim()
if (!value) return '' if (!value) return ''
const devCos = restoreDevCosProxyPath(value)
if (devCos) return devCos
if (/^https?:\/\//i.test(value) || value.startsWith('data:') || value.startsWith('blob:')) { if (/^https?:\/\//i.test(value) || value.startsWith('data:') || value.startsWith('blob:')) {
const cosProxied = toCosSameOriginProxyUrl(value) const cosProxied = toCosSameOriginProxyUrl(value)
if (cosProxied) return cosProxied if (cosProxied) return cosProxied

View File

@ -76,6 +76,14 @@ export async function uploadPaymentReceiveQr(channel: PaymentReceiveQrChannel, f
return unwrapData<PaymentReceiveQrDto>(res.data) return unwrapData<PaymentReceiveQrDto>(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<PaymentReceiveQrDto>(res.data)
}
export type BrandLogoChannel = 'portal' | 'site' | 'favicon' | 'mascot' export type BrandLogoChannel = 'portal' | 'site' | 'favicon' | 'mascot'
export interface BrandLogoDto { export interface BrandLogoDto {
@ -102,6 +110,14 @@ export async function uploadBrandLogo(channel: BrandLogoChannel, file: File) {
return unwrapData<BrandLogoDto>(res.data) return unwrapData<BrandLogoDto>(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<BrandLogoDto>(res.data)
}
/** 轨迹服务默认配置编码 */ /** 轨迹服务默认配置编码 */
export const TRACK_SERVICE_CONFIG_CODE = 'track_service' export const TRACK_SERVICE_CONFIG_CODE = 'track_service'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 KiB

View File

@ -39,23 +39,27 @@ body {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
/* 全局空态:用吉祥物替换 Arco Empty 默认图标 */ /* 全局空态:未配置吉祥物时不占位;有配置才显示图片 */
.arco-empty-image { .arco-empty-image {
.arco-icon { .arco-icon {
display: none !important; display: none !important;
} }
}
&::after { html:not(.has-app-mascot) .arco-empty-image {
display: none;
}
html.has-app-mascot .arco-empty-image::after {
content: ''; content: '';
display: block; display: block;
width: 36px; width: 36px;
height: 36px; height: 36px;
margin: 0 auto; margin: 0 auto;
background: var(--app-mascot-bg, url('/app-mascot.png')) center / contain no-repeat; background: var(--app-mascot-bg) center / contain no-repeat;
filter: grayscale(1) brightness(1.08) contrast(0.92); filter: grayscale(1) brightness(1.08) contrast(0.92);
opacity: 0.78; opacity: 0.78;
} }
}
.arco-empty-image img { .arco-empty-image img {
max-height: 44px; max-height: 44px;

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="app-mascot-state" :class="[`is-${mode}`, { 'is-compact': compact }]"> <div
v-if="appMascotUrl || description || $slots.default"
class="app-mascot-state"
:class="[`is-${mode}`, { 'is-compact': compact }]"
>
<img <img
v-if="appMascotUrl"
class="app-mascot-state__img" class="app-mascot-state__img"
:class="{ 'is-bounce': mode === 'loading' }" :class="{ 'is-bounce': mode === 'loading' }"
:src="appMascotUrl" :src="appMascotUrl"

View File

@ -14,7 +14,7 @@
collectPaginateEntries, collectPaginateEntries,
getPaginationMeta, getPaginationMeta,
} from './pagination'; } from './pagination';
import { appMascotUrl } from '@/utils/brandLogo'; import { appMascotUrl, BRAND_TEXT_LOGO } from '@/utils/brandLogo';
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@ -368,11 +368,25 @@
:class="{ 'interface-tree--hierarchical': hierarchical }" :class="{ 'interface-tree--hierarchical': hierarchical }"
> >
<div v-if="loading" class="loading-state"> <div v-if="loading" class="loading-state">
<img class="state-mascot is-bounce" :src="appMascotUrl" alt="" draggable="false" /> <img
v-if="appMascotUrl"
class="state-mascot is-bounce"
:src="appMascotUrl"
alt=""
draggable="false"
/>
<span v-else class="state-text-logo is-bounce" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<p>{{ loadingText }}</p> <p>{{ loadingText }}</p>
</div> </div>
<div v-else-if="isTreeEmpty" class="empty-state"> <div v-else-if="isTreeEmpty" class="empty-state">
<img class="state-mascot" :src="appMascotUrl" alt="" draggable="false" /> <img
v-if="appMascotUrl"
class="state-mascot"
:src="appMascotUrl"
alt=""
draggable="false"
/>
<span v-else class="state-text-logo" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<p>{{ emptyText }}</p> <p>{{ emptyText }}</p>
</div> </div>
<a-tree <a-tree
@ -1117,12 +1131,30 @@
} }
} }
.state-text-logo {
font-size: 22px;
font-weight: 700;
letter-spacing: 0.08em;
line-height: 1;
color: var(--color-text-3, #86909c);
opacity: 0.55;
user-select: none;
&.is-bounce {
animation: clm-mascot-bounce 1.4s ease-in-out infinite;
}
}
.empty-state .state-mascot { .empty-state .state-mascot {
width: 24px; width: 24px;
filter: grayscale(1) brightness(1.08) contrast(0.92); filter: grayscale(1) brightness(1.08) contrast(0.92);
opacity: 0.78; opacity: 0.78;
} }
.empty-state .state-text-logo {
font-size: 14px;
}
@keyframes clm-mascot-bounce { @keyframes clm-mascot-bounce {
0%, 0%,
100% { 100% {

View File

@ -16,7 +16,7 @@
} from './filterValue'; } from './filterValue';
import { enrichHybridColumn } from './hybridHeader'; import { enrichHybridColumn } from './hybridHeader';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import emptyMascotSrc from '@/assets/images/app-mascot.png'; import { appMascotUrl as emptyMascotSrc } from '@/utils/brandLogo';
const appStore = useAppStore(); const appStore = useAppStore();
/** Handsontable classic 浅/深主题:随页面日夜模式切换,否则列表区会被主题 CSS 锁成白底 */ /** Handsontable classic 浅/深主题:随页面日夜模式切换,否则列表区会被主题 CSS 锁成白底 */
@ -2881,7 +2881,13 @@
/> />
<div ref="hotContainer" class="handsontable-wrapper" :class="hotThemeClass"></div> <div ref="hotContainer" class="handsontable-wrapper" :class="hotThemeClass"></div>
<div v-if="showEmptyOverlay" class="handsontable-empty-overlay" aria-hidden="false"> <div v-if="showEmptyOverlay" class="handsontable-empty-overlay" aria-hidden="false">
<img class="handsontable-empty-overlay__img" :src="emptyMascotSrc" alt="" draggable="false" /> <img
v-if="emptyMascotSrc"
class="handsontable-empty-overlay__img"
:src="emptyMascotSrc"
alt=""
draggable="false"
/>
<p v-if="emptyOverlayText" class="handsontable-empty-overlay__text">{{ emptyOverlayText }}</p> <p v-if="emptyOverlayText" class="handsontable-empty-overlay__text">{{ emptyOverlayText }}</p>
<div v-if="$slots.emptyExtra" class="handsontable-empty-overlay__extra"> <div v-if="$slots.emptyExtra" class="handsontable-empty-overlay__extra">
<slot name="emptyExtra" /> <slot name="emptyExtra" />

View File

@ -19,7 +19,8 @@
import { isFunction } from 'lodash'; import { isFunction } from 'lodash';
import FormPro from '@/components/FormPro/index.vue'; import FormPro from '@/components/FormPro/index.vue';
import { $baseMessage } from '@/utils'; import { $baseMessage } from '@/utils';
import emptyImage from '@/assets/images/app-mascot.png'; import { appMascotUrl } from '@/utils/brandLogo';
const emptyImage = appMascotUrl;
import type { TableProMethods } from './types'; import type { TableProMethods } from './types';
const { t } = useI18n(); const { t } = useI18n();
@ -877,7 +878,13 @@
</template> </template>
<template #empty> <template #empty>
<div class="flex justify-center empty-image"> <div class="flex justify-center empty-image">
<img :src="emptyImage" alt="" class="empty-mascot" /> <img
v-if="emptyImage"
:src="emptyImage"
alt=""
class="empty-mascot"
draggable="false"
/>
<div class="empty-text">暂无数据</div> <div class="empty-text">暂无数据</div>
</div> </div>
</template> </template>
@ -983,6 +990,7 @@
filter: grayscale(1) brightness(1.08) contrast(0.92); filter: grayscale(1) brightness(1.08) contrast(0.92);
opacity: 0.78; opacity: 0.78;
} }
} }
.empty-text { .empty-text {

View File

@ -20,8 +20,15 @@
:title="t('brand.fullName')" :title="t('brand.fullName')"
@click.prevent="goOfficialSite" @click.prevent="goOfficialSite"
> >
<img :src="navLogo" :alt="t('brand.name')" class="agent-side-rail__brand-logo" /> <template v-if="navLogoSrc">
<span class="agent-side-rail__brand-name agent-side-rail__fade">{{ t('brand.name') }}</span> <img :src="navLogoSrc" :alt="t('brand.name')" class="agent-side-rail__brand-logo" />
<span class="agent-side-rail__brand-name agent-side-rail__fade">{{
t('brand.name')
}}</span>
</template>
<span v-else class="agent-side-rail__brand-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
</a> </a>
<div class="agent-side-rail__scroll"> <div class="agent-side-rail__scroll">
@ -110,7 +117,7 @@ import {
CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH, CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH,
CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH, CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH,
} from '@/utils/customer-portal-nav' } 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_COLLAPSED_WIDTH = CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH
const AGENT_SIDE_RAIL_EXPANDED_WIDTH = CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH const AGENT_SIDE_RAIL_EXPANDED_WIDTH = CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH
@ -126,6 +133,10 @@ type AgentNavItem = {
const { t } = useI18n() const { t } = useI18n()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const navLogoSrc = ref('')
void loadBrandLogoUrls().then((urls) => {
navLogoSrc.value = urls.portal || ''
})
const collapsed = ref(readCollapsed()) const collapsed = ref(readCollapsed())
const compactLayout = ref(collapsed.value) const compactLayout = ref(collapsed.value)
@ -342,6 +353,15 @@ onUnmounted(() => {
white-space: nowrap; 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 { &__scroll {
flex: 1; flex: 1;
min-height: 0; min-height: 0;

View File

@ -21,8 +21,15 @@
:title="t('brand.fullName')" :title="t('brand.fullName')"
@click.prevent="goOfficialSite" @click.prevent="goOfficialSite"
> >
<img :src="navLogo" :alt="t('brand.name')" class="customer-side-rail__brand-logo" /> <template v-if="navLogoSrc">
<span class="customer-side-rail__brand-name customer-side-rail__fade">{{ t('brand.name') }}</span> <img :src="navLogoSrc" :alt="t('brand.name')" class="customer-side-rail__brand-logo" />
<span class="customer-side-rail__brand-name customer-side-rail__fade">{{
t('brand.name')
}}</span>
</template>
<span v-else class="customer-side-rail__brand-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
</a> </a>
<div class="customer-side-rail__scroll"> <div class="customer-side-rail__scroll">
@ -199,7 +206,7 @@ import {
useHiprintClientState, useHiprintClientState,
} from '@/utils/hiprint/hiprintClientState' } from '@/utils/hiprint/hiprintClientState'
import { PRINT_CONTROL_DOWNLOAD_URL } from '@/constants/printControl' 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 { resolveCurrentCustomer } from '@/api/customer/resolve'
import { CUSTOMER_BALANCE_CHANGED_EVENT } from '@/api/customer/accountFlow' import { CUSTOMER_BALANCE_CHANGED_EVENT } from '@/api/customer/accountFlow'
import { getMapIdFromAccessToken } from '@/utils/jwt' import { getMapIdFromAccessToken } from '@/utils/jwt'
@ -235,6 +242,11 @@ const printConnectionState = useHiprintClientState()
/** 与 CSS transition 时长一致(Linear 风格约 300ms) */ /** 与 CSS transition 时长一致(Linear 风格约 300ms) */
const RAIL_ANIM_MS = 300 const RAIL_ANIM_MS = 300
const navLogoSrc = ref('')
void loadBrandLogoUrls().then((urls) => {
navLogoSrc.value = urls.portal || ''
})
const collapsed = ref(readCustomerSideRailCollapsed(false)) const collapsed = ref(readCustomerSideRailCollapsed(false))
/** 布局紧凑态:动画结束后再切,避免收起中途图标跳动 */ /** 布局紧凑态:动画结束后再切,避免收起中途图标跳动 */
const compactLayout = ref(collapsed.value) const compactLayout = ref(collapsed.value)
@ -684,6 +696,15 @@ onUnmounted(() => {
white-space: nowrap; 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 { &__scroll {
flex: 1; flex: 1;
min-height: 0; min-height: 0;

View File

@ -2,7 +2,13 @@
<div id="top-nav" class="top-nav" :class="{ tabNavEnable: tabNavEnable }"> <div id="top-nav" class="top-nav" :class="{ tabNavEnable: tabNavEnable }">
<div class="top-nav-header"> <div class="top-nav-header">
<!-- Logo 区域:点击跳转官网首页 --> <!-- Logo 区域:点击跳转官网首页 -->
<a class="top-nav-logo" href="/" :title="t('brand.fullName')" @click="goOfficialSite"> <a
v-if="navLogoSrc"
class="top-nav-logo"
href="/"
:title="t('brand.fullName')"
@click="goOfficialSite"
>
<img :src="navLogoSrc" :alt="t('brand.name')" /> <img :src="navLogoSrc" :alt="t('brand.name')" />
<div class="top-nav-logo__brand"> <div class="top-nav-logo__brand">
<span class="top-nav-logo__name">{{ t('brand.name') }}</span> <span class="top-nav-logo__name">{{ t('brand.name') }}</span>
@ -282,7 +288,6 @@ import { Message } from '@arco-design/web-vue';
import { openWindow, regexUrl } from '@/utils'; import { openWindow, regexUrl } from '@/utils';
import { MenuService, AuthService } from '@/api/rbac'; import { MenuService, AuthService } from '@/api/rbac';
import type { MenuTreeDto } from '@/api/rbac'; import type { MenuTreeDto } from '@/api/rbac';
import navLogoFallback from '@/assets/500x500.png';
import { applyDocumentFavicon, loadBrandLogoUrls } from '@/utils/brandLogo'; import { applyDocumentFavicon, loadBrandLogoUrls } from '@/utils/brandLogo';
import { import {
initHiprintClientState, initHiprintClientState,
@ -314,9 +319,9 @@ const appStore = useAppStore();
const tabBarStore = useTabBarStore(); const tabBarStore = useTabBarStore();
const rbacUserStore = useRbacUserStore(); const rbacUserStore = useRbacUserStore();
const navLogoSrc = ref(navLogoFallback); const navLogoSrc = ref('');
void loadBrandLogoUrls().then((urls) => { void loadBrandLogoUrls().then((urls) => {
navLogoSrc.value = urls.portal; navLogoSrc.value = urls.portal || '';
applyDocumentFavicon(urls.favicon); applyDocumentFavicon(urls.favicon);
}); });

View File

@ -4254,7 +4254,7 @@ export default {
'system.otherConfig.actions.brandLogo': 'Brand logo', 'system.otherConfig.actions.brandLogo': 'Brand logo',
'system.otherConfig.brandLogo.title': 'Brand logo', 'system.otherConfig.brandLogo.title': 'Brand logo',
'system.otherConfig.brandLogo.tip': 'system.otherConfig.brandLogo.tip':
'Used for system top nav, official site header, browser tab icon, and boot mascot. Takes effect immediately; defaults when empty. Prefer square PNG.', 'Used for system top nav, official site header, browser tab icon, and boot mascot. Takes effect immediately; shows text LOGO when empty. Prefer square PNG.',
'system.otherConfig.brandLogo.portal': 'System top nav', 'system.otherConfig.brandLogo.portal': 'System top nav',
'system.otherConfig.brandLogo.site': 'Official site', 'system.otherConfig.brandLogo.site': 'Official site',
'system.otherConfig.brandLogo.favicon': 'Browser tab', 'system.otherConfig.brandLogo.favicon': 'Browser tab',
@ -4265,8 +4265,14 @@ export default {
'system.otherConfig.brandLogo.size.mascot': '256 / 512 PNG · boot ~96px', 'system.otherConfig.brandLogo.size.mascot': '256 / 512 PNG · boot ~96px',
'system.otherConfig.brandLogo.replace': 'Replace', 'system.otherConfig.brandLogo.replace': 'Replace',
'system.otherConfig.brandLogo.empty': 'Not uploaded', 'system.otherConfig.brandLogo.empty': 'Not uploaded',
'system.otherConfig.brandLogo.clickUpload': 'Click or drag to upload', 'system.otherConfig.brandLogo.clickUpload': 'Upload',
'system.otherConfig.brandLogo.clickReplace': 'Click to replace', 'system.otherConfig.brandLogo.clickReplace': 'Click to replace',
'system.otherConfig.brandLogo.dropUpload': 'Click or drag a file here to upload',
'system.otherConfig.brandLogo.dropReplace': 'Click or drag to replace',
'system.otherConfig.brandLogo.invalidFile': 'Please upload an image (PNG / JPG / WEBP, etc.)',
'system.otherConfig.brandLogo.clear': 'Clear',
'system.otherConfig.brandLogo.clearSuccess': 'Cleared; text LOGO will show',
'system.otherConfig.brandLogo.clearFailed': 'Failed to clear',
'system.otherConfig.brandLogo.uploading': 'Uploading…', 'system.otherConfig.brandLogo.uploading': 'Uploading…',
'system.otherConfig.brandLogo.uploadSuccess': 'Brand logo updated', 'system.otherConfig.brandLogo.uploadSuccess': 'Brand logo updated',
'system.otherConfig.brandLogo.uploadFailed': 'Upload failed', 'system.otherConfig.brandLogo.uploadFailed': 'Upload failed',
@ -4305,8 +4311,14 @@ export default {
'system.otherConfig.paymentQr.wechat': 'WeChat', 'system.otherConfig.paymentQr.wechat': 'WeChat',
'system.otherConfig.paymentQr.replace': 'Replace', 'system.otherConfig.paymentQr.replace': 'Replace',
'system.otherConfig.paymentQr.empty': 'Not uploaded', 'system.otherConfig.paymentQr.empty': 'Not uploaded',
'system.otherConfig.paymentQr.clickUpload': 'Click or drag to upload', 'system.otherConfig.paymentQr.clickUpload': 'Upload',
'system.otherConfig.paymentQr.clickReplace': 'Click to replace', 'system.otherConfig.paymentQr.clickReplace': 'Click to replace',
'system.otherConfig.paymentQr.dropUpload': 'Click or drag a file here to upload',
'system.otherConfig.paymentQr.dropReplace': 'Click or drag to replace',
'system.otherConfig.paymentQr.invalidFile': 'Please upload an image (PNG / JPG / WEBP, etc.)',
'system.otherConfig.paymentQr.clear': 'Clear',
'system.otherConfig.paymentQr.clearSuccess': 'Payment QR cleared',
'system.otherConfig.paymentQr.clearFailed': 'Failed to clear',
'system.otherConfig.paymentQr.uploading': 'Uploading…', 'system.otherConfig.paymentQr.uploading': 'Uploading…',
'system.otherConfig.paymentQr.uploadSuccess': 'Payment QR updated', 'system.otherConfig.paymentQr.uploadSuccess': 'Payment QR updated',
'system.otherConfig.paymentQr.uploadFailed': 'Upload failed', 'system.otherConfig.paymentQr.uploadFailed': 'Upload failed',

View File

@ -4266,7 +4266,7 @@ export default {
'system.otherConfig.actions.brandLogo': '品牌 Logo', 'system.otherConfig.actions.brandLogo': '品牌 Logo',
'system.otherConfig.brandLogo.title': '品牌 Logo', 'system.otherConfig.brandLogo.title': '品牌 Logo',
'system.otherConfig.brandLogo.tip': 'system.otherConfig.brandLogo.tip':
'用于系统顶栏、官网头部、浏览器标签与启动页吉祥物。更换后立即生效;未上传时前端使用默认图。建议上传正方形 PNG。', '用于系统顶栏、官网头部、浏览器标签与启动页吉祥物。更换后立即生效;未上传时显示文字 LOGO。建议上传正方形 PNG。',
'system.otherConfig.brandLogo.portal': '系统顶栏', 'system.otherConfig.brandLogo.portal': '系统顶栏',
'system.otherConfig.brandLogo.site': '官网', 'system.otherConfig.brandLogo.site': '官网',
'system.otherConfig.brandLogo.favicon': '网站标签', 'system.otherConfig.brandLogo.favicon': '网站标签',
@ -4277,8 +4277,14 @@ export default {
'system.otherConfig.brandLogo.size.mascot': '建议 256 / 512 PNG,启动页约 96px', 'system.otherConfig.brandLogo.size.mascot': '建议 256 / 512 PNG,启动页约 96px',
'system.otherConfig.brandLogo.replace': '更换图片', 'system.otherConfig.brandLogo.replace': '更换图片',
'system.otherConfig.brandLogo.empty': '尚未上传', 'system.otherConfig.brandLogo.empty': '尚未上传',
'system.otherConfig.brandLogo.clickUpload': '点击或拖拽上传', 'system.otherConfig.brandLogo.clickUpload': '上传图片',
'system.otherConfig.brandLogo.clickReplace': '点击更换', 'system.otherConfig.brandLogo.clickReplace': '点击更换',
'system.otherConfig.brandLogo.dropUpload': '点击或拖拽文件到此处上传',
'system.otherConfig.brandLogo.dropReplace': '点击或拖拽更换',
'system.otherConfig.brandLogo.invalidFile': '请上传图片文件(PNG / JPG / WEBP 等)',
'system.otherConfig.brandLogo.clear': '清除',
'system.otherConfig.brandLogo.clearSuccess': '已清除,将显示文字 LOGO',
'system.otherConfig.brandLogo.clearFailed': '清除失败',
'system.otherConfig.brandLogo.uploading': '上传中…', 'system.otherConfig.brandLogo.uploading': '上传中…',
'system.otherConfig.brandLogo.uploadSuccess': '品牌 Logo 已更新', 'system.otherConfig.brandLogo.uploadSuccess': '品牌 Logo 已更新',
'system.otherConfig.brandLogo.uploadFailed': '上传失败', 'system.otherConfig.brandLogo.uploadFailed': '上传失败',
@ -4311,13 +4317,20 @@ export default {
'system.otherConfig.wechatOrderNotify.trialSuccess': '已提交试发(请查看发送日志/微信)', 'system.otherConfig.wechatOrderNotify.trialSuccess': '已提交试发(请查看发送日志/微信)',
'system.otherConfig.wechatOrderNotify.trialFailed': '试发失败', 'system.otherConfig.wechatOrderNotify.trialFailed': '试发失败',
'system.otherConfig.paymentQr.title': '充值收款码', 'system.otherConfig.paymentQr.title': '充值收款码',
'system.otherConfig.paymentQr.tip': '用于客户 PC / H5 充值页展示。更换后立即生效;未上传时前端使用默认图。', 'system.otherConfig.paymentQr.tip':
'用于客户 PC / H5 充值页展示。更换后立即生效;未上传时前端使用默认图。',
'system.otherConfig.paymentQr.alipay': '支付宝', 'system.otherConfig.paymentQr.alipay': '支付宝',
'system.otherConfig.paymentQr.wechat': '微信', 'system.otherConfig.paymentQr.wechat': '微信',
'system.otherConfig.paymentQr.replace': '更换图片', 'system.otherConfig.paymentQr.replace': '更换图片',
'system.otherConfig.paymentQr.empty': '尚未上传', 'system.otherConfig.paymentQr.empty': '尚未上传',
'system.otherConfig.paymentQr.clickUpload': '点击或拖拽上传', 'system.otherConfig.paymentQr.clickUpload': '上传图片',
'system.otherConfig.paymentQr.clickReplace': '点击更换', 'system.otherConfig.paymentQr.clickReplace': '点击更换',
'system.otherConfig.paymentQr.dropUpload': '点击或拖拽文件到此处上传',
'system.otherConfig.paymentQr.dropReplace': '点击或拖拽更换',
'system.otherConfig.paymentQr.invalidFile': '请上传图片文件(PNG / JPG / WEBP 等)',
'system.otherConfig.paymentQr.clear': '清除',
'system.otherConfig.paymentQr.clearSuccess': '已清除收款码',
'system.otherConfig.paymentQr.clearFailed': '清除失败',
'system.otherConfig.paymentQr.uploading': '上传中…', 'system.otherConfig.paymentQr.uploading': '上传中…',
'system.otherConfig.paymentQr.uploadSuccess': '收款码已更新', 'system.otherConfig.paymentQr.uploadSuccess': '收款码已更新',
'system.otherConfig.paymentQr.uploadFailed': '上传失败', 'system.otherConfig.paymentQr.uploadFailed': '上传失败',

View File

@ -138,7 +138,7 @@ async function bootstrap() {
initAuthKeepAlive(); initAuthKeepAlive();
// GA4:有 VITE_GA_MEASUREMENT_ID 才加载;地域/设备等自动采集 // GA4:有 VITE_GA_MEASUREMENT_ID 才加载;地域/设备等自动采集
initGa(); initGa();
// 浏览器标签 favicon(匿名可读;未配置仍用 /favicon.png) // 浏览器标签 favicon / 启动页吉祥物(匿名可读;未配置显示文字 LOGO)
void bootstrapBrandAssets(); void bootstrapBrandAssets();
// 登录页勿预热 VXE/Element:体积大且会注入全局 CSS,和首屏抢带宽 // 登录页勿预热 VXE/Element:体积大且会注入全局 CSS,和首屏抢带宽

View File

@ -2,7 +2,6 @@ import { ref } from 'vue'
import { getBrandLogo, type BrandLogoDto } from '@/api/system/otherConfig' import { getBrandLogo, type BrandLogoDto } from '@/api/system/otherConfig'
import { resolveOmsAssetUrl, unwrapData } from '@/api/oms/common' import { resolveOmsAssetUrl, unwrapData } from '@/api/oms/common'
import { resolveAdminApiPath } from '@/utils/adminApi' import { resolveAdminApiPath } from '@/utils/adminApi'
import portalLogoFallback from '@/assets/500x500.png'
export type BrandLogoUrls = { export type BrandLogoUrls = {
portal: string portal: string
@ -11,18 +10,35 @@ export type BrandLogoUrls = {
mascot: string mascot: string
} }
const SITE_LOGO_FALLBACK = '/site/img/logo1.png' /** 未配置图片时的文字占位(启动页 / 空态) */
const FAVICON_FALLBACK = '/favicon.png' export const BRAND_TEXT_LOGO = 'LOGO'
export const MASCOT_FALLBACK = '/app-mascot.png' /** @deprecated 已改为文字 LOGO */
export const EMPTY_PLACEHOLDER = ''
/** @deprecated 已改为文字 LOGO */
export const MASCOT_FALLBACK = ''
/** 启动页在 Vue 挂载前读取,须与 index.html 一致 */ /** 启动页在 Vue 挂载前读取,须与 index.html 一致 */
export const MASCOT_CACHE_KEY = 'oms_brand_mascot_url' export const MASCOT_CACHE_KEY = 'oms_brand_mascot_url'
function isLegacyDefaultMascot(raw: string): boolean {
return (
raw === '/app-mascot.png' ||
raw.startsWith('/app-mascot.png?') ||
raw.includes('app-mascot.png') ||
raw === '/empty-placeholder.svg' ||
raw.startsWith('/empty-placeholder.svg')
)
}
function readCachedMascotUrl(): string { function readCachedMascotUrl(): string {
if (typeof localStorage === 'undefined') return '' if (typeof localStorage === 'undefined') return ''
try { try {
const raw = (localStorage.getItem(MASCOT_CACHE_KEY) || '').trim() const raw = (localStorage.getItem(MASCOT_CACHE_KEY) || '').trim()
if (!raw) return '' if (!raw) return ''
if (/^https?:\/\//i.test(raw) || raw.startsWith('/') || raw.startsWith('data:')) { if (/^https?:\/\//i.test(raw) || raw.startsWith('/') || raw.startsWith('data:')) {
if (isLegacyDefaultMascot(raw)) {
localStorage.removeItem(MASCOT_CACHE_KEY)
return ''
}
return raw return raw
} }
} catch { } catch {
@ -33,88 +49,117 @@ function readCachedMascotUrl(): string {
function mapBrandLogoDto(data?: BrandLogoDto | null): BrandLogoUrls { function mapBrandLogoDto(data?: BrandLogoDto | null): BrandLogoUrls {
return { return {
portal: resolveOmsAssetUrl(data?.portalUrl) || portalLogoFallback, portal: resolveOmsAssetUrl(data?.portalUrl) || '',
site: resolveOmsAssetUrl(data?.siteUrl) || SITE_LOGO_FALLBACK, site: resolveOmsAssetUrl(data?.siteUrl) || '',
favicon: resolveOmsAssetUrl(data?.faviconUrl) || FAVICON_FALLBACK, favicon: resolveOmsAssetUrl(data?.faviconUrl) || '',
mascot: resolveOmsAssetUrl(data?.mascotUrl) || MASCOT_FALLBACK, mascot: resolveOmsAssetUrl(data?.mascotUrl) || '',
} }
} }
/** 空态 / 启动页吉祥物(可被配置覆盖) */ /** 空态 / 启动页吉祥物 URL;未配置为空串,UI 显示文字 LOGO */
export const appMascotUrl = ref(readCachedMascotUrl() || MASCOT_FALLBACK) export const appMascotUrl = ref(readCachedMascotUrl())
function setMascotCssVar(resolved: string) { function setMascotCssVar(resolved: string) {
if (typeof document === 'undefined') return if (typeof document === 'undefined') return
try { try {
if (!resolved) {
document.documentElement.style.removeProperty('--app-mascot-bg')
document.documentElement.classList.remove('has-app-mascot')
return
}
const safe = resolved.replace(/\\/g, '\\\\').replace(/"/g, '\\"') const safe = resolved.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
document.documentElement.style.setProperty('--app-mascot-bg', `url("${safe}")`) document.documentElement.style.setProperty('--app-mascot-bg', `url("${safe}")`)
document.documentElement.classList.add('has-app-mascot')
} catch { } catch {
/* ignore */ /* ignore */
} }
} }
function syncBootBrand(displayUrl: string) {
if (typeof document === 'undefined') return
const bootImg = document.querySelector<HTMLImageElement>('#app-boot .boot-logo')
const bootText = document.querySelector<HTMLElement>('#app-boot .boot-text-logo')
if (displayUrl) {
if (bootImg) {
bootImg.hidden = false
bootImg.src = displayUrl
}
bootText?.setAttribute('hidden', '')
} else {
if (bootImg) {
bootImg.hidden = true
bootImg.removeAttribute('src')
}
bootText?.removeAttribute('hidden')
}
}
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
const initial = appMascotUrl.value const initial = appMascotUrl.value
if (initial && initial !== MASCOT_FALLBACK) { if (initial) {
setMascotCssVar(initial.split('?')[0] || initial) setMascotCssVar(initial.split('?')[0] || initial)
syncBootBrand(initial)
} else {
setMascotCssVar('')
syncBootBrand('')
} }
} }
/** 更新浏览器标签 favicon(带缓存戳) */ /** 更新浏览器标签 favicon;未配置时移除自定义 icon */
export function applyDocumentFavicon(url?: string | null) { export function applyDocumentFavicon(url?: string | null) {
if (typeof document === 'undefined') return if (typeof document === 'undefined') return
const raw = String(url || '').trim() || FAVICON_FALLBACK const raw = String(url || '').trim()
const href = raw.includes('?') ? raw : `${raw}?_t=${Date.now()}`
let link = document.querySelector<HTMLLinkElement>('link[rel="icon"]') let link = document.querySelector<HTMLLinkElement>('link[rel="icon"]')
if (!raw) {
if (link) link.remove()
return
}
const href = raw.includes('?') ? raw : `${raw}?_t=${Date.now()}`
if (!link) { if (!link) {
link = document.createElement('link') link = document.createElement('link')
link.rel = 'icon' link.rel = 'icon'
document.head.appendChild(link) document.head.appendChild(link)
} }
link.type = 'image/png' link.type = raw.toLowerCase().endsWith('.svg') ? 'image/svg+xml' : 'image/png'
link.href = href link.href = href
} }
/** 应用启动页 / 空态吉祥物,并写入 localStorage 供下次冷启动 */ /** 应用启动页 / 空态吉祥物;未配置则清缓存并用文字 LOGO */
export function applyAppMascot(url?: string | null) { export function applyAppMascot(url?: string | null) {
if (typeof document === 'undefined') return if (typeof document === 'undefined') return
const resolved = resolveOmsAssetUrl(url) || MASCOT_FALLBACK const configured = resolveOmsAssetUrl(url) || ''
const display = const display =
resolved === MASCOT_FALLBACK || resolved.includes('?') !configured || configured.includes('?')
? resolved ? configured
: `${resolved}?_t=${Date.now()}` : `${configured}?_t=${Date.now()}`
appMascotUrl.value = display appMascotUrl.value = display
try { try {
if (resolved === MASCOT_FALLBACK) { if (!configured) {
localStorage.removeItem(MASCOT_CACHE_KEY) localStorage.removeItem(MASCOT_CACHE_KEY)
} else { } else {
localStorage.setItem(MASCOT_CACHE_KEY, resolved) localStorage.setItem(MASCOT_CACHE_KEY, configured)
} }
} catch { } catch {
/* ignore */ /* ignore */
} }
setMascotCssVar(resolved) setMascotCssVar(configured)
syncBootBrand(display)
const bootImg = document.querySelector<HTMLImageElement>('#app-boot .boot-logo')
if (bootImg) {
bootImg.src = display
}
} }
/** 拉取配置的品牌 Logo;未配置或失败时回退本地默认图(需登录态) */ /** 拉取配置的品牌 Logo;未配置返回空串(需登录态) */
export async function loadBrandLogoUrls(): Promise<BrandLogoUrls> { export async function loadBrandLogoUrls(): Promise<BrandLogoUrls> {
try { try {
const data = await getBrandLogo() const data = await getBrandLogo()
return mapBrandLogoDto(data) return mapBrandLogoDto(data)
} catch { } catch {
return { return {
portal: portalLogoFallback, portal: '',
site: SITE_LOGO_FALLBACK, site: '',
favicon: FAVICON_FALLBACK, favicon: '',
mascot: readCachedMascotUrl() || MASCOT_FALLBACK, mascot: readCachedMascotUrl(),
} }
} }
} }
@ -133,10 +178,10 @@ export async function fetchBrandLogoUrlsPublic(): Promise<BrandLogoUrls> {
return mapBrandLogoDto(data) return mapBrandLogoDto(data)
} catch { } catch {
return { return {
portal: portalLogoFallback, portal: '',
site: SITE_LOGO_FALLBACK, site: '',
favicon: FAVICON_FALLBACK, favicon: '',
mascot: readCachedMascotUrl() || MASCOT_FALLBACK, mascot: readCachedMascotUrl(),
} }
} }
} }
@ -144,9 +189,7 @@ export async function fetchBrandLogoUrlsPublic(): Promise<BrandLogoUrls> {
/** 启动时应用配置的 favicon + 吉祥物(匿名可读) */ /** 启动时应用配置的 favicon + 吉祥物(匿名可读) */
export async function bootstrapBrandAssets() { export async function bootstrapBrandAssets() {
const cached = readCachedMascotUrl() const cached = readCachedMascotUrl()
if (cached) { applyAppMascot(cached || '')
applyAppMascot(cached)
}
const urls = await fetchBrandLogoUrlsPublic() const urls = await fetchBrandLogoUrlsPublic()
applyDocumentFavicon(urls.favicon) applyDocumentFavicon(urls.favicon)
applyAppMascot(urls.mascot) applyAppMascot(urls.mascot)

View File

@ -15,8 +15,16 @@
:aria-label="t('h5Admin.login.backToSite')" :aria-label="t('h5Admin.login.backToSite')"
@click="goOfficialSite" @click="goOfficialSite"
> >
<img :src="logoImg" alt="" class="h5-login-card__logo" /> <img
<h2 class="h5-login-card__title">{{ t('h5Admin.login.brandName') }}</h2> v-if="logoSrc"
:src="logoSrc"
alt=""
class="h5-login-card__logo"
/>
<span v-else class="h5-login-card__logo-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
<h2 v-if="logoSrc" class="h5-login-card__title">{{ t('h5Admin.login.brandName') }}</h2>
</button> </button>
<p class="h5-login-card__hint">{{ t('h5Admin.login.brandHint') }}</p> <p class="h5-login-card__hint">{{ t('h5Admin.login.brandHint') }}</p>
</header> </header>
@ -109,7 +117,7 @@ import { loginErrorForUser, useRbacUserStore } from '@/store/modules/rbac-user';
import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate'; import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate';
import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue'; import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue';
import { ADMIN_H5_HOME_PATH, isAdminH5Path } from '@/utils/login-portal'; import { ADMIN_H5_HOME_PATH, isAdminH5Path } from '@/utils/login-portal';
import logoImg from '@/assets/logo2.png'; import { BRAND_TEXT_LOGO, fetchBrandLogoUrlsPublic } from '@/utils/brandLogo';
import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue'; import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue';
import H5LoginPortalSwitch from '@/views/h5/components/H5LoginPortalSwitch.vue'; import H5LoginPortalSwitch from '@/views/h5/components/H5LoginPortalSwitch.vue';
@ -119,6 +127,10 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const rbacUserStore = useRbacUserStore(); const rbacUserStore = useRbacUserStore();
const logoSrc = ref('');
void fetchBrandLogoUrlsPublic().then((urls) => {
logoSrc.value = urls.site || '';
});
const { const {
requireCaptcha, requireCaptcha,
captchaId, captchaId,
@ -325,6 +337,16 @@ onMounted(() => {
user-select: none; user-select: none;
} }
.h5-login-card__logo-mark {
display: block;
font-size: 22px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1;
color: #86909c;
user-select: none;
}
.h5-login-card__title { .h5-login-card__title {
margin: 0; margin: 0;
font-size: 22px; font-size: 22px;

View File

@ -130,16 +130,26 @@
color: var(--h5-text-3, #86909c); color: var(--h5-text-3, #86909c);
&::before { &::before {
content: ''; content: 'LOGO';
display: block; display: block;
margin: 0 auto 10px;
font-size: 18px;
font-weight: 700;
letter-spacing: 0.08em;
line-height: 1;
color: var(--h5-text-3, #86909c);
opacity: 0.55;
}
}
html.has-app-mascot .h5-ops__empty::before {
content: '';
width: 36px; width: 36px;
height: 36px; height: 36px;
margin: 0 auto 10px; background: var(--app-mascot-bg) 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); filter: grayscale(1) brightness(1.08) contrast(0.92);
opacity: 0.78; opacity: 0.78;
} }
}
.h5-ops__card { .h5-ops__card {
display: grid; display: grid;

View File

@ -4,8 +4,16 @@
<main v-if="oauthBusy" class="h5-login-oauth-screen"> <main v-if="oauthBusy" class="h5-login-oauth-screen">
<div class="h5-login-oauth-screen__card"> <div class="h5-login-oauth-screen__card">
<div class="h5-login-oauth-screen__brand"> <div class="h5-login-oauth-screen__brand">
<img :src="logoImg" alt="" class="h5-login-card__logo" /> <img
<span>{{ t('h5.login.brandName') }}</span> v-if="logoSrc"
:src="logoSrc"
alt=""
class="h5-login-card__logo"
/>
<span v-else class="h5-login-card__logo-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
<span v-if="logoSrc">{{ t('h5.login.brandName') }}</span>
</div> </div>
<a-spin :size="28" /> <a-spin :size="28" />
<p class="h5-login-oauth-screen__text">{{ t('h5.login.oauthLoggingIn') }}</p> <p class="h5-login-oauth-screen__text">{{ t('h5.login.oauthLoggingIn') }}</p>
@ -30,8 +38,16 @@
:aria-label="t('h5.login.backToSite')" :aria-label="t('h5.login.backToSite')"
@click="goOfficialSite" @click="goOfficialSite"
> >
<img :src="logoImg" alt="" class="h5-login-card__logo" /> <img
<h2 class="h5-login-card__title">{{ t('h5.login.brandName') }}</h2> v-if="logoSrc"
:src="logoSrc"
alt=""
class="h5-login-card__logo"
/>
<span v-else class="h5-login-card__logo-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
<h2 v-if="logoSrc" class="h5-login-card__title">{{ t('h5.login.brandName') }}</h2>
</button> </button>
<p class="h5-login-card__hint">{{ t('h5.login.brandHint') }}</p> <p class="h5-login-card__hint">{{ t('h5.login.brandHint') }}</p>
</header> </header>
@ -172,7 +188,7 @@ import { isWeChatBrowser } from '@/utils/device';
import { loginErrorForUser, useRbacUserStore } from '@/store/modules/rbac-user'; import { loginErrorForUser, useRbacUserStore } from '@/store/modules/rbac-user';
import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate'; import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate';
import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue'; import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue';
import logoImg from '@/assets/logo2.png'; import { BRAND_TEXT_LOGO, fetchBrandLogoUrlsPublic } from '@/utils/brandLogo';
import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue'; import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue';
import H5LoginPortalSwitch from '@/views/h5/components/H5LoginPortalSwitch.vue'; import H5LoginPortalSwitch from '@/views/h5/components/H5LoginPortalSwitch.vue';
import WechatOAuthLoginButton from '../components/WechatOAuthLoginButton.vue'; import WechatOAuthLoginButton from '../components/WechatOAuthLoginButton.vue';
@ -189,6 +205,10 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const rbacUserStore = useRbacUserStore(); const rbacUserStore = useRbacUserStore();
const logoSrc = ref('');
void fetchBrandLogoUrlsPublic().then((urls) => {
logoSrc.value = urls.site || '';
});
const { const {
requireCaptcha, requireCaptcha,
captchaId, captchaId,
@ -596,6 +616,16 @@ onMounted(async () => {
pointer-events: none; pointer-events: none;
} }
.h5-login-card__logo-mark {
display: block;
font-size: 22px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1;
color: #86909c;
user-select: none;
}
.h5-login-card__title { .h5-login-card__title {
margin: 0; margin: 0;
font-size: 22px; font-size: 22px;

View File

@ -263,12 +263,14 @@
class="h5-empty h5-empty--no-quote" class="h5-empty h5-empty--no-quote"
> >
<img <img
v-if="appMascotUrl"
class="h5-empty__mascot" class="h5-empty__mascot"
:src="appMascotUrl" :src="appMascotUrl"
alt="" alt=""
decoding="async" decoding="async"
draggable="false" draggable="false"
/> />
<span v-else class="h5-empty__text-logo" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<div class="h5-empty__badge">{{ t('h5.price.noResultTitle') }}</div> <div class="h5-empty__badge">{{ t('h5.price.noResultTitle') }}</div>
<p class="h5-empty__title"> <p class="h5-empty__title">
{{ {{
@ -528,12 +530,14 @@
<div v-else-if="isLoggedIn" class="h5-empty h5-price-empty"> <div v-else-if="isLoggedIn" class="h5-empty h5-price-empty">
<img <img
v-if="appMascotUrl"
class="h5-empty__mascot" class="h5-empty__mascot"
:src="appMascotUrl" :src="appMascotUrl"
alt="" alt=""
decoding="async" decoding="async"
draggable="false" draggable="false"
/> />
<span v-else class="h5-empty__text-logo" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<p>{{ t('h5.price.empty') }}</p> <p>{{ t('h5.price.empty') }}</p>
</div> </div>
@ -732,7 +736,7 @@ import {
} from '@/api/order'; } from '@/api/order';
import { getSalesProductDetail } from '@/api/channel/salesProduct'; import { getSalesProductDetail } from '@/api/channel/salesProduct';
import { h5Navigate } from '@/utils/device'; import { h5Navigate } from '@/utils/device';
import { appMascotUrl } from '@/utils/brandLogo'; import { appMascotUrl, BRAND_TEXT_LOGO } from '@/utils/brandLogo';
import { isLogin } from '@/utils/auth'; import { isLogin } from '@/utils/auth';
import { checkCustomerContactRequired } from '@/utils/customerContactGate'; import { checkCustomerContactRequired } from '@/utils/customerContactGate';
import { ensureH5Login } from '../composables/useH5LoginGate'; import { ensureH5Login } from '../composables/useH5LoginGate';
@ -2979,6 +2983,19 @@ onMounted(() => {
user-select: none; user-select: none;
} }
.h5-empty__text-logo {
display: block;
margin: 0 auto 8px;
font-size: 18px;
font-weight: 700;
letter-spacing: 0.08em;
line-height: 1;
text-align: center;
color: var(--color-text-3, #86909c);
opacity: 0.55;
user-select: none;
}
.h5-empty__badge { .h5-empty__badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;

View File

@ -1,17 +1,23 @@
<template> <template>
<div class="login-brand" aria-hidden="true"> <div v-if="logoSrc" class="login-brand" aria-hidden="true">
<img class="login-brand__img" :src="logoImg" alt="" draggable="false" /> <img class="login-brand__img" :src="logoSrc" alt="" draggable="false" />
<span class="login-brand__name">{{ t('brand.name') }}</span> <span class="login-brand__name">{{ t('brand.name') }}</span>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import logoImg from '@/assets/logo2.png'; import { fetchBrandLogoUrlsPublic } from '@/utils/brandLogo';
defineOptions({ name: 'LoginLockLogo' }); defineOptions({ name: 'LoginLockLogo' });
const { t } = useI18n(); const { t } = useI18n();
const logoSrc = ref('');
void fetchBrandLogoUrlsPublic().then((urls) => {
logoSrc.value = urls.site || '';
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -17,7 +17,7 @@ import {
updateCustoms9610, updateCustoms9610,
} from '@/api/order/customs9610' } from '@/api/order/customs9610'
import { $baseMessage } from '@/utils' import { $baseMessage } from '@/utils'
import { appMascotUrl } from '@/utils/brandLogo' import { appMascotUrl, BRAND_TEXT_LOGO } from '@/utils/brandLogo'
import { hasPermission } from '@/utils/rbac-permission' import { hasPermission } from '@/utils/rbac-permission'
import { formatDateTime, normalizeListRow, pickField } from '@/utils/warehouseListMapper' import { formatDateTime, normalizeListRow, pickField } from '@/utils/warehouseListMapper'
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer' import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
@ -770,7 +770,14 @@ onMounted(() => {
<div ref="tableContainerRef" class="list-wrap"> <div ref="tableContainerRef" class="list-wrap">
<div v-if="!listLoading && totalCount === 0" class="list-empty-hint"> <div v-if="!listLoading && totalCount === 0" class="list-empty-hint">
<img class="list-empty-hint__mascot" :src="appMascotUrl" alt="" draggable="false" /> <img
v-if="appMascotUrl"
class="list-empty-hint__mascot"
:src="appMascotUrl"
alt=""
draggable="false"
/>
<span v-else class="list-empty-hint__text-logo" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<span>{{ t('order.customs9610.empty.hint') }}</span> <span>{{ t('order.customs9610.empty.hint') }}</span>
</div> </div>
<a-spin :loading="listLoading" class="table-spin"> <a-spin :loading="listLoading" class="table-spin">
@ -1147,6 +1154,16 @@ onMounted(() => {
opacity: 0.78; opacity: 0.78;
} }
.list-empty-hint__text-logo {
font-size: 18px;
font-weight: 700;
letter-spacing: 0.08em;
line-height: 1;
color: var(--color-text-3, #86909c);
opacity: 0.55;
user-select: none;
}
.table-spin { .table-spin {
width: 100%; width: 100%;
flex: 1; flex: 1;

View File

@ -1,7 +1,12 @@
<template> <template>
<header id="header" class="header d-flex align-items-center fixed-top"> <header id="header" class="header d-flex align-items-center fixed-top">
<div class="container-fluid container-xl d-flex align-items-center justify-content-between"> <div class="container-fluid container-xl d-flex align-items-center justify-content-between">
<a href="/" class="logo d-flex align-items-center" @click="$emit('home')"> <a
v-if="siteLogoSrc"
href="/"
class="logo d-flex align-items-center"
@click="$emit('home')"
>
<img :src="siteLogoSrc" alt="BCD logo" width="40" height="40" /> <img :src="siteLogoSrc" alt="BCD logo" width="40" height="40" />
<span class="brand-lockup"> <span class="brand-lockup">
<h1>BCD</h1> <h1>BCD</h1>
@ -151,9 +156,9 @@
const rbacUserStore = useRbacUserStore(); const rbacUserStore = useRbacUserStore();
const signedIn = computed(() => rbacUserStore.isLoggedIn); const signedIn = computed(() => rbacUserStore.isLoggedIn);
const homeUrl = officialAppHomeUrl(); const homeUrl = officialAppHomeUrl();
const siteLogoSrc = ref('/site/img/logo1.png'); const siteLogoSrc = ref('');
void fetchBrandLogoUrlsPublic().then((urls) => { void fetchBrandLogoUrlsPublic().then((urls) => {
siteLogoSrc.value = urls.site; siteLogoSrc.value = urls.site || '';
applyDocumentFavicon(urls.favicon); applyDocumentFavicon(urls.favicon);
}); });

View File

@ -459,7 +459,7 @@
v-model:visible="paymentQrVisible" v-model:visible="paymentQrVisible"
:title="t('system.otherConfig.paymentQr.title')" :title="t('system.otherConfig.paymentQr.title')"
:footer="false" :footer="false"
width="640px" width="680px"
:mask-closable="false" :mask-closable="false"
unmount-on-close unmount-on-close
> >
@ -469,36 +469,75 @@
<div v-if="paymentQrLoading" class="payment-qr-loading"> <div v-if="paymentQrLoading" class="payment-qr-loading">
<a-spin /> <a-spin />
</div> </div>
<div v-else class="payment-qr-grid"> <div v-else class="brand-logo-grid">
<div <div
v-for="item in paymentQrCards" v-for="item in paymentQrCards"
:key="item.channel" :key="item.channel"
class="payment-qr-card" class="brand-logo-card"
> >
<div class="payment-qr-card__head"> <div class="brand-logo-card__meta">
<span class="payment-qr-card__title">{{ item.title }}</span> <div class="brand-logo-card__meta-text">
<a-upload <span class="brand-logo-card__title">{{ item.title }}</span>
:show-file-list="false" </div>
<a-button
v-if="item.url"
class="brand-logo-card__clear"
size="mini"
:loading="item.uploading"
@click.stop="handlePaymentQrClear(item.channel)"
>
{{ t('system.otherConfig.paymentQr.clear') }}
</a-button>
</div>
<div
class="brand-logo-card__zone"
:class="{
'is-filled': !!item.url,
'is-uploading': item.uploading,
'is-dragover': paymentQrDragOver[item.channel],
}"
@click="openPaymentQrPicker(item.channel)"
@dragenter.prevent="onPaymentQrDragEnter(item.channel)"
@dragover.prevent="onPaymentQrDragEnter(item.channel)"
@dragleave.prevent="onPaymentQrDragLeave(item.channel, $event)"
@drop.prevent="onPaymentQrDrop(item.channel, $event)"
>
<template v-if="item.url">
<img
class="brand-logo-card__img brand-logo-card__img--qr"
:src="item.url"
:alt="item.title"
draggable="false"
/>
<div v-if="item.uploading" class="brand-logo-card__mask is-busy">
<a-spin />
<span>{{ t('system.otherConfig.paymentQr.uploading') }}</span>
</div>
<div v-else class="brand-logo-card__mask">
{{ t('system.otherConfig.paymentQr.dropReplace') }}
</div>
</template>
<template v-else-if="item.uploading">
<a-spin />
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.paymentQr.uploading') }}
</span>
</template>
<template v-else>
<span class="brand-logo-card__plus">+</span>
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.paymentQr.dropUpload') }}
</span>
</template>
<input
class="brand-logo-card__file"
type="file"
:data-channel="`qr-${item.channel}`"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp" accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp"
:disabled="item.uploading" :disabled="item.uploading"
:custom-request="(option) => handlePaymentQrUpload(item.channel, option)" @click.stop
> @change="onPaymentQrFileChange(item.channel, $event)"
<a-button size="small" :loading="item.uploading">
{{ t('system.otherConfig.paymentQr.replace') }}
</a-button>
</a-upload>
</div>
<div class="payment-qr-card__preview">
<a-image
v-if="item.url"
:src="item.url"
:preview="true"
width="200"
fit="contain"
/> />
<div v-else class="payment-qr-card__empty">
{{ t('system.otherConfig.paymentQr.empty') }}
</div>
</div> </div>
</div> </div>
</div> </div>
@ -525,44 +564,70 @@
class="brand-logo-card" class="brand-logo-card"
> >
<div class="brand-logo-card__meta"> <div class="brand-logo-card__meta">
<div class="brand-logo-card__meta-text">
<span class="brand-logo-card__title">{{ item.title }}</span> <span class="brand-logo-card__title">{{ item.title }}</span>
<span class="brand-logo-card__size">{{ item.sizeHint }}</span> <span class="brand-logo-card__size">{{ item.sizeHint }}</span>
</div> </div>
<a-upload <a-button
class="brand-logo-card__upload" v-if="item.url"
draggable class="brand-logo-card__clear"
:show-file-list="false" size="mini"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp" :loading="item.uploading"
:disabled="item.uploading" @click.stop="handleBrandLogoClear(item.channel)"
:custom-request="(option) => handleBrandLogoUpload(item.channel, option)"
> >
{{ t('system.otherConfig.brandLogo.clear') }}
</a-button>
</div>
<div <div
class="brand-logo-card__zone" class="brand-logo-card__zone"
:class="{ :class="{
'is-filled': !!item.url, 'is-filled': !!item.url,
'is-uploading': item.uploading, 'is-uploading': item.uploading,
'is-dragover': brandLogoDragOver[item.channel],
}" }"
@click="openBrandLogoPicker(item.channel)"
@dragenter.prevent="onBrandLogoDragEnter(item.channel)"
@dragover.prevent="onBrandLogoDragEnter(item.channel)"
@dragleave.prevent="onBrandLogoDragLeave(item.channel, $event)"
@drop.prevent="onBrandLogoDrop(item.channel, $event)"
> >
<template v-if="item.uploading"> <template v-if="item.url">
<img
class="brand-logo-card__img"
:src="item.url"
:alt="item.title"
draggable="false"
/>
<div v-if="item.uploading" class="brand-logo-card__mask is-busy">
<a-spin />
<span>{{ t('system.otherConfig.brandLogo.uploading') }}</span>
</div>
<div v-else class="brand-logo-card__mask">
{{ t('system.otherConfig.brandLogo.dropReplace') }}
</div>
</template>
<template v-else-if="item.uploading">
<a-spin /> <a-spin />
<span class="brand-logo-card__hint"> <span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.uploading') }} {{ t('system.otherConfig.brandLogo.uploading') }}
</span> </span>
</template> </template>
<template v-else-if="item.url">
<img class="brand-logo-card__img" :src="item.url" alt="" />
<div class="brand-logo-card__mask">
{{ t('system.otherConfig.brandLogo.clickReplace') }}
</div>
</template>
<template v-else> <template v-else>
<span class="brand-logo-card__plus">+</span> <span class="brand-logo-card__mark">LOGO</span>
<span class="brand-logo-card__hint"> <span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.clickUpload') }} {{ t('system.otherConfig.brandLogo.dropUpload') }}
</span> </span>
</template> </template>
<input
class="brand-logo-card__file"
type="file"
:data-channel="item.channel"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp"
:disabled="item.uploading"
@click.stop
@change="onBrandLogoFileChange(item.channel, $event)"
/>
</div> </div>
</a-upload>
</div> </div>
</div> </div>
</a-modal> </a-modal>
@ -582,6 +647,8 @@ import {
WECHAT_MP_FOLLOW_CONFIG_CODE, WECHAT_MP_FOLLOW_CONFIG_CODE,
createSystemOtherConfig, createSystemOtherConfig,
deleteSystemOtherConfig, deleteSystemOtherConfig,
clearBrandLogo,
clearPaymentReceiveQr,
getBrandLogo, getBrandLogo,
getPaymentReceiveQr, getPaymentReceiveQr,
getSystemOtherConfigDetail, getSystemOtherConfigDetail,
@ -1053,28 +1120,41 @@ const paymentQrUploading = reactive({
alipay: false, alipay: false,
wechat: false, wechat: false,
}) })
const paymentQrDragOver = reactive({
alipay: false,
wechat: false,
})
const paymentQrLocalPreview = reactive<Record<PaymentReceiveQrChannel, string>>({
alipay: '',
wechat: '',
})
const paymentQrCards = computed(() => [ const paymentQrCards = computed(() => [
{ {
channel: 'alipay' as PaymentReceiveQrChannel, channel: 'alipay' as PaymentReceiveQrChannel,
title: t('system.otherConfig.paymentQr.alipay'), title: t('system.otherConfig.paymentQr.alipay'),
url: paymentQrUrls.alipay, url: paymentQrLocalPreview.alipay || paymentQrUrls.alipay,
uploading: paymentQrUploading.alipay, uploading: paymentQrUploading.alipay,
}, },
{ {
channel: 'wechat' as PaymentReceiveQrChannel, channel: 'wechat' as PaymentReceiveQrChannel,
title: t('system.otherConfig.paymentQr.wechat'), title: t('system.otherConfig.paymentQr.wechat'),
url: paymentQrUrls.wechat, url: paymentQrLocalPreview.wechat || paymentQrUrls.wechat,
uploading: paymentQrUploading.wechat, uploading: paymentQrUploading.wechat,
}, },
]) ])
function applyPaymentQrDto(data?: { alipayUrl?: string; wechatUrl?: string } | null) { function applyPaymentQrDto(
const stamp = Date.now() data?: {
const alipay = resolveOmsAssetUrl(data?.alipayUrl) alipayUrl?: string
const wechat = resolveOmsAssetUrl(data?.wechatUrl) wechatUrl?: string
paymentQrUrls.alipay = alipay ? `${alipay}${alipay.includes('?') ? '&' : '?'}_t=${stamp}` : '' AlipayUrl?: string
paymentQrUrls.wechat = wechat ? `${wechat}${wechat.includes('?') ? '&' : '?'}_t=${stamp}` : '' WechatUrl?: string
} | null,
) {
const row = (data || {}) as Record<string, any>
paymentQrUrls.alipay = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'alipayUrl', 'AlipayUrl'))
paymentQrUrls.wechat = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'wechatUrl', 'WechatUrl'))
} }
async function loadPaymentQr() { async function loadPaymentQr() {
@ -1108,53 +1188,80 @@ const brandLogoUploading = reactive({
favicon: false, favicon: false,
mascot: false, mascot: false,
}) })
const brandLogoDragOver = reactive({
portal: false,
site: false,
favicon: false,
mascot: false,
})
const brandLogoLocalPreview = reactive<Record<BrandLogoChannel, string>>({
portal: '',
site: '',
favicon: '',
mascot: '',
})
const brandLogoCards = computed(() => [ const brandLogoCards = computed(() => [
{ {
channel: 'portal' as BrandLogoChannel, channel: 'portal' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.portal'), title: t('system.otherConfig.brandLogo.portal'),
sizeHint: t('system.otherConfig.brandLogo.size.portal'), sizeHint: t('system.otherConfig.brandLogo.size.portal'),
url: brandLogoUrls.portal, url: brandLogoLocalPreview.portal || brandLogoUrls.portal,
uploading: brandLogoUploading.portal, uploading: brandLogoUploading.portal,
}, },
{ {
channel: 'site' as BrandLogoChannel, channel: 'site' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.site'), title: t('system.otherConfig.brandLogo.site'),
sizeHint: t('system.otherConfig.brandLogo.size.site'), sizeHint: t('system.otherConfig.brandLogo.size.site'),
url: brandLogoUrls.site, url: brandLogoLocalPreview.site || brandLogoUrls.site,
uploading: brandLogoUploading.site, uploading: brandLogoUploading.site,
}, },
{ {
channel: 'favicon' as BrandLogoChannel, channel: 'favicon' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.favicon'), title: t('system.otherConfig.brandLogo.favicon'),
sizeHint: t('system.otherConfig.brandLogo.size.favicon'), sizeHint: t('system.otherConfig.brandLogo.size.favicon'),
url: brandLogoUrls.favicon, url: brandLogoLocalPreview.favicon || brandLogoUrls.favicon,
uploading: brandLogoUploading.favicon, uploading: brandLogoUploading.favicon,
}, },
{ {
channel: 'mascot' as BrandLogoChannel, channel: 'mascot' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.mascot'), title: t('system.otherConfig.brandLogo.mascot'),
sizeHint: t('system.otherConfig.brandLogo.size.mascot'), sizeHint: t('system.otherConfig.brandLogo.size.mascot'),
url: brandLogoUrls.mascot, url: brandLogoLocalPreview.mascot || brandLogoUrls.mascot,
uploading: brandLogoUploading.mascot, uploading: brandLogoUploading.mascot,
}, },
]) ])
function pickBrandLogoUrl(data: Record<string, any> | null | undefined, camel: string, pascal: string) {
const raw = data?.[camel] ?? data?.[pascal]
return typeof raw === 'string' ? raw : ''
}
/** 已签名 COS/OSS URL 勿再追加缓存戳,否则验签失败图片空白 */
function resolveBrandLogoDisplayUrl(raw?: string | null) {
const url = resolveOmsAssetUrl(raw)
if (!url) return ''
if (/[?&](q-sign-algorithm|x-oss-signature|Signature)=/i.test(url)) {
return url
}
return `${url}${url.includes('?') ? '&' : '?'}_t=${Date.now()}`
}
function applyBrandLogoDto(data?: { function applyBrandLogoDto(data?: {
portalUrl?: string portalUrl?: string
siteUrl?: string siteUrl?: string
faviconUrl?: string faviconUrl?: string
mascotUrl?: string mascotUrl?: string
PortalUrl?: string
SiteUrl?: string
FaviconUrl?: string
MascotUrl?: string
} | null) { } | null) {
const stamp = Date.now() const row = (data || {}) as Record<string, any>
const stampUrl = (raw?: string) => { brandLogoUrls.portal = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'portalUrl', 'PortalUrl'))
const url = resolveOmsAssetUrl(raw) brandLogoUrls.site = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'siteUrl', 'SiteUrl'))
return url ? `${url}${url.includes('?') ? '&' : '?'}_t=${stamp}` : '' brandLogoUrls.favicon = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'faviconUrl', 'FaviconUrl'))
} brandLogoUrls.mascot = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'mascotUrl', 'MascotUrl'))
brandLogoUrls.portal = stampUrl(data?.portalUrl)
brandLogoUrls.site = stampUrl(data?.siteUrl)
brandLogoUrls.favicon = stampUrl(data?.faviconUrl)
brandLogoUrls.mascot = stampUrl(data?.mascotUrl)
} }
async function loadBrandLogo() { async function loadBrandLogo() {
@ -1256,52 +1363,194 @@ async function handleWechatTrial(eventCode: string) {
} }
} }
async function handlePaymentQrUpload(channel: PaymentReceiveQrChannel, option: any) { function revokePaymentQrLocalPreview(channel: PaymentReceiveQrChannel) {
const file: File | undefined = option?.fileItem?.file ?? option?.file const prev = paymentQrLocalPreview[channel]
if (!file) { if (prev && prev.startsWith('blob:')) {
option?.onError?.(new Error('no file')) URL.revokeObjectURL(prev)
}
paymentQrLocalPreview[channel] = ''
}
function setPaymentQrLocalPreview(channel: PaymentReceiveQrChannel, file: File) {
revokePaymentQrLocalPreview(channel)
paymentQrLocalPreview[channel] = URL.createObjectURL(file)
}
function openPaymentQrPicker(channel: PaymentReceiveQrChannel) {
if (paymentQrUploading[channel]) return
document
.querySelector<HTMLInputElement>(`.brand-logo-card__file[data-channel="qr-${channel}"]`)
?.click()
}
function onPaymentQrDragEnter(channel: PaymentReceiveQrChannel) {
if (paymentQrUploading[channel]) return
paymentQrDragOver[channel] = true
}
function onPaymentQrDragLeave(channel: PaymentReceiveQrChannel, e: DragEvent) {
const current = e.currentTarget as HTMLElement | null
const related = e.relatedTarget as Node | null
if (current && related && current.contains(related)) return
paymentQrDragOver[channel] = false
}
function onPaymentQrDrop(channel: PaymentReceiveQrChannel, e: DragEvent) {
paymentQrDragOver[channel] = false
if (paymentQrUploading[channel]) return
const file = e.dataTransfer?.files?.[0]
if (!isBrandLogoImageFile(file)) {
Message.warning(t('system.otherConfig.paymentQr.invalidFile'))
return return
} }
void uploadPaymentQrFile(channel, file)
}
function onPaymentQrFileChange(channel: PaymentReceiveQrChannel, e: Event) {
const input = e.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!isBrandLogoImageFile(file)) {
if (file) Message.warning(t('system.otherConfig.paymentQr.invalidFile'))
return
}
void uploadPaymentQrFile(channel, file)
}
async function uploadPaymentQrFile(channel: PaymentReceiveQrChannel, file: File) {
setPaymentQrLocalPreview(channel, file)
paymentQrUploading[channel] = true paymentQrUploading[channel] = true
try { try {
const data = await uploadPaymentReceiveQr(channel, file) const data = await uploadPaymentReceiveQr(channel, file)
applyPaymentQrDto(data) applyPaymentQrDto(data)
option?.onSuccess?.(data) revokePaymentQrLocalPreview(channel)
Message.success(t('system.otherConfig.paymentQr.uploadSuccess')) Message.success(t('system.otherConfig.paymentQr.uploadSuccess'))
} catch (e: any) { } catch (e: any) {
option?.onError?.(e)
Message.error(e?.message || t('system.otherConfig.paymentQr.uploadFailed')) Message.error(e?.message || t('system.otherConfig.paymentQr.uploadFailed'))
} finally { } finally {
paymentQrUploading[channel] = false paymentQrUploading[channel] = false
} }
} }
async function handleBrandLogoUpload(channel: BrandLogoChannel, option: any) { async function handlePaymentQrClear(channel: PaymentReceiveQrChannel) {
const file: File | undefined = option?.fileItem?.file ?? option?.file paymentQrUploading[channel] = true
if (!file) { try {
option?.onError?.(new Error('no file')) const data = await clearPaymentReceiveQr(channel)
revokePaymentQrLocalPreview(channel)
applyPaymentQrDto(data)
Message.success(t('system.otherConfig.paymentQr.clearSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.paymentQr.clearFailed'))
} finally {
paymentQrUploading[channel] = false
}
}
function revokeBrandLogoLocalPreview(channel: BrandLogoChannel) {
const prev = brandLogoLocalPreview[channel]
if (prev && prev.startsWith('blob:')) {
URL.revokeObjectURL(prev)
}
brandLogoLocalPreview[channel] = ''
}
function setBrandLogoLocalPreview(channel: BrandLogoChannel, file: File) {
revokeBrandLogoLocalPreview(channel)
brandLogoLocalPreview[channel] = URL.createObjectURL(file)
}
function isBrandLogoImageFile(file: File | null | undefined): file is File {
if (!file) return false
if (file.type && file.type.startsWith('image/')) return true
return /\.(png|jpe?g|webp|gif|bmp)$/i.test(file.name || '')
}
function openBrandLogoPicker(channel: BrandLogoChannel) {
if (brandLogoUploading[channel]) return
const fileInput = document.querySelector<HTMLInputElement>(
`.brand-logo-card__file[data-channel="${channel}"]`,
)
fileInput?.click()
}
function onBrandLogoDragEnter(channel: BrandLogoChannel) {
if (brandLogoUploading[channel]) return
brandLogoDragOver[channel] = true
}
function onBrandLogoDragLeave(channel: BrandLogoChannel, e: DragEvent) {
const current = e.currentTarget as HTMLElement | null
const related = e.relatedTarget as Node | null
if (current && related && current.contains(related)) return
brandLogoDragOver[channel] = false
}
function onBrandLogoDrop(channel: BrandLogoChannel, e: DragEvent) {
brandLogoDragOver[channel] = false
if (brandLogoUploading[channel]) return
const file = e.dataTransfer?.files?.[0]
if (!isBrandLogoImageFile(file)) {
Message.warning(t('system.otherConfig.brandLogo.invalidFile'))
return return
} }
void uploadBrandLogoFile(channel, file)
}
function onBrandLogoFileChange(channel: BrandLogoChannel, e: Event) {
const input = e.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!isBrandLogoImageFile(file)) {
if (file) Message.warning(t('system.otherConfig.brandLogo.invalidFile'))
return
}
void uploadBrandLogoFile(channel, file)
}
async function uploadBrandLogoFile(channel: BrandLogoChannel, file: File) {
setBrandLogoLocalPreview(channel, file)
brandLogoUploading[channel] = true brandLogoUploading[channel] = true
try { try {
const data = await uploadBrandLogo(channel, file) const data = await uploadBrandLogo(channel, file)
applyBrandLogoDto(data) applyBrandLogoDto(data)
if (channel === 'favicon' || data?.faviconUrl) { revokeBrandLogoLocalPreview(channel)
applyDocumentFavicon(brandLogoUrls.favicon || data?.faviconUrl) if (channel === 'favicon') {
applyDocumentFavicon(brandLogoUrls.favicon || pickBrandLogoUrl(data as any, 'faviconUrl', 'FaviconUrl'))
} }
if (channel === 'mascot' || data?.mascotUrl) { if (channel === 'mascot') {
applyAppMascot(resolveOmsAssetUrl(data?.mascotUrl) || brandLogoUrls.mascot) applyAppMascot(
resolveOmsAssetUrl(pickBrandLogoUrl(data as any, 'mascotUrl', 'MascotUrl')) ||
brandLogoUrls.mascot,
)
} }
option?.onSuccess?.(data)
Message.success(t('system.otherConfig.brandLogo.uploadSuccess')) Message.success(t('system.otherConfig.brandLogo.uploadSuccess'))
} catch (e: any) { } catch (e: any) {
option?.onError?.(e)
Message.error(e?.message || t('system.otherConfig.brandLogo.uploadFailed')) Message.error(e?.message || t('system.otherConfig.brandLogo.uploadFailed'))
} finally { } finally {
brandLogoUploading[channel] = false brandLogoUploading[channel] = false
} }
} }
async function handleBrandLogoClear(channel: BrandLogoChannel) {
brandLogoUploading[channel] = true
try {
const data = await clearBrandLogo(channel)
revokeBrandLogoLocalPreview(channel)
applyBrandLogoDto(data)
if (channel === 'favicon') {
applyDocumentFavicon('')
}
if (channel === 'mascot') {
applyAppMascot('')
}
Message.success(t('system.otherConfig.brandLogo.clearSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.clearFailed'))
} finally {
brandLogoUploading[channel] = false
}
}
async function handleSave() { async function handleSave() {
if (!editingId.value) return if (!editingId.value) return
try { try {
@ -1809,49 +2058,6 @@ onMounted(() => {
min-height: 220px; min-height: 220px;
} }
.payment-qr-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.payment-qr-card {
display: flex;
flex-direction: column;
gap: 12px;
padding: 12px;
border: 1px solid var(--color-border-2);
border-radius: 8px;
background: #fff;
}
.payment-qr-card__head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
}
.payment-qr-card__title {
font-size: 14px;
font-weight: 600;
color: var(--color-text-1);
}
.payment-qr-card__preview {
display: flex;
align-items: center;
justify-content: center;
min-height: 220px;
background: var(--color-fill-1, #f7f8fa);
border-radius: 6px;
}
.payment-qr-card__empty {
color: var(--color-text-3);
font-size: 13px;
}
.brand-logo-grid { .brand-logo-grid {
display: grid; display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
@ -1870,9 +2076,18 @@ onMounted(() => {
} }
.brand-logo-card__meta { .brand-logo-card__meta {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
min-width: 0;
}
.brand-logo-card__meta-text {
display: grid; display: grid;
gap: 4px; gap: 4px;
min-width: 0; min-width: 0;
flex: 1;
} }
.brand-logo-card__title { .brand-logo-card__title {
@ -1888,6 +2103,11 @@ onMounted(() => {
color: var(--color-text-3); color: var(--color-text-3);
} }
.brand-logo-card__clear {
flex-shrink: 0;
margin-top: -2px;
}
.brand-logo-card__upload { .brand-logo-card__upload {
width: 100%; width: 100%;
flex: 1; flex: 1;
@ -1914,13 +2134,13 @@ onMounted(() => {
justify-content: center; justify-content: center;
gap: 8px; gap: 8px;
width: 100%; width: 100%;
min-height: 200px; min-height: 148px;
padding: 20px; padding: 16px;
border: 1px dashed var(--color-border-3, #c9cdd4); border: 1px dashed var(--color-border-3, #c9cdd4);
border-radius: 8px; border-radius: 8px;
background: var(--color-fill-1, #f7f8fa); background: var(--color-fill-1, #f7f8fa);
cursor: pointer;
overflow: hidden; overflow: hidden;
cursor: pointer;
transition: transition:
border-color 0.15s ease, border-color 0.15s ease,
background-color 0.15s ease; background-color 0.15s ease;
@ -1935,42 +2155,42 @@ onMounted(() => {
background: #fff; background: #fff;
} }
&.is-dragover {
border-color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
}
&.is-uploading { &.is-uploading {
cursor: wait; cursor: wait;
pointer-events: none;
} }
} }
.brand-logo-card__file {
position: absolute;
width: 0;
height: 0;
opacity: 0;
pointer-events: none;
}
.brand-logo-card__img { .brand-logo-card__img {
max-width: 100%; max-width: 100%;
max-height: 148px; max-height: 120px;
object-fit: contain; object-fit: contain;
display: block; display: block;
} }
.brand-logo-card__mask { .brand-logo-card__img--qr {
position: absolute; max-height: 200px;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
background: rgba(0, 0, 0, 0.45);
color: #fff;
font-size: 13px;
opacity: 0;
transition: opacity 0.15s ease;
} }
.brand-logo-card__zone.is-filled:hover .brand-logo-card__mask { .brand-logo-card__mark {
opacity: 1; font-size: 22px;
} font-weight: 700;
letter-spacing: 0.12em;
.brand-logo-card__plus {
font-size: 28px;
line-height: 1; line-height: 1;
font-weight: 300; color: var(--color-text-3, #86909c);
color: var(--color-text-3); user-select: none;
} }
.brand-logo-card__hint { .brand-logo-card__hint {
@ -1979,8 +2199,32 @@ onMounted(() => {
text-align: center; text-align: center;
} }
.brand-logo-card__mask {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 8px;
background: rgba(0, 0, 0, 0.45);
color: #fff;
font-size: 13px;
opacity: 0;
transition: opacity 0.15s ease;
pointer-events: none;
&.is-busy {
opacity: 1;
}
}
.brand-logo-card__zone.is-filled:hover .brand-logo-card__mask {
opacity: 1;
}
@media (max-width: 720px) { @media (max-width: 720px) {
.payment-qr-grid,
.brand-logo-grid { .brand-logo-grid {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }

View File

@ -223,8 +223,10 @@ export default defineConfig(({ mode }) => {
secure: false, secure: false,
}, },
// 仅开发:同源代理 COS(生产无 /__cos__,走 file-storage/stream) // 仅开发:同源代理 COS(生产无 /__cos__,走 file-storage/stream)
// 必须走 https:自定义域 http 会 302 到 https,浏览器跟随后因证书主机名不匹配,img 直接空白。
// secure:false 让代理忽略该证书,页面只请求 localhost。
'/__cos__': { '/__cos__': {
target: 'http://cos.ideship.com', target: 'https://cos.ideship.com',
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
xfwd: false, xfwd: false,
@ -233,7 +235,7 @@ export default defineConfig(({ mode }) => {
router: (req) => { router: (req) => {
const raw = String(req.originalUrl || req.url || '').split('?')[0]; const raw = String(req.originalUrl || req.url || '').split('?')[0];
const host = raw.replace(/^\/__cos__\//, '').split('/')[0]; const host = raw.replace(/^\/__cos__\//, '').split('/')[0];
return host ? `http://${host}` : 'http://cos.ideship.com'; return host ? `https://${host}` : 'https://cos.ideship.com';
}, },
rewrite: (path) => path.replace(/^\/__cos__\/[^/]+/, '') || '/', rewrite: (path) => path.replace(/^\/__cos__\/[^/]+/, '') || '/',
configure: (proxy) => { configure: (proxy) => {