Files
digital-psychology/apps/admin-h5/src/router/index.ts
T
jackyu66gitandCursor e9c11cdf1d feat(ECR-040): ExploreConfig ScaleDefinition 只读投影并 Closed
复用 scales 表只读投影;admin-h5 /catalogs 聚合 026–040 目录;Loop 队列 STOP。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 03:20:42 +08:00

39 lines
2.0 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
import { getToken } from '@/api/client'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{ path: '/login', name: 'login', component: () => import('@/pages/LoginPage.vue'), meta: { public: true } },
{
path: '/',
component: () => import('@/layouts/AdminShell.vue'),
children: [
{ path: '', name: 'dashboard', component: () => import('@/pages/DashboardPage.vue') },
{ path: 'analytics', name: 'analytics', component: () => import('@/pages/AnalyticsPage.vue') },
{ path: 'content', name: 'content', component: () => import('@/pages/ContentPage.vue') },
{ path: 'users', name: 'users', component: () => import('@/pages/UsersPage.vue') },
{ path: 'users/:id', name: 'user', component: () => import('@/pages/UserDetailPage.vue') },
{ path: 'orders', name: 'orders', component: () => import('@/pages/OrdersPage.vue') },
{ path: 'plans', name: 'plans', component: () => import('@/pages/MembershipPlansPage.vue') },
{ path: 'codes', name: 'codes', component: () => import('@/pages/RedemptionPage.vue') },
{ path: 'ask', name: 'ask', component: () => import('@/pages/AskPage.vue') },
{ path: 'safety', name: 'safety', component: () => import('@/pages/SafetyPage.vue') },
{ path: 'ai', name: 'ai', component: () => import('@/pages/AIConfigPage.vue') },
{ path: 'crisis', name: 'crisis', component: () => import('@/pages/CrisisPage.vue') },
{ path: 'cms', name: 'cms', component: () => import('@/pages/CMSPage.vue') },
{ path: 'catalogs', name: 'catalogs', component: () => import('@/pages/CatalogHubPage.vue') },
{ path: 'audit', name: 'audit', component: () => import('@/pages/AuditPage.vue') },
],
},
],
})
router.beforeEach((to) => {
if (to.meta.public) return true
if (!getToken()) return { name: 'login', query: { redirect: to.fullPath } }
return true
})
export default router