fix: 修复系统设置的动态注入问题

- 创建 useSiteSettings composable 在应用启动时加载系统设置
- 从 window.__SITE_CONFIG__(后端注入)和 localStorage 初始化设置
- 修复 favicon 更新逻辑,正确移除旧 favicon 并添加新的
- 在路由守卫中设置页面标题,格式为 '页面名 - 网站名'
- 简化 admin.vue 和 admin-sidebar 组件,使用统一的设置管理

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 13:15:31 +08:00
parent 7eb232fd8e
commit 53ab7fd778
6 changed files with 245 additions and 115 deletions
+8
View File
@@ -1,4 +1,5 @@
import type { Router } from 'vue-router'
import { useSiteSettings } from '@/composables/use-site-settings'
const INSTALL_CACHE_KEY = 'app_installed'
const INSTALL_CACHE_EXPIRY = 24 * 60 * 60 * 1000
@@ -93,4 +94,11 @@ export function createRouterGuard(router: Router) {
return '/admin'
}
})
// 设置页面标题
router.afterEach((to) => {
const { siteSettings, getPageTitle } = useSiteSettings()
const pageTitle = to.meta?.title as string | undefined
document.title = getPageTitle(pageTitle)
})
}