fix(site): 修复解忧站点图标
This commit is contained in:
+3
-2
@@ -4,8 +4,9 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>大锤商行</title>
|
<title>大锤商行</title>
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
<link id="site-apple-touch-icon" rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||||
<link rel="icon" type="image/png" href="/apple-touch-icon.png" />
|
<link id="site-icon" rel="icon" type="image/png" href="/apple-touch-icon.png" />
|
||||||
|
<script src="/site-bootstrap.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 7.0 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 |
@@ -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'
|
||||||
|
}
|
||||||
|
})()
|
||||||
@@ -96,10 +96,13 @@ export function useDesktopNotification(scope: 'user' | 'admin') {
|
|||||||
|
|
||||||
if (shouldNotify(event.conversation_id, currentConversationId)) {
|
if (shouldNotify(event.conversation_id, currentConversationId)) {
|
||||||
try {
|
try {
|
||||||
|
const notificationIcon =
|
||||||
|
document.querySelector<HTMLLinkElement>("link[rel='icon']")?.href ||
|
||||||
|
'/apple-touch-icon.png'
|
||||||
const notification = new Notification(title, {
|
const notification = new Notification(title, {
|
||||||
body: body.length > 100 ? body.substring(0, 100) + '...' : body,
|
body: body.length > 100 ? body.substring(0, 100) + '...' : body,
|
||||||
icon: '/favicon.ico',
|
icon: notificationIcon,
|
||||||
badge: '/favicon.ico',
|
badge: notificationIcon,
|
||||||
tag: `chat-${event.conversation_id}`, // 相同会话的通知会被替换
|
tag: `chat-${event.conversation_id}`, // 相同会话的通知会被替换
|
||||||
requireInteraction: false,
|
requireInteraction: false,
|
||||||
silent: false,
|
silent: false,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const dachuiSite: SiteBrand = {
|
|||||||
name: '大锤商行',
|
name: '大锤商行',
|
||||||
mark: '锤',
|
mark: '锤',
|
||||||
themeColor: '#ff6a00',
|
themeColor: '#ff6a00',
|
||||||
favicon: '',
|
favicon: '/apple-touch-icon.png',
|
||||||
storefrontText: defaultStorefrontText,
|
storefrontText: defaultStorefrontText,
|
||||||
logos: {
|
logos: {
|
||||||
light: '',
|
light: '',
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ describe('site branding registry', () => {
|
|||||||
expect(resolveSiteKey('jieyou')).toBe('jieyou')
|
expect(resolveSiteKey('jieyou')).toBe('jieyou')
|
||||||
expect(siteBrandFor('jieyou').name).toBe('解忧商行')
|
expect(siteBrandFor('jieyou').name).toBe('解忧商行')
|
||||||
expect(siteBrandFor('jieyou').logos.seal).toMatch(/^data:image\/svg\+xml/)
|
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', () => {
|
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('')).toBe('dachui')
|
||||||
expect(resolveSiteKey('legacy_site')).toBe('dachui')
|
expect(resolveSiteKey('legacy_site')).toBe('dachui')
|
||||||
expect(siteBrandFor('').mark).toBe('锤')
|
expect(siteBrandFor('').mark).toBe('锤')
|
||||||
|
expect(siteBrandFor('').favicon).toBe('/apple-touch-icon.png')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -474,6 +474,8 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
|
|||||||
localStorage.removeItem('hfb_site_code')
|
localStorage.removeItem('hfb_site_code')
|
||||||
localStorage.removeItem('hfb_site_name')
|
localStorage.removeItem('hfb_site_name')
|
||||||
document.title = '大锤商行 - 官方租号平台'
|
document.title = '大锤商行 - 官方租号平台'
|
||||||
|
this.faviconUrl = siteBrandFor('dachui').favicon
|
||||||
|
this.applyFavicon()
|
||||||
},
|
},
|
||||||
|
|
||||||
applyTenantContext(info: TenantSiteContext) {
|
applyTenantContext(info: TenantSiteContext) {
|
||||||
@@ -551,13 +553,24 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
|
|||||||
|
|
||||||
applyFavicon() {
|
applyFavicon() {
|
||||||
if (!this.faviconUrl || typeof document === 'undefined') return
|
if (!this.faviconUrl || typeof document === 'undefined') return
|
||||||
let link = document.querySelector("link[rel*='icon']") as HTMLLinkElement | null
|
const iconLinks = Array.from(
|
||||||
if (!link) {
|
document.querySelectorAll<HTMLLinkElement>("link[rel='icon'], link[rel='apple-touch-icon']")
|
||||||
link = document.createElement('link')
|
)
|
||||||
|
if (iconLinks.length === 0) {
|
||||||
|
const link = document.createElement('link')
|
||||||
link.rel = 'icon'
|
link.rel = 'icon'
|
||||||
document.head.appendChild(link)
|
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
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user