提交代码

This commit is contained in:
ldh
2026-11-16 17:03:18 +08:00
parent ba22189a46
commit 4e80b593de
13 changed files with 1813 additions and 2 deletions
+15
View File
@@ -1,5 +1,6 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/HomeView.vue'
import { hasAdminSession } from '@/api/systemConfig'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -38,6 +39,12 @@ const router = createRouter({
path: '/pay',
redirect: { name: 'sample' },
},
{
path: '/system-config',
name: 'systemConfig',
component: () => import('@/views/SystemConfigView.vue'),
meta: { title: '系统参数管理', requiresAdmin: true },
},
{
path: '/:pathMatch(.*)*',
redirect: { name: 'home' },
@@ -45,6 +52,14 @@ const router = createRouter({
],
})
router.beforeEach((to) => {
if (to.meta.requiresAdmin && !hasAdminSession()) {
return { name: 'home' }
}
return true
})
router.afterEach((to) => {
document.title = (to.meta.title as string | undefined) ?? 'LIBS Lab'
})