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

264 lines
7.3 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
// LayoutRouter[布局路由]
export const layoutRouter: RouteRecordRaw[] = [
{
path: '/',
component: () => import('@/layouts/index.vue'),
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'),
meta: {
2025-12-28 22:42:17 +08:00
title: 'AI聊天',
icon: 'HomeFilled',
2025-06-17 22:37:37 +08:00
},
2025-12-28 22:42:17 +08:00
children: [
// chat 根路径重定向到 conversation
{
path: '',
redirect: '/chat/conversation',
},
{
path: 'conversation',
name: 'chatConversation',
component: () => import('@/pages/chat/conversation/index.vue'),
meta: {
title: 'AI对话',
isDefaultChat: true,
},
},
{
path: 'conversation/:id',
name: 'chatConversationWithId',
component: () => import('@/pages/chat/conversation/index.vue'),
meta: {
title: 'AI对话',
isDefaultChat: false,
},
},
{
path: 'image',
name: 'chatImage',
component: () => import('@/pages/chat/image/index.vue'),
meta: {
title: '图片生成',
},
},
{
path: 'video',
name: 'chatVideo',
component: () => import('@/pages/chat/video/index.vue'),
meta: {
title: '视频生成',
},
},
],
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: {
title: '产品页面',
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: {
title: '模型库',
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
// 支付结果
{
2025-12-28 22:42:17 +08:00
path: 'pay-result',
name: 'payResult',
component: () => import('@/pages/payResult/index.vue'),
meta: {
title: '支付结果',
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: {
title: '活动详情',
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: {
title: '公告详情',
isDefaultChat: false,
layout: 'blankPage',
},
},
2025-12-28 22:42:17 +08:00
// 控制台路由组 - 修正路径和重定向
{
path: 'console',
name: 'console',
component: () => import('@/pages/console/index.vue'),
meta: {
title: '控制台',
icon: 'Setting',
layout: 'default',
},
children: [
// console 根路径重定向到 user
{
path: '',
redirect: '/console/user',
},
{
path: 'user',
name: 'consoleUser',
component: () => import('@/components/userPersonalCenter/components/UserManagement.vue'),
meta: {
title: '用户信息',
},
},
{
path: 'apikey',
name: 'consoleApikey',
component: () => import('@/components/userPersonalCenter/components/APIKeyManagement.vue'),
meta: {
title: 'API密钥',
},
},
{
path: 'recharge-log',
name: 'consoleRechargeLog',
component: () => import('@/components/userPersonalCenter/components/RechargeLog.vue'),
meta: {
title: '充值记录',
},
},
{
path: 'usage',
name: 'consoleUsage',
component: () => import('@/components/userPersonalCenter/components/UsageStatistics.vue'),
meta: {
title: '用量统计',
},
},
{
path: 'premium',
name: 'consolePremium',
component: () => import('@/components/userPersonalCenter/components/PremiumService.vue'),
meta: {
title: '尊享服务',
},
},
{
path: 'daily-task',
name: 'consoleDailyTask',
component: () => import('@/components/userPersonalCenter/components/DailyTask.vue'),
meta: {
title: '每日任务',
},
},
{
path: 'invite',
name: 'consoleInvite',
component: () => import('@/components/userPersonalCenter/components/CardFlipActivity.vue'),
meta: {
title: '每周邀请',
},
},
{
path: 'activation',
name: 'consoleActivation',
component: () => import('@/components/userPersonalCenter/components/ActivationCode.vue'),
meta: {
title: '激活码兑换',
},
},
{
path: 'channel',
name: 'consoleChannel',
component: () => import('@/pages/console/channel/index.vue'),
meta: {
title: '渠道商管理',
},
},
2025-12-28 22:42:17 +08:00
],
},
2025-06-17 22:37:37 +08:00
],
},
];
// staticRouter[静态路由] 预留
export const staticRouter: RouteRecordRaw[] = [];
// 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'),
},
];