XuqmGroup-Web/tenant-platform/src/router/index.ts
XuqmGroup e47f510a0b feat(sdk): 添加鸿蒙SDK核心功能模块
- 实现SDKContext用于配置管理和数据持久化存储
- 定义完整的类型系统包括消息、用户、群组等接口
- 集成更新SDK支持原生应用和RN热更新检查
- 提供统一的XuqmSDK入口类和模块导出
- 编写详细的开发文档和使用示例
2026-04-29 19:08:13 +08:00

76 行
2.0 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: '/',
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: 'apps/:id',
component: () => import('@/views/apps/AppDetailView.vue'),
},
{
path: 'apps/:appId/im-config',
component: () => import('@/views/im/ImConfigView.vue'),
},
{
path: 'apps/:appId/im-webhooks',
component: () => import('@/views/im/ImWebhookView.vue'),
},
{
path: 'apps/:appId/im',
component: () => import('@/views/im/ImManagementView.vue'),
},
{
path: 'apps/:appId/update',
component: () => import('@/views/update/VersionManagementView.vue'),
},
{
path: 'accounts',
component: () => import('@/views/accounts/SubAccountView.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