feat(frontend): 拆分双站点品牌与主题层

This commit is contained in:
yml
2026-11-16 20:03:00 +08:00
parent ac9717a5d8
commit 4f8edce1cf
95 changed files with 1831 additions and 1062 deletions
+40
View File
@@ -0,0 +1,40 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useDistributionSiteStore } from '@/stores/distributionSite'
import { siteBrands } from '.'
import type { BrandLogoVariant } from './types'
const props = withDefaults(
defineProps<{
height?: number
variant?: BrandLogoVariant
}>(),
{ height: 40, variant: 'seal' }
)
const siteStore = useDistributionSiteStore()
const brand = computed(() => siteBrands[siteStore.siteKey])
const source = computed(() => {
return siteStore.logoUrl || brand.value.logos[props.variant] || ''
})
</script>
<template>
<img
v-if="source"
:src="source"
:alt="`${brand.name} Logo`"
class="site-brand-logo"
:style="{ height: `${height}px` }"
/>
<span
v-else
class="site-brand-mark"
:style="{ height: `${height}px`, minWidth: `${height}px` }"
aria-hidden="true"
>
{{ brand.mark }}
</span>
</template>
@@ -0,0 +1,17 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useDistributionSiteStore } from '@/stores/distributionSite'
import DachuiMobileBottomNav from './dachui/MobileBottomNav.vue'
import JieyouMobileBottomNav from './jieyou/MobileBottomNav.vue'
const siteStore = useDistributionSiteStore()
const component = computed(() =>
siteStore.siteKey === 'jieyou' ? JieyouMobileBottomNav : DachuiMobileBottomNav
)
</script>
<template>
<component :is="component" />
</template>
@@ -0,0 +1,137 @@
<script setup lang="ts">
import { RouterLink, useRoute } from 'vue-router'
import { useChatUnreadCount } from '@/features/chats/composables/useChatUnreadCount'
const route = useRoute()
const { unreadCount, unreadLabel } = useChatUnreadCount(route)
function isNavActive(path: string) {
if (path === '/m') return route.path === '/m'
if (path === '/m/orders') {
return route.path.startsWith('/m/orders') || route.path.startsWith('/m/crash/orders')
}
return route.path.startsWith(path)
}
</script>
<template>
<nav class="bottom-nav dachui-bottom-nav">
<RouterLink to="/m" class="nav-item" :class="{ active: isNavActive('/m') }">
<van-icon name="home-o" :size="22" />
<span>首页</span>
</RouterLink>
<RouterLink to="/m/messages" class="nav-item" :class="{ active: isNavActive('/m/messages') }">
<span class="nav-icon-wrap">
<van-icon name="chat-o" :size="22" />
<em v-if="unreadCount > 0" class="nav-badge">{{ unreadLabel }}</em>
</span>
<span>消息</span>
</RouterLink>
<RouterLink to="/m/seller/listings/create" class="nav-item nav-publish">
<div class="publish-pill">+</div>
<span>发布</span>
</RouterLink>
<RouterLink to="/m/orders" class="nav-item" :class="{ active: isNavActive('/m/orders') }">
<van-icon name="orders-o" :size="22" />
<span>订单</span>
</RouterLink>
<RouterLink to="/m/profile" class="nav-item" :class="{ active: isNavActive('/m/profile') }">
<van-icon name="manager-o" :size="22" />
<span>我的</span>
</RouterLink>
</nav>
</template>
<style scoped>
.bottom-nav {
position: fixed;
right: 0;
bottom: -1px;
left: 0;
z-index: 100;
display: flex;
height: calc(52px + env(safe-area-inset-bottom));
box-sizing: border-box;
border-top: 1px solid #eee;
background: var(--brand-surface);
padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav::after {
position: absolute;
right: 0;
bottom: -18px;
left: 0;
height: 18px;
background: var(--brand-surface);
content: '';
}
.nav-item {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
color: #999;
font-size: 10px;
text-decoration: none;
}
.nav-item.active,
.nav-publish span {
color: var(--brand-primary);
}
.nav-item span {
font-weight: 600;
}
.nav-icon-wrap {
position: relative;
display: grid;
width: 24px;
height: 24px;
place-items: center;
}
.nav-badge {
position: absolute;
top: -5px;
right: -10px;
min-width: 16px;
height: 16px;
padding: 0 4px;
box-sizing: border-box;
border: 2px solid var(--brand-surface);
border-radius: 999px;
background: #ef4444;
color: #fff;
font-size: 10px;
font-style: normal;
font-weight: 800;
line-height: 12px;
text-align: center;
}
.publish-pill {
display: grid;
width: 36px;
height: 26px;
place-items: center;
border-radius: 13px;
background: var(--brand-primary);
color: var(--brand-on-primary);
font-size: 18px;
font-weight: 900;
}
@media (min-width: 520px) {
.bottom-nav {
right: calc((100vw - 430px) / 2);
left: calc((100vw - 430px) / 2);
}
}
</style>
+17
View File
@@ -0,0 +1,17 @@
import { defaultStorefrontText } from '@/shared/utils/storefrontText'
import type { SiteBrand } from '../types'
export const dachuiSite: SiteBrand = {
key: 'dachui',
name: '大锤商行',
mark: '锤',
themeColor: '#ff6a00',
favicon: '',
storefrontText: defaultStorefrontText,
logos: {
light: '',
dark: '',
seal: '',
},
}
+20
View File
@@ -0,0 +1,20 @@
:root,
html[data-site='dachui'] {
--brand-primary: #ff6a00;
--brand-primary-rgb: 255 106 0;
--brand-primary-hover: #ff8533;
--brand-primary-light: #ff914d;
--brand-primary-strong: #ff5200;
--brand-primary-soft: #fff3e8;
--brand-on-primary: #ffffff;
--brand-accent: #f59e0b;
--brand-canvas: #f6f8fb;
--brand-surface: #ffffff;
--brand-surface-muted: #f2f5f9;
--brand-ink: #17233d;
--brand-muted: #64748b;
--brand-border: #fed7aa;
--brand-shadow: rgb(255 106 0 / 0.24);
--brand-font-body: Inter, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
--brand-font-display: Inter, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}
+19
View File
@@ -0,0 +1,19 @@
import { dachuiSite } from './dachui'
import { jieyouSite } from './jieyou'
import type { SiteBrand, SiteKey } from './types'
export const siteBrands: Record<SiteKey, SiteBrand> = {
dachui: dachuiSite,
jieyou: jieyouSite,
}
export function resolveSiteKey(tenantCode?: string): SiteKey {
return (tenantCode || '').trim().toLowerCase() === 'jieyou' ? 'jieyou' : 'dachui'
}
export function siteBrandFor(tenantCode?: string): SiteBrand {
return siteBrands[resolveSiteKey(tenantCode)]
}
export type { BrandLogoVariant, SiteBrand, SiteKey } from './types'
@@ -0,0 +1,144 @@
<script setup lang="ts">
import { RouterLink, useRoute } from 'vue-router'
import { useChatUnreadCount } from '@/features/chats/composables/useChatUnreadCount'
const route = useRoute()
const { unreadCount, unreadLabel } = useChatUnreadCount(route)
function isNavActive(path: string) {
if (path === '/m') return route.path === '/m'
if (path === '/m/orders') {
return route.path.startsWith('/m/orders') || route.path.startsWith('/m/crash/orders')
}
return route.path.startsWith(path)
}
</script>
<template>
<nav class="bottom-nav jieyou-bottom-nav">
<RouterLink to="/m" class="nav-item" :class="{ active: isNavActive('/m') }">
<van-icon name="home-o" :size="22" />
<span>首页</span>
</RouterLink>
<RouterLink to="/m/messages" class="nav-item" :class="{ active: isNavActive('/m/messages') }">
<span class="nav-icon-wrap">
<van-icon name="chat-o" :size="22" />
<em v-if="unreadCount > 0" class="nav-badge">{{ unreadLabel }}</em>
</span>
<span>消息</span>
</RouterLink>
<RouterLink to="/m/seller/listings/create" class="nav-item nav-publish">
<div class="publish-seal">发</div>
<span>发布</span>
</RouterLink>
<RouterLink to="/m/orders" class="nav-item" :class="{ active: isNavActive('/m/orders') }">
<van-icon name="orders-o" :size="22" />
<span>订单</span>
</RouterLink>
<RouterLink to="/m/profile" class="nav-item" :class="{ active: isNavActive('/m/profile') }">
<van-icon name="manager-o" :size="22" />
<span>我的</span>
</RouterLink>
</nav>
</template>
<style scoped>
.bottom-nav {
position: fixed;
right: 0;
bottom: -1px;
left: 0;
z-index: 100;
display: flex;
height: calc(54px + env(safe-area-inset-bottom));
box-sizing: border-box;
border-top: 1px solid var(--brand-border);
background: var(--brand-surface);
padding-bottom: env(safe-area-inset-bottom);
box-shadow: 0 -8px 24px rgb(30 77 66 / 0.05);
}
.bottom-nav::after {
position: absolute;
right: 0;
bottom: -18px;
left: 0;
height: 18px;
background: var(--brand-surface);
content: '';
}
.nav-item {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
color: #8a938f;
font-family: var(--brand-font-display);
font-size: 10px;
text-decoration: none;
}
.nav-item.active,
.nav-publish span {
color: var(--brand-primary-strong);
}
.nav-item span {
font-weight: 700;
letter-spacing: 0.08em;
}
.nav-icon-wrap {
position: relative;
display: grid;
width: 24px;
height: 24px;
place-items: center;
}
.nav-badge {
position: absolute;
top: -5px;
right: -10px;
min-width: 16px;
height: 16px;
padding: 0 4px;
box-sizing: border-box;
border: 2px solid var(--brand-surface);
border-radius: 999px;
background: var(--brand-primary);
color: var(--brand-on-primary);
font-size: 10px;
font-style: normal;
font-weight: 800;
line-height: 12px;
text-align: center;
}
.publish-seal {
display: grid;
width: 32px;
height: 32px;
place-items: center;
border: 1px solid rgb(255 253 248 / 0.72);
border-radius: 5px;
background: var(--brand-primary);
box-shadow: 0 6px 14px var(--brand-shadow);
color: var(--brand-on-primary);
font-family: var(--brand-font-display);
font-size: 15px;
font-weight: 800;
transform: translateY(-7px) rotate(-2deg);
}
@media (min-width: 520px) {
.bottom-nav {
right: calc((100vw - 430px) / 2);
left: calc((100vw - 430px) / 2);
}
}
</style>
@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title desc">
<title id="title">解忧商行印章</title>
<desc id="desc">解忧商行方形朱砂印章</desc>
<rect x="2" y="2" width="60" height="60" rx="8" fill="#A64332"/>
<rect x="7" y="7" width="50" height="50" rx="3" fill="none" stroke="#ECD0B1" stroke-width="1.4"/>
<text x="32" y="31" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">解</text>
<text x="32" y="52" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">忧</text>
</svg>

After

Width:  |  Height:  |  Size: 722 B

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 80" role="img" aria-labelledby="title desc">
<title id="title">解忧商行</title>
<desc id="desc">解忧商行横版 logo,深色背景反白使用</desc>
<rect x="2" y="10" width="60" height="60" rx="7" fill="#A64332"/>
<rect x="7" y="15" width="50" height="50" rx="3" fill="none" stroke="#ECD0B1" stroke-width="1.2"/>
<text x="32" y="39" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">解</text>
<text x="32" y="60" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">忧</text>
<text x="78" y="46" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="34" font-weight="600" letter-spacing="4" fill="#F0F4F2">解忧商行</text>
<text x="80" y="66" font-family="'Inter','PingFang SC',sans-serif" font-size="9.5" font-weight="500" letter-spacing="2.8" fill="#ECD0B1">JIEYOU TRADING HOUSE</text>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 80" role="img" aria-labelledby="title desc">
<title id="title">解忧商行</title>
<desc id="desc">解忧商行横版 logo,浅色背景使用</desc>
<rect x="2" y="10" width="60" height="60" rx="7" fill="#A64332"/>
<rect x="7" y="15" width="50" height="50" rx="3" fill="none" stroke="#ECD0B1" stroke-width="1.2"/>
<text x="32" y="39" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">解</text>
<text x="32" y="60" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">忧</text>
<text x="78" y="46" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="34" font-weight="600" letter-spacing="4" fill="#1E4D42">解忧商行</text>
<text x="80" y="66" font-family="'Inter','PingFang SC',sans-serif" font-size="9.5" font-weight="500" letter-spacing="2.8" fill="#6F857C">JIEYOU TRADING HOUSE</text>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title desc">
<title id="title">解忧商行印章</title>
<desc id="desc">解忧商行方形朱砂印章</desc>
<rect x="2" y="2" width="60" height="60" rx="8" fill="#A64332"/>
<rect x="7" y="7" width="50" height="50" rx="3" fill="none" stroke="#ECD0B1" stroke-width="1.4"/>
<text x="32" y="31" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">解</text>
<text x="32" y="52" text-anchor="middle" font-family="'Noto Serif SC','Source Han Serif SC','Songti SC',serif" font-size="20" font-weight="700" fill="#FFFDF8">忧</text>
</svg>

After

Width:  |  Height:  |  Size: 722 B

+25
View File
@@ -0,0 +1,25 @@
import logoDark from './assets/logo-dark.svg'
import logoLight from './assets/logo-light.svg'
import logoSeal from './assets/logo-seal.svg'
import favicon from './assets/favicon.svg'
import type { SiteBrand } from '../types'
export const jieyouSite: SiteBrand = {
key: 'jieyou',
name: '解忧商行',
mark: '解',
themeColor: '#a64332',
favicon,
storefrontText: {
tagline: '解忧商号 · 安心租号',
hero_badge: '解忧严选',
hero_desc: '解忧商行严选三角洲账号,逐号核验、独立订单与专属售后,让每次租用更安心。',
card_sub: '逐号验真 · 独立订单 · 解忧售后',
},
logos: {
light: logoLight,
dark: logoDark,
seal: logoSeal,
},
}
+159
View File
@@ -0,0 +1,159 @@
html[data-site='jieyou'] {
--brand-primary: #a64332;
--brand-primary-rgb: 166 67 50;
--brand-primary-hover: #bd5845;
--brand-primary-light: #c97868;
--brand-primary-strong: #853326;
--brand-primary-soft: #f7ebe4;
--brand-on-primary: #fffdf8;
--brand-accent: #1e4d42;
--brand-canvas: #f4efe5;
--brand-surface: #fffdf8;
--brand-surface-muted: #f1e9dc;
--brand-ink: #1d2c28;
--brand-muted: #6f7f79;
--brand-border: #e7d2b5;
--brand-shadow: rgb(166 67 50 / 0.24);
--brand-font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
--brand-font-display: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', serif;
}
html[data-site='jieyou'] body {
background: var(--brand-canvas);
color: var(--brand-ink);
}
html[data-site='jieyou'] .pc-app-shell {
background: var(--brand-canvas);
}
html[data-site='jieyou'] .pc-topbar {
border-bottom-color: rgb(166 67 50 / 0.14);
background: rgb(255 253 248 / 0.94);
box-shadow: 0 2px 18px rgb(30 77 66 / 0.08);
}
html[data-site='jieyou'] .pc-brand-text,
html[data-site='jieyou'] .pc-brand-sub {
font-family: var(--brand-font-display);
}
html[data-site='jieyou'] .pc-brand-text {
color: var(--brand-accent);
letter-spacing: 0.04em;
}
html[data-site='jieyou'] .pc-brand-sub {
color: var(--brand-muted);
letter-spacing: 0.08em;
}
html[data-site='jieyou'] .pc-search {
border-color: var(--brand-border);
background: var(--brand-surface);
}
html[data-site='jieyou'] .pc-post-link,
html[data-site='jieyou'] .pc-login-link {
border-radius: 8px;
}
html[data-site='jieyou'] .pc-nav-link.router-link-active {
background: var(--brand-primary-soft);
color: var(--brand-primary-strong);
}
html[data-site='jieyou'] .pc-home-redesign {
background:
linear-gradient(rgb(166 67 50 / 0.025) 1px, transparent 1px),
linear-gradient(90deg, rgb(166 67 50 / 0.025) 1px, transparent 1px), var(--brand-canvas);
background-size: 28px 28px;
}
html[data-site='jieyou'] .pc-footer {
border-top-color: var(--brand-border);
background: var(--brand-surface);
}
html[data-site='jieyou'] .mobile-shell {
background: var(--brand-canvas);
color: var(--brand-ink);
}
html[data-site='jieyou'] .mobile-hero {
border-bottom: 1px solid var(--brand-border);
background: var(--brand-surface);
box-shadow: 0 1px 0 rgb(166 67 50 / 0.08);
}
html[data-site='jieyou'] .mobile-brand strong,
html[data-site='jieyou'] .mobile-brand-title-row strong {
color: var(--brand-accent);
font-family: var(--brand-font-display);
letter-spacing: 0.04em;
}
html[data-site='jieyou'] .mobile-brand small {
color: var(--brand-muted);
}
html[data-site='jieyou'] .mobile-service,
html[data-site='jieyou'] .add-home-strip {
border-color: var(--brand-border);
background: var(--brand-surface);
color: var(--brand-primary-strong);
}
html[data-site='jieyou'] .add-home-strip {
background: var(--brand-primary-soft);
}
html[data-site='jieyou'] .login-page {
background-color: var(--brand-canvas);
}
html[data-site='jieyou'] .login-card {
border: 1px solid var(--brand-border);
border-radius: 12px;
box-shadow: 0 24px 64px rgb(30 77 66 / 0.12);
}
html[data-site='jieyou'] .card-hero {
background:
radial-gradient(circle at 82% 72%, rgb(166 67 50 / 0.3) 0%, transparent 52%),
linear-gradient(155deg, #10241f 0%, #173a32 52%, #1e4d42 100%);
}
html[data-site='jieyou'] .card-hero::after {
position: absolute;
right: -24px;
bottom: -20px;
width: 240px;
height: 240px;
background: url('./assets/logo-seal.svg') center / contain no-repeat;
content: '';
opacity: 0.16;
pointer-events: none;
transform: rotate(-8deg);
z-index: 0;
}
html[data-site='jieyou'] .hero-shield-art {
display: none;
}
html[data-site='jieyou'] .hero-title,
html[data-site='jieyou'] .brand-name,
html[data-site='jieyou'] .brand-lockup strong {
font-family: var(--brand-font-display);
letter-spacing: 0.08em;
}
html[data-site='jieyou'] .mobile-login-shell {
background:
radial-gradient(circle at 50% 8%, rgb(166 67 50 / 0.1), transparent 34%), var(--brand-canvas);
}
html[data-site='jieyou'] .tenant-brand-banner {
display: grid;
}
+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest'
import { resolveSiteKey, siteBrandFor } from '.'
describe('site branding registry', () => {
it('resolves the Jieyou brand from the tenant code', () => {
expect(resolveSiteKey('jieyou')).toBe('jieyou')
expect(siteBrandFor('jieyou').name).toBe('解忧商行')
expect(siteBrandFor('jieyou').logos.seal).toMatch(/^data:image\/svg\+xml/)
})
it('falls back to Dachui for main, legacy distribution and ops contexts', () => {
expect(resolveSiteKey('dachui')).toBe('dachui')
expect(resolveSiteKey('')).toBe('dachui')
expect(resolveSiteKey('legacy_site')).toBe('dachui')
expect(siteBrandFor('').mark).toBe('锤')
})
})
+15
View File
@@ -0,0 +1,15 @@
import { siteBrandFor, type SiteKey } from '.'
export function applySiteTheme(siteKey: SiteKey) {
if (typeof document === 'undefined') return
const brand = siteBrandFor(siteKey)
document.documentElement.dataset.site = siteKey
let meta = document.querySelector('meta[name="theme-color"]') as HTMLMetaElement | null
if (!meta) {
meta = document.createElement('meta')
meta.name = 'theme-color'
document.head.appendChild(meta)
}
meta.content = brand.themeColor
}
+15
View File
@@ -0,0 +1,15 @@
import type { StorefrontText } from '@/shared/utils/storefrontText'
export type SiteKey = 'dachui' | 'jieyou'
export type BrandLogoVariant = 'light' | 'dark' | 'seal'
export interface SiteBrand {
key: SiteKey
name: string
mark: string
themeColor: string
favicon: string
storefrontText: StorefrontText
logos: Record<BrandLogoVariant, string>
}