XuqmGroup-Web/tenant-platform/src/router/index.ts
XuqmGroup afe698bf46 feat(update): 版本管理页体验优化 + 新增应用下载页
- 版本列表操作列新增"下载"按钮,直接下载 APK
- 移除应用商店标签的悬浮提示,仅保留"查看详情"入口
- 新增 /download/:appKey 公开下载页:按设备 UA 识别 Android/iOS/HarmonyOS,
  展示对应最新已发布版本;Android 按品牌匹配商店跳转按钮,未匹配时列出所有已配置商店链接;
  iOS/鸿蒙仅在已发布且配置商店链接时展示,否则提示无可用安装包

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 01:51:26 +08:00

177 行
5.5 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
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'),
},
{
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'),
},
{
path: 'apps/:appKey',
component: () => import('@/views/apps/AppDetailView.vue'),
},
{
path: 'apps/:appKey/im-config',
component: () => import('@/views/im/ImConfigView.vue'),
},
{
path: 'apps/:appKey/push-config',
component: () => import('@/views/push/PushConfigView.vue'),
},
{
path: 'apps/:appKey/push-management',
component: () => import('@/views/push/PushManagementView.vue'),
},
{
path: 'apps/:appKey/im-webhooks',
component: () => import('@/views/im/ImWebhookView.vue'),
},
{
path: 'apps/:appKey/im-webhooks/:webhookId/deliveries',
component: () => import('@/views/im/WebhookDeliveryLogView.vue'),
},
{
path: 'apps/:appKey/im-webhook-alerts',
component: () => import('@/views/im/WebhookAlertView.vue'),
},
{
path: 'apps/:appKey/im',
component: () => import('@/views/im/ImManagementView.vue'),
},
{
path: 'apps/:appKey/update',
component: () => import('@/views/update/VersionManagementView.vue'),
},
{
path: 'apps/:appKey/license',
component: () => import('@/views/license/LicenseManagementView.vue'),
},
{
path: 'services/im/:appKey?',
component: () => import('@/views/im/ImManagementView.vue'),
},
{
path: 'services/push/:appKey?',
component: () => import('@/views/push/PushManagementView.vue'),
},
{
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'),
},
{
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'),
},
],
},
],
})
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