diff --git a/frontend/index.html b/frontend/index.html
index 1e4ccfcd..a74ea65a 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -4,8 +4,9 @@
大锤商行
-
-
+
+
+
diff --git a/frontend/public/jieyou-apple-touch-icon.png b/frontend/public/jieyou-apple-touch-icon.png
new file mode 100644
index 00000000..dba77748
Binary files /dev/null and b/frontend/public/jieyou-apple-touch-icon.png differ
diff --git a/frontend/public/jieyou-favicon.svg b/frontend/public/jieyou-favicon.svg
new file mode 100644
index 00000000..c18f85f8
--- /dev/null
+++ b/frontend/public/jieyou-favicon.svg
@@ -0,0 +1,8 @@
+
diff --git a/frontend/public/site-bootstrap.js b/frontend/public/site-bootstrap.js
new file mode 100644
index 00000000..1ef6d290
--- /dev/null
+++ b/frontend/public/site-bootstrap.js
@@ -0,0 +1,24 @@
+/* global document, URLSearchParams, window */
+
+(() => {
+ const host = window.location.hostname.toLowerCase()
+ const params = new URLSearchParams(window.location.search)
+ const tenantHint = (params.get('tenant_code') || params.get('tenant') || '').toLowerCase()
+ const isJieyou =
+ host === 'zuhaox.com' ||
+ host.endsWith('.zuhaox.com') ||
+ host.startsWith('jieyou.') ||
+ tenantHint === 'jieyou'
+ if (!isJieyou) return
+
+ document.title = '解忧商行 - 官方租号平台'
+ const icon = document.getElementById('site-icon')
+ if (icon) {
+ icon.href = '/jieyou-favicon.svg'
+ icon.type = 'image/svg+xml'
+ }
+ const appleIcon = document.getElementById('site-apple-touch-icon')
+ if (appleIcon) {
+ appleIcon.href = '/jieyou-apple-touch-icon.png'
+ }
+})()
diff --git a/frontend/src/features/chats/composables/useDesktopNotification.ts b/frontend/src/features/chats/composables/useDesktopNotification.ts
index 2e87e890..31a7f5b3 100644
--- a/frontend/src/features/chats/composables/useDesktopNotification.ts
+++ b/frontend/src/features/chats/composables/useDesktopNotification.ts
@@ -96,10 +96,13 @@ export function useDesktopNotification(scope: 'user' | 'admin') {
if (shouldNotify(event.conversation_id, currentConversationId)) {
try {
+ const notificationIcon =
+ document.querySelector("link[rel='icon']")?.href ||
+ '/apple-touch-icon.png'
const notification = new Notification(title, {
body: body.length > 100 ? body.substring(0, 100) + '...' : body,
- icon: '/favicon.ico',
- badge: '/favicon.ico',
+ icon: notificationIcon,
+ badge: notificationIcon,
tag: `chat-${event.conversation_id}`, // 相同会话的通知会被替换
requireInteraction: false,
silent: false,
diff --git a/frontend/src/sites/dachui/index.ts b/frontend/src/sites/dachui/index.ts
index 11c966d5..c762ddbe 100644
--- a/frontend/src/sites/dachui/index.ts
+++ b/frontend/src/sites/dachui/index.ts
@@ -7,7 +7,7 @@ export const dachuiSite: SiteBrand = {
name: '大锤商行',
mark: '锤',
themeColor: '#ff6a00',
- favicon: '',
+ favicon: '/apple-touch-icon.png',
storefrontText: defaultStorefrontText,
logos: {
light: '',
diff --git a/frontend/src/sites/siteBrand.spec.ts b/frontend/src/sites/siteBrand.spec.ts
index 8f1a0f1f..dec0bb14 100644
--- a/frontend/src/sites/siteBrand.spec.ts
+++ b/frontend/src/sites/siteBrand.spec.ts
@@ -7,6 +7,7 @@ describe('site branding registry', () => {
expect(resolveSiteKey('jieyou')).toBe('jieyou')
expect(siteBrandFor('jieyou').name).toBe('解忧商行')
expect(siteBrandFor('jieyou').logos.seal).toMatch(/^data:image\/svg\+xml/)
+ expect(siteBrandFor('jieyou').favicon).toMatch(/^data:image\/svg\+xml/)
})
it('falls back to Dachui for main, legacy distribution and ops contexts', () => {
@@ -14,5 +15,6 @@ describe('site branding registry', () => {
expect(resolveSiteKey('')).toBe('dachui')
expect(resolveSiteKey('legacy_site')).toBe('dachui')
expect(siteBrandFor('').mark).toBe('锤')
+ expect(siteBrandFor('').favicon).toBe('/apple-touch-icon.png')
})
})
diff --git a/frontend/src/stores/distributionSite.ts b/frontend/src/stores/distributionSite.ts
index fc68448b..9df5674f 100644
--- a/frontend/src/stores/distributionSite.ts
+++ b/frontend/src/stores/distributionSite.ts
@@ -474,6 +474,8 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
localStorage.removeItem('hfb_site_code')
localStorage.removeItem('hfb_site_name')
document.title = '大锤商行 - 官方租号平台'
+ this.faviconUrl = siteBrandFor('dachui').favicon
+ this.applyFavicon()
},
applyTenantContext(info: TenantSiteContext) {
@@ -551,13 +553,24 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
applyFavicon() {
if (!this.faviconUrl || typeof document === 'undefined') return
- let link = document.querySelector("link[rel*='icon']") as HTMLLinkElement | null
- if (!link) {
- link = document.createElement('link')
+ const iconLinks = Array.from(
+ document.querySelectorAll("link[rel='icon'], link[rel='apple-touch-icon']")
+ )
+ if (iconLinks.length === 0) {
+ const link = document.createElement('link')
link.rel = 'icon'
document.head.appendChild(link)
+ iconLinks.push(link)
+ }
+ for (const link of iconLinks) {
+ if (link.rel === 'apple-touch-icon' && this.siteKey === 'jieyou') {
+ link.href = '/jieyou-apple-touch-icon.png'
+ link.type = 'image/png'
+ continue
+ }
+ link.href = this.faviconUrl
+ link.type = this.faviconUrl.endsWith('.svg') ? 'image/svg+xml' : 'image/png'
}
- link.href = this.faviconUrl
},
},
})