XuqmGroup-Web/tenant-platform/src/router/index.ts

177 行
5.5 KiB
TypeScript

2026-04-21 22:07:29 +08:00
import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
2026-04-21 22:07:29 +08:00
routes: [
{
path: '/login',
component: () => import('@/views/auth/LoginView.vue'),
},
{
path: '/register',
component: () => import('@/views/auth/RegisterView.vue'),
},
{
path: '/forgot-password',
component: () => import('@/views/auth/ForgotPasswordView.vue'),
},
{
path: '/download/:appKey',
component: () => import('@/views/download/DownloadView.vue'),
},
2026-04-21 22:07:29 +08:00
{
path: '/',
component: () => import('@/views/layout/MainLayout.vue'),
meta: { requiresAuth: true },
children: [
{
path: '',
redirect: '/dashboard',
},
{
path: 'dashboard',
component: () => import('@/views/dashboard/DashboardView.vue'),
},
{
path: 'apps',
component: () => import('@/views/apps/AppListView.vue'),
},
{
path: 'security',
component: () => import('@/views/security/SecurityCenterView.vue'),
},
{
path: 'docs',
component: () => import('@/views/docs/DocsCenterView.vue'),
},
{
path: 'operation-logs',
component: () => import('@/views/logs/OperationLogView.vue'),
},
2026-04-21 22:07:29 +08:00
{
path: 'apps/:appKey',
2026-04-21 22:07:29 +08:00
component: () => import('@/views/apps/AppDetailView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/im-config',
component: () => import('@/views/im/ImConfigView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/push-config',
component: () => import('@/views/push/PushConfigView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/push-management',
component: () => import('@/views/push/PushManagementView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/im-webhooks',
component: () => import('@/views/im/ImWebhookView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/im-webhooks/:webhookId/deliveries',
component: () => import('@/views/im/WebhookDeliveryLogView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/im-webhook-alerts',
component: () => import('@/views/im/WebhookAlertView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/im',
component: () => import('@/views/im/ImManagementView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'apps/:appKey/update',
component: () => import('@/views/update/VersionManagementView.vue'),
},
2026-05-15 21:00:24 +08:00
{
path: 'apps/:appKey/license',
component: () => import('@/views/license/LicenseManagementView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'services/im/:appKey?',
component: () => import('@/views/im/ImManagementView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'services/push/:appKey?',
component: () => import('@/views/push/PushManagementView.vue'),
},
{
2026-05-07 19:39:47 +08:00
path: 'services/update/:appKey?',
component: () => import('@/views/update/VersionManagementView.vue'),
},
{
path: 'services/license/:appKey?',
component: () => import('@/views/license/LicenseManagementView.vue'),
},
{
path: 'services/bugcollect/:appKey?',
component: () => import('@/views/bug-collect/BugCollectOverview.vue'),
},
{
path: 'system-logs',
component: () => import('@/views/system/ServerLogsView.vue'),
},
{
path: 'database',
component: () => import('@/views/database/DatabaseView.vue'),
},
2026-04-21 22:07:29 +08:00
{
path: 'accounts',
component: () => import('@/views/accounts/SubAccountView.vue'),
},
// ── Bug 收集 ─────────────────────────────────────────────────
{
path: 'bugcollect/overview',
component: () => import('@/views/bug-collect/BugCollectOverview.vue'),
},
{
path: 'bugcollect/issues',
component: () => import('@/views/bug-collect/BugCollectIssues.vue'),
},
{
path: 'bugcollect/issues/:id',
component: () => import('@/views/bug-collect/BugCollectIssueDetail.vue'),
},
{
path: 'bugcollect/events',
component: () => import('@/views/bug-collect/BugCollectEvents.vue'),
},
{
path: 'bugcollect/funnels',
component: () => import('@/views/bug-collect/BugCollectFunnels.vue'),
},
{
path: 'bugcollect/webhooks',
component: () => import('@/views/bug-collect/BugCollectWebhooks.vue'),
},
{
path: 'bugcollect/sourcemaps',
component: () => import('@/views/bug-collect/BugCollectSourcemaps.vue'),
},
{
path: 'bugcollect/rank/freq',
component: () => import('@/views/bug-collect/BugCollectRankFreq.vue'),
},
{
path: 'bugcollect/rank/risk',
component: () => import('@/views/bug-collect/BugCollectRankRisk.vue'),
},
2026-04-21 22:07:29 +08:00
],
},
],
})
router.beforeEach((to) => {
const auth = useAuthStore()
if (to.meta.requiresAuth && !auth.token) {
return '/login'
}
if ((to.path === '/login' || to.path === '/register') && auth.token) {
return '/dashboard'
}
})
export default router