forked from natuka/web.puabadge.com
新增:抖音支持一个链接下多单;图片按裁剪3:4比例;根据返回的数据显示门店名称和门店logo
This commit is contained in:
1 parent
6bf542bf1d
commit
8e8cde9ef5
19 files changed
+2158
-404
No files matched your search
+16
-16
@@ -12,20 +12,13 @@ import {useStore} from '@/stores'
|
||||
import { config } from '@/config/config'
|
||||
import { douyinConfig } from '@/config/douyin'
|
||||
import { localStorage } from '@/utils/local-storage'
|
||||
import {
|
||||
getCachedShopBrand,
|
||||
setDocumentFavicon,
|
||||
} from '@/views/douyin/shopBrandCache'
|
||||
|
||||
const DEFAULT_FAVICON = '/douyin-logo.png'
|
||||
|
||||
function setFavicon(href: string) {
|
||||
let link = document.querySelector<HTMLLinkElement>('link[rel="icon"]')
|
||||
if (!link) {
|
||||
link = document.createElement('link')
|
||||
link.rel = 'icon'
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
link.type = 'image/png'
|
||||
link.href = href
|
||||
}
|
||||
|
||||
NProgress.configure({ showSpinner: true, parent: '#app' })
|
||||
|
||||
// 定义路由,每个路由都需要映射到一个组件
|
||||
@@ -89,11 +82,18 @@ router.beforeEach((_to, _from, next) => {
|
||||
const titleText = pageTitle.$t || pageTitle
|
||||
const brandText = config.brand?.$t || config.brand || ''
|
||||
const isDouyin = _to.meta.channel === 'douyin' || _to.path.includes('douyin')
|
||||
// 暂时去掉「葡哇立体肖像」前缀;抖音页使用「萌趣小宝.ai定制」
|
||||
window.document.title = isDouyin
|
||||
? `${douyinConfig.brandName} - ${titleText}`
|
||||
: (config.showBrandInTitle && brandText ? `${brandText} - ${titleText}` : String(titleText))
|
||||
setFavicon(isDouyin ? douyinConfig.images.logo : DEFAULT_FAVICON)
|
||||
// 抖音页优先使用 shopBrand 缓存的门店名/logo,否则回退默认品牌
|
||||
if (isDouyin) {
|
||||
const shopBrand = getCachedShopBrand()
|
||||
const brandName = shopBrand.name || douyinConfig.brandName
|
||||
window.document.title = `${brandName} - ${titleText}`
|
||||
setDocumentFavicon(shopBrand.logo || douyinConfig.images.logo)
|
||||
} else {
|
||||
window.document.title = config.showBrandInTitle && brandText
|
||||
? `${brandText} - ${titleText}`
|
||||
: String(titleText)
|
||||
setDocumentFavicon(DEFAULT_FAVICON)
|
||||
}
|
||||
NProgress.start() // start progress bar
|
||||
const needGuard = _to.meta.needGuard
|
||||
if (needGuard) {
|
||||
|
||||
Reference in new issue
Block a user