| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import type { Route } from '#/global'
- import type { RouteRecordRaw } from 'vue-router'
- import generatedRoutes from 'virtual:generated-pages'
- import { setupLayouts } from 'virtual:meta-layouts'
- import RoleManagement from './modules/role'
- import VoiceManagement from './modules/voice'
- import Recomendation from './modules/recomendation'
- import Model from './modules/model/model'
- import GlobalPrompt from './modules/model/globalPrompt'
- import tag from './modules/model/tag'
- function Layout() {
- return import('@/layouts/index.vue')
- }
- // 固定路由(默认路由)
- const constantRoutes: RouteRecordRaw[] = [
- {
- path: '/login',
- name: 'login',
- component: () => import('@/views/login.vue'),
- meta: {
- title: '登录',
- },
- },
- {
- path: '/:all(.*)*',
- name: 'notFound',
- component: () => import('@/views/[...all].vue'),
- meta: {
- title: '找不到页面',
- },
- },
- ]
- // 系统路由
- const systemRoutes: RouteRecordRaw[] = [
- {
- path: '/',
- component: () => import('@/layouts/index.vue'),
- meta: {
- title: () => useSettingsStore().settings.home.title,
- breadcrumb: false,
- },
- children: [
- {
- path: '',
- component: () => import('@/views/index.vue'),
- meta: {
- title: () => useSettingsStore().settings.home.title,
- icon: 'i-ant-design:home-twotone',
- breadcrumb: false,
- },
- },
- {
- path: 'reload',
- name: 'reload',
- component: () => import('@/views/reload.vue'),
- meta: {
- title: '重新加载',
- breadcrumb: false,
- },
- },
- ],
- },
- ]
- // 动态路由(异步路由、导航栏路由)
- const asyncRoutes: Route.recordMainRaw[] = [
- {
- meta: {
- title: 'Role',
- icon: 'i-mdi:robot-dead-outline',
- auth: '',
- },
- children: [
- RoleManagement,
- VoiceManagement,
- Recomendation,
- ],
- },
- {
- meta: {
- title: 'LLM',
- icon: 'i-hugeicons:brain-02',
- },
- children: [
- Model,
- GlobalPrompt,
- tag,
- ],
- },
- ]
- const constantRoutesByFilesystem = generatedRoutes.filter((item) => {
- return item.meta?.enabled !== false && item.meta?.constant === true
- })
- const asyncRoutesByFilesystem = setupLayouts(generatedRoutes.filter((item) => {
- return item.meta?.enabled !== false && item.meta?.constant !== true && item.meta?.layout !== false
- }))
- export {
- asyncRoutes,
- asyncRoutesByFilesystem,
- constantRoutes,
- constantRoutesByFilesystem,
- systemRoutes,
- }
|