forked from natuka/web.puabadge.com
新增:京东下单页面
This commit is contained in:
1 parent
8e8cde9ef5
commit
007c675603
25 files changed
+3264
-25
No files matched your search
+11
-1
@@ -6,11 +6,13 @@ import 'nprogress/nprogress.css'
|
||||
// import * as badgeRouter from './badge'
|
||||
import * as cartoonRouter from './cartoon'
|
||||
import * as douyinRouter from './douyin'
|
||||
import * as jingdongRouter from './jingdong'
|
||||
// import badge from '@/views/badge/index.vue'
|
||||
import cartoon from '@/views/cartoon/index.vue'
|
||||
import {useStore} from '@/stores'
|
||||
import { config } from '@/config/config'
|
||||
import { douyinConfig } from '@/config/douyin'
|
||||
import { jingdongConfig } from '@/config/jingdong'
|
||||
import { localStorage } from '@/utils/local-storage'
|
||||
import {
|
||||
getCachedShopBrand,
|
||||
@@ -37,6 +39,7 @@ const routes = [
|
||||
// badgeRouter.mergeRoutes(routes)
|
||||
cartoonRouter.mergeRoutes(routes)
|
||||
douyinRouter.mergeRoutes(routes)
|
||||
jingdongRouter.mergeRoutes(routes)
|
||||
// 创建路由实例并传递 `routes` 配置
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(process.env.VUE_APP_PUBLIC_PATH),
|
||||
@@ -65,7 +68,9 @@ router.beforeEach((_to, _from, next) => {
|
||||
if (code) {
|
||||
let url = store.redirectUrl()
|
||||
|
||||
if (_to.path !== '/cartoon' && !_to.path.includes('douyin')) {
|
||||
const isChannelPath =
|
||||
_to.path.includes('douyin') || _to.path.includes('jingdong')
|
||||
if (_to.path !== '/cartoon' && !isChannelPath) {
|
||||
if (url) {
|
||||
store.setRedirect('')
|
||||
next(url)
|
||||
@@ -82,12 +87,17 @@ 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')
|
||||
const isJingdong =
|
||||
_to.meta.channel === 'jingdong' || _to.path.includes('jingdong')
|
||||
// 抖音页优先使用 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 if (isJingdong) {
|
||||
window.document.title = `${jingdongConfig.brandName} - ${titleText}`
|
||||
setDocumentFavicon(jingdongConfig.images.logoIcon)
|
||||
} else {
|
||||
window.document.title = config.showBrandInTitle && brandText
|
||||
? `${brandText} - ${titleText}`
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import jingdongHome from '@/views/jingdong/index.vue'
|
||||
|
||||
export const routes = [
|
||||
{
|
||||
path: '/jingdong',
|
||||
name: 'jingdong',
|
||||
component: jingdongHome,
|
||||
meta: {
|
||||
needGuard: true,
|
||||
title: '速哇手办制作Agent',
|
||||
channel: 'jingdong',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export function mergeRoutes(allRoutes: any[]) {
|
||||
allRoutes.push(...routes)
|
||||
}
|
||||
Reference in new issue
Block a user