Files
Yi.Admin/Yi.Ai.Vue3/src/routers/modules/staticRouter.ts

323 lines
9.1 KiB
TypeScript
Raw Normal View History

2025-06-19 01:02:08 +08:00
import type { RouteRecordRaw } from 'vue-router';
2025-06-17 22:37:37 +08:00
2026-02-01 00:30:44 +08:00
// 预加载辅助函数
function preloadComponent(importFn: () => Promise<any>) {
return () => {
// 在开发环境下直接返回
if (import.meta.env.DEV) {
return importFn();
}
// 生产环境下可以添加缓存逻辑
return importFn();
};
}
2025-06-17 22:37:37 +08:00
// LayoutRouter[布局路由]
export const layoutRouter: RouteRecordRaw[] = [
{
path: '/',
2026-02-01 00:30:44 +08:00
component: preloadComponent(() => import('@/layouts/index.vue')),
2025-06-17 22:37:37 +08:00
children: [
2025-12-28 22:42:17 +08:00
// 将首页重定向逻辑放在这里
2025-06-17 22:37:37 +08:00
{
2025-12-28 22:42:17 +08:00
path: '',
redirect: '/chat/conversation',
2025-06-17 22:37:37 +08:00
},
2025-12-28 22:42:17 +08:00
// chat 路由组 - 修正路径和重定向
2025-06-17 22:37:37 +08:00
{
2025-12-28 22:42:17 +08:00
path: 'chat',
name: 'chat',
2025-06-17 22:37:37 +08:00
component: () => import('@/pages/chat/index.vue'),
2026-02-01 00:30:44 +08:00
redirect: '/chat/conversation',
2025-06-17 22:37:37 +08:00
meta: {
2026-01-02 22:47:09 +08:00
title: 'AI应用',
2025-12-28 22:42:17 +08:00
icon: 'HomeFilled',
2025-06-17 22:37:37 +08:00
},
2025-12-28 22:42:17 +08:00
children: [
{
path: 'conversation',
name: 'chatConversation',
component: () => import('@/pages/chat/conversation/index.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-AI对话',
2025-12-28 22:42:17 +08:00
isDefaultChat: true,
},
},
{
path: 'conversation/:id',
name: 'chatConversationWithId',
component: () => import('@/pages/chat/conversation/index.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-AI对话',
2025-12-28 22:42:17 +08:00
isDefaultChat: false,
},
},
{
path: 'image',
name: 'chatImage',
component: () => import('@/pages/chat/image/index.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-AI图片',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'video',
name: 'chatVideo',
component: () => import('@/pages/chat/video/index.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-AI视频',
},
},
{
path: 'agent',
name: 'monitor',
component: () => import('@/pages/chat/agent/index.vue'),
meta: {
title: '意心Ai-AI智能体',
2025-12-28 22:42:17 +08:00
},
},
2026-02-06 00:41:13 +08:00
{
path: 'api',
name: 'chatApi',
component: () => import('@/pages/chat/api/index.vue'),
meta: {
title: '意心Ai-AI接口',
},
},
2025-12-28 22:42:17 +08:00
],
2025-06-17 22:37:37 +08:00
},
2025-12-28 22:42:17 +08:00
// 产品页面
2025-06-18 23:28:27 +08:00
{
2025-12-28 22:42:17 +08:00
path: 'products',
2025-06-18 23:28:27 +08:00
name: 'products',
2025-06-23 23:36:59 +08:00
component: () => import('@/pages/products/index.vue'),
2025-06-18 23:28:27 +08:00
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-产品页面',
keepAlive: 0,
2025-12-09 19:11:30 +08:00
isDefaultChat: false,
layout: 'blankPage',
2025-06-19 01:02:08 +08:00
},
},
2025-12-28 22:42:17 +08:00
// 模型库
2025-12-09 19:11:30 +08:00
{
2025-12-28 22:42:17 +08:00
path: 'model-library',
2025-12-09 19:11:30 +08:00
name: 'modelLibrary',
component: () => import('@/pages/modelLibrary/index.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-模型库',
keepAlive: 0,
2025-12-09 19:11:30 +08:00
isDefaultChat: false,
2025-12-28 22:42:17 +08:00
layout: 'default',
2025-12-09 19:11:30 +08:00
},
},
2025-12-28 22:42:17 +08:00
2026-02-01 19:32:46 +08:00
// 排行榜
{
path: 'ranking',
name: 'ranking',
component: () => import('@/pages/ranking/index.vue'),
meta: {
title: '意心Ai全球大模型实时排行榜编程',
keepAlive: 0,
isDefaultChat: false,
layout: 'default',
},
},
2025-12-28 22:42:17 +08:00
// 支付结果
{
2025-12-28 22:42:17 +08:00
path: 'pay-result',
name: 'payResult',
component: () => import('@/pages/payResult/index.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-支付结果',
2025-12-28 22:42:17 +08:00
keepAlive: 0,
isDefaultChat: false,
layout: 'blankPage',
},
2025-06-18 23:28:27 +08:00
},
2025-12-28 22:42:17 +08:00
// 活动详情
2025-11-05 23:12:23 +08:00
{
2025-12-28 22:42:17 +08:00
path: 'activity/:id',
2025-11-05 23:12:23 +08:00
name: 'activityDetail',
component: () => import('@/pages/activity/detail.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-活动详情',
2025-11-05 23:12:23 +08:00
isDefaultChat: false,
layout: 'blankPage',
},
},
2025-12-28 22:42:17 +08:00
// 公告详情
2025-11-05 23:12:23 +08:00
{
2025-12-28 22:42:17 +08:00
path: 'announcement/:id',
2025-11-05 23:12:23 +08:00
name: 'announcementDetail',
component: () => import('@/pages/announcement/detail.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-公告详情',
2025-11-05 23:12:23 +08:00
isDefaultChat: false,
layout: 'blankPage',
},
},
2025-12-28 22:42:17 +08:00
// 控制台路由组 - 修正路径和重定向
{
path: 'console',
name: 'console',
component: () => import('@/pages/console/index.vue'),
2026-02-01 00:30:44 +08:00
redirect: '/console/user',
2025-12-28 22:42:17 +08:00
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-控制台',
2025-12-28 22:42:17 +08:00
icon: 'Setting',
layout: 'default',
},
children: [
{
path: 'user',
name: 'consoleUser',
component: () => import('@/components/userPersonalCenter/components/UserManagement.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-用户信息',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'apikey',
name: 'consoleApikey',
component: () => import('@/components/userPersonalCenter/components/APIKeyManagement.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-API密钥',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'recharge-log',
name: 'consoleRechargeLog',
component: () => import('@/components/userPersonalCenter/components/RechargeLog.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-充值记录',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'usage',
name: 'consoleUsage',
component: () => import('@/components/userPersonalCenter/components/UsageStatistics.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-用量统计',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'premium',
name: 'consolePremium',
component: () => import('@/components/userPersonalCenter/components/PremiumService.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-尊享服务',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'daily-task',
name: 'consoleDailyTask',
component: () => import('@/components/userPersonalCenter/components/DailyTask.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-每日任务',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'invite',
name: 'consoleInvite',
component: () => import('@/components/userPersonalCenter/components/CardFlipActivity.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-每周邀请',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'activation',
name: 'consoleActivation',
component: () => import('@/components/userPersonalCenter/components/ActivationCode.vue'),
meta: {
2026-01-03 02:15:28 +08:00
title: '意心Ai-激活码兑换',
2025-12-28 22:42:17 +08:00
},
},
{
path: 'channel',
name: 'consoleChannel',
component: () => import('@/pages/console/channel/index.vue'),
meta: {
2026-01-20 00:15:33 +08:00
title: '意心Ai-号池管理',
},
},
2026-01-05 15:44:48 +08:00
{
path: 'system-statistics',
name: 'consoleSystemStatistics',
component: () => import('@/pages/console/system-statistics/index.vue'),
meta: {
title: '意心Ai-系统统计',
},
},
2026-01-24 22:08:54 +08:00
{
path: 'announcement',
name: 'consoleAnnouncement',
component: () => import('@/pages/console/announcement/index.vue'),
meta: {
title: '意心Ai-公告管理',
},
},
2025-12-28 22:42:17 +08:00
],
},
2025-06-17 22:37:37 +08:00
],
},
];
2026-02-01 00:30:44 +08:00
// staticRouter[静态路由]
export const staticRouter: RouteRecordRaw[] = [
// FontAwesome 测试页面
{
path: '/test/fontawesome',
name: 'testFontAwesome',
component: () => import('@/pages/test/fontawesome.vue'),
meta: {
title: 'FontAwesome图标测试',
},
},
];
2025-06-17 22:37:37 +08:00
// errorRouter (错误页面路由)
export const errorRouter = [
{
path: '/403',
name: '403',
component: () => import('@/pages/error/403.vue'),
meta: {
title: '403页面',
enName: '403 Page', // 英文名称
icon: 'QuestionFilled', // 菜单图标
isHide: '1', // 代表路由在菜单中是否隐藏,是否隐藏[0隐藏1显示]
isLink: '1', // 是否外链[有值则是外链]
isKeepAlive: '0', // 是否缓存路由数据[0是1否]
isFull: '1', // 是否缓存全屏[0是1否]
isAffix: '1', // 是否缓存固定路由[0是1否]
},
},
{
path: '/404',
name: '404',
component: () => import('@/pages/error/404.vue'),
meta: {
title: '404页面',
enName: '404 Page', // 英文名称
icon: 'CircleCloseFilled', // 菜单图标
isHide: '1', // 代表路由在菜单中是否隐藏,是否隐藏[0隐藏1显示]
isLink: '1', // 是否外链[有值则是外链]
isKeepAlive: '0', // 是否缓存路由数据[0是1否]
isFull: '1', // 是否缓存全屏[0是1否]
isAffix: '1', // 是否缓存固定路由[0是1否]
},
},
// 找不到path将跳转404页面
{
path: '/:pathMatch(.*)*',
component: () => import('@/pages/error/404.vue'),
},
];