新增
This commit is contained in:
@@ -5,19 +5,25 @@ import useAppStore from '@/stores/modules/app'
|
||||
export default function createInitGuard(router: Router) {
|
||||
router.beforeEach(async () => {
|
||||
const appStore = useAppStore()
|
||||
if (Object.keys(appStore.config).length == 0) {
|
||||
// 获取配置
|
||||
if (appStore.configFetchAttempted) {
|
||||
return
|
||||
}
|
||||
appStore.$patch({ configFetchAttempted: true })
|
||||
try {
|
||||
const data: any = await appStore.getConfig()
|
||||
|
||||
// 设置网站logo
|
||||
let favicon: HTMLLinkElement = document.querySelector('link[rel="icon"]')!
|
||||
if (favicon) {
|
||||
if (favicon && data?.web_favicon) {
|
||||
favicon.href = data.web_favicon
|
||||
}
|
||||
favicon = document.createElement('link')
|
||||
favicon.rel = 'icon'
|
||||
favicon.href = data.web_favicon
|
||||
document.head.appendChild(favicon)
|
||||
if (data?.web_favicon) {
|
||||
favicon = document.createElement('link')
|
||||
favicon.rel = 'icon'
|
||||
favicon.href = data.web_favicon
|
||||
document.head.appendChild(favicon)
|
||||
}
|
||||
} catch {
|
||||
// getConfig 失败时不再重试,避免与路由守卫形成无限请求
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -39,6 +39,10 @@ export const constantRoutes: Array<RouteRecordRaw> = [
|
||||
path: '/change-password',
|
||||
component: () => import('@/views/account/change-password.vue')
|
||||
},
|
||||
{
|
||||
path: '/bind-work-wechat',
|
||||
component: () => import('@/views/account/bind-work-wechat.vue')
|
||||
},
|
||||
{
|
||||
path: '/user',
|
||||
component: LAYOUT,
|
||||
@@ -53,6 +57,20 @@ export const constantRoutes: Array<RouteRecordRaw> = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/doctor',
|
||||
component: LAYOUT,
|
||||
children: [
|
||||
{
|
||||
path: 'progress',
|
||||
component: () => import('@/views/doctor/progress.vue'),
|
||||
name: 'doctorFaceProgress',
|
||||
meta: {
|
||||
title: '面诊进度'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/decoration/pc_details',
|
||||
component: () => import('@/views/decoration/pc_details.vue')
|
||||
|
||||
Reference in New Issue
Block a user