fix: 本地品牌图可显示,未配置时不再露出文字 LOGO
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m2s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-11-19 19:52:49 +08:00
parent a7993c12b6
commit a21b2f5813
10 changed files with 63 additions and 151 deletions

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 绝对前缀) */
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

View File

@ -39,29 +39,23 @@ body {
-moz-osx-font-smoothing: grayscale;
}
/* 全局空态:未配置吉祥物显示文字 LOGO;有配置用图片 */
/* 全局空态:未配置吉祥物时不占位;有配置才显示图片 */
.arco-empty-image {
.arco-icon {
display: none !important;
}
}
&::after {
content: 'LOGO';
display: block;
margin: 0 auto;
font-size: 18px;
font-weight: 700;
letter-spacing: 0.08em;
line-height: 1;
color: var(--color-text-3, #86909c);
opacity: 0.55;
}
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;

View File

@ -1,5 +1,9 @@
<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
v-if="appMascotUrl"
class="app-mascot-state__img"
@ -9,14 +13,6 @@
decoding="async"
draggable="false"
/>
<span
v-else
class="app-mascot-state__text"
:class="{ 'is-bounce': mode === 'loading' }"
aria-hidden="true"
>
{{ BRAND_TEXT_LOGO }}
</span>
<p v-if="description" class="app-mascot-state__desc">{{ description }}</p>
<div v-if="$slots.default" class="app-mascot-state__extra">
<slot />
@ -25,7 +21,7 @@
</template>
<script lang="ts" setup>
import { appMascotUrl, BRAND_TEXT_LOGO } from '@/utils/brandLogo'
import { appMascotUrl } from '@/utils/brandLogo'
withDefaults(
defineProps<{
@ -61,10 +57,6 @@ withDefaults(
width: 56px;
height: auto;
}
.app-mascot-state__text {
font-size: 18px;
}
}
&.is-empty .app-mascot-state__img {
@ -73,17 +65,9 @@ withDefaults(
opacity: 0.78;
}
&.is-empty .app-mascot-state__text {
opacity: 0.55;
}
&.is-empty.is-compact .app-mascot-state__img {
width: 28px;
}
&.is-empty.is-compact .app-mascot-state__text {
font-size: 14px;
}
}
.app-mascot-state__img {
@ -98,20 +82,6 @@ withDefaults(
}
}
.app-mascot-state__text {
display: block;
font-size: 28px;
font-weight: 700;
letter-spacing: 0.08em;
line-height: 1;
color: var(--color-text-3, #86909c);
pointer-events: none;
&.is-bounce {
animation: app-mascot-bounce 1.4s ease-in-out infinite;
}
}
.app-mascot-state__desc {
margin: 0;
max-width: 320px;
@ -140,8 +110,7 @@ withDefaults(
}
@media (prefers-reduced-motion: reduce) {
.app-mascot-state__img.is-bounce,
.app-mascot-state__text.is-bounce {
.app-mascot-state__img.is-bounce {
animation: none;
}
}

View File

@ -16,8 +16,7 @@
} from './filterValue';
import { enrichHybridColumn } from './hybridHeader';
import { useAppStore } from '@/store';
import { appMascotUrl as emptyMascotSrc, BRAND_TEXT_LOGO } from '@/utils/brandLogo';
const emptyTextLogo = BRAND_TEXT_LOGO;
import { appMascotUrl as emptyMascotSrc } from '@/utils/brandLogo';
const appStore = useAppStore();
/** Handsontable classic 浅/深主题:随页面日夜模式切换,否则列表区会被主题 CSS 锁成白底 */
@ -2889,11 +2888,6 @@
alt=""
draggable="false"
/>
<span
v-else
class="handsontable-empty-overlay__text-logo"
aria-hidden="true"
>{{ emptyTextLogo }}</span>
<p v-if="emptyOverlayText" class="handsontable-empty-overlay__text">{{ emptyOverlayText }}</p>
<div v-if="$slots.emptyExtra" class="handsontable-empty-overlay__extra">
<slot name="emptyExtra" />
@ -2974,16 +2968,6 @@
opacity: 0.78;
}
.handsontable-empty-overlay__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;
}
.handsontable-empty-overlay__text {
margin: 0;
font-size: 13px;

View File

@ -19,9 +19,8 @@
import { isFunction } from 'lodash';
import FormPro from '@/components/FormPro/index.vue';
import { $baseMessage } from '@/utils';
import { appMascotUrl, BRAND_TEXT_LOGO } from '@/utils/brandLogo';
import { appMascotUrl } from '@/utils/brandLogo';
const emptyImage = appMascotUrl;
const emptyTextLogo = BRAND_TEXT_LOGO;
import type { TableProMethods } from './types';
const { t } = useI18n();
@ -886,7 +885,6 @@
class="empty-mascot"
draggable="false"
/>
<span v-else class="empty-text-logo" aria-hidden="true">{{ emptyTextLogo }}</span>
<div class="empty-text">暂无数据</div>
</div>
</template>
@ -993,15 +991,6 @@
opacity: 0.78;
}
.empty-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;
}
}
.empty-text {

View File

@ -2,15 +2,18 @@
<div id="top-nav" class="top-nav" :class="{ tabNavEnable: tabNavEnable }">
<div class="top-nav-header">
<!-- Logo 区域:点击跳转官网首页 -->
<a class="top-nav-logo" href="/" :title="t('brand.fullName')" @click="goOfficialSite">
<template v-if="navLogoSrc">
<img :src="navLogoSrc" :alt="t('brand.name')" />
<div class="top-nav-logo__brand">
<span class="top-nav-logo__name">{{ t('brand.name') }}</span>
<span class="top-nav-logo__full">{{ t('brand.fullName') }}</span>
</div>
</template>
<span v-else class="top-nav-logo__mark" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<a
v-if="navLogoSrc"
class="top-nav-logo"
href="/"
:title="t('brand.fullName')"
@click="goOfficialSite"
>
<img :src="navLogoSrc" :alt="t('brand.name')" />
<div class="top-nav-logo__brand">
<span class="top-nav-logo__name">{{ t('brand.name') }}</span>
<span class="top-nav-logo__full">{{ t('brand.fullName') }}</span>
</div>
</a>
<!-- 顶部水平菜单:磁吸滑块 + 极速 hover 下拉 -->
@ -285,11 +288,7 @@ import { Message } from '@arco-design/web-vue';
import { openWindow, regexUrl } from '@/utils';
import { MenuService, AuthService } from '@/api/rbac';
import type { MenuTreeDto } from '@/api/rbac';
import {
applyDocumentFavicon,
BRAND_TEXT_LOGO,
loadBrandLogoUrls,
} from '@/utils/brandLogo';
import { applyDocumentFavicon, loadBrandLogoUrls } from '@/utils/brandLogo';
import {
initHiprintClientState,
setHiprintClientEnabled,
@ -1405,18 +1404,6 @@ onUnmounted(() => {
}
}
.top-nav-logo__mark {
display: inline-flex;
align-items: center;
justify-content: center;
height: 36px;
font-size: 18px;
font-weight: 700;
letter-spacing: 0.12em;
color: rgba(255, 255, 255, 0.78);
user-select: none;
}
.top-nav-logo__brand {
display: flex;
flex-direction: column;

View File

@ -1,17 +1,14 @@
<template>
<div class="login-brand" aria-hidden="true">
<template v-if="logoSrc">
<img class="login-brand__img" :src="logoSrc" alt="" draggable="false" />
<span class="login-brand__name">{{ t('brand.name') }}</span>
</template>
<span v-else class="login-brand__mark">{{ BRAND_TEXT_LOGO }}</span>
<div v-if="logoSrc" class="login-brand" aria-hidden="true">
<img class="login-brand__img" :src="logoSrc" alt="" draggable="false" />
<span class="login-brand__name">{{ t('brand.name') }}</span>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { BRAND_TEXT_LOGO, fetchBrandLogoUrlsPublic } from '@/utils/brandLogo';
import { fetchBrandLogoUrlsPublic } from '@/utils/brandLogo';
defineOptions({ name: 'LoginLockLogo' });
@ -40,16 +37,6 @@ void fetchBrandLogoUrlsPublic().then((urls) => {
object-fit: contain;
}
.login-brand__mark {
display: block;
font-size: 28px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1;
color: #86909c;
user-select: none;
}
.login-brand__name {
font-size: 24px;
font-weight: 700;

View File

@ -1,15 +1,17 @@
<template>
<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">
<a href="/" class="logo d-flex align-items-center" @click="$emit('home')">
<template v-if="siteLogoSrc">
<img :src="siteLogoSrc" alt="BCD logo" width="40" height="40" />
<span class="brand-lockup">
<h1>BCD</h1>
<small class="brand-fullname">Business & Customer & Delivery</small>
</span>
</template>
<span v-else class="logo-mark" aria-hidden="true">{{ BRAND_TEXT_LOGO }}</span>
<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" />
<span class="brand-lockup">
<h1>BCD</h1>
<small class="brand-fullname">Business & Customer & Delivery</small>
</span>
</a>
<button
@ -120,11 +122,7 @@
<script lang="ts" setup>
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import {
applyDocumentFavicon,
BRAND_TEXT_LOGO,
fetchBrandLogoUrlsPublic,
} from '@/utils/brandLogo';
import { applyDocumentFavicon, fetchBrandLogoUrlsPublic } from '@/utils/brandLogo';
import { useUserStore } from '@/store';
import { useRbacUserStore } from '@/store/modules/rbac-user';
import { applyRbacUserToUserStore } from '@/utils/enter-system';

View File

@ -55,19 +55,6 @@ body.command-home {
margin-right: 8px;
}
.header .logo .logo-mark {
display: inline-flex;
align-items: center;
justify-content: center;
height: 40px;
font-size: 22px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1;
color: var(--kc-secondary, #86909c);
user-select: none;
}
.header .logo h1 {
margin: 0;
color: var(--kc-primary);

View File

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