Explorar el Código

feat: 路由添加

zhanghaijun hace 1 año
padre
commit
bd1642372b

+ 1 - 1
.vscode/vue3.code-snippets

@@ -9,7 +9,7 @@
       "@creationTime: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}",
       "-->\n",
       "<template>",
-      "  <view>$3</view>",
+      "  <div>$3</div>",
       "</template>\n",
       "<script lang=\"ts\" setup>",
       "defineOptions({ name: '$1' })",

+ 2 - 6
src/router/routes/asyncRoutes.ts

@@ -16,15 +16,11 @@ import { AppRouteRecord } from '@/types/router'
 type RouteModuleType = {
   default: AppRouteRecord[]
 }
-const INGORE_MODULES = ['examples']
+const INGORE_MODULES = ['examples', 'sys']
 const modules: any = import.meta.glob('./modules/**/**.ts', { eager: true })
 const moduleRuotes: AppRouteRecord[] = []
 Object.keys(modules)
-  .filter((key) => {
-    return !INGORE_MODULES.some((item) => {
-      return key.includes(item)
-    })
-  })
+  .filter((key) => !INGORE_MODULES.some((item) => key.includes(item)))
   .forEach((key) => {
     const mod = modules[key] as RouteModuleType
     const modList = mod.default ?? []

+ 85 - 0
src/router/routes/modules/train.ts

@@ -0,0 +1,85 @@
+import { RoutesAlias } from '@/router/routesAlias'
+import { AppRouteRecord } from '@/types/router'
+
+export const routes: AppRouteRecord[] = [
+  {
+    path: '/monitor',
+    name: 'monitor',
+    component: RoutesAlias.Layout,
+    meta: { title: '系统监控', icon: 'ant-design:dashboard-outlined' },
+    children: [
+      {
+        path: 'run',
+        name: 'monitor:run',
+        component: '/train/monitor/course',
+        meta: { title: '课程运行', icon: 'ant-design:dashboard-outlined' }
+      },
+      {
+        path: '/device',
+        name: 'monitor:device',
+        component: '/train/monitor/device',
+        meta: { title: '设备监控', icon: 'ant-design:desktop-outlined' }
+      }
+    ]
+  },
+  {
+    path: '/course',
+    name: 'course',
+    component: RoutesAlias.Layout,
+    meta: { title: '课程管理', icon: 'ant-design:book-outlined' },
+    children: [
+      {
+        path: 'list',
+        name: 'course:list',
+        component: '/train/course/index',
+        meta: { title: '课程列表', icon: 'ant-design:book-outlined' }
+      },
+      {
+        path: 'detail/:id',
+        name: 'course:detail',
+        component: '/train/course/detail',
+        meta: { title: '课程详情', hiddenInMenu: true, keepAlive: false }
+      },
+      {
+        path: 'evaluate',
+        name: 'course/evaluate',
+        component: '/train/course/evaluate',
+        meta: { title: '评价管理', icon: 'ant-design:message-outlined' }
+      }
+    ]
+  },
+  {
+    path: '/plan',
+    name: 'plan',
+    component: RoutesAlias.Layout,
+    meta: { title: '培训计划', icon: 'ant-design:profile-outlined' },
+    children: [
+      {
+        path: 'list',
+        name: 'plan/list',
+        component: '/train/plan/index',
+        meta: { title: '计划列表', icon: 'ant-design:profile-outlined' }
+      },
+      {
+        path: 'detail/:id',
+        name: 'plan:detail',
+        component: '/train/plan/detail',
+        meta: { title: '计划详情', hiddenInMenu: true, keepAlive: false }
+      }
+    ]
+  },
+  {
+    path: '/manager',
+    name: 'manager',
+    component: RoutesAlias.Layout,
+    meta: { title: '系统设置', icon: 'ant-design:setting-outlined' },
+    children: [
+      {
+        path: 'user',
+        name: 'manager:user',
+        component: '/train/manager/user',
+        meta: { title: '管理员列表', icon: 'ant-design:user-outlined' }
+      }
+    ]
+  }
+]

+ 17 - 0
src/views/train/course/detail.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 课程详情
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <view>课程详情</view>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '课程详情' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/course/evaluate.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 课程评价
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <view>课程评价</view>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '课程评价' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/course/index.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 课程列表
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <view>课程列表</view>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '课程列表' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/manager/user.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 用户列表
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <view>用户列表</view>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '用户列表' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/monitor/course.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 课程监控
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <div>课程监控</div>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '课程监控' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/monitor/device.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 设备监控
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <div>设备监控</div>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '设备监控' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/plan/detail.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 计划详情
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <view>计划详情</view>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '计划详情' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>

+ 17 - 0
src/views/train/plan/index.vue

@@ -0,0 +1,17 @@
+<!--
+@description: 计划列表
+@creationTime: 2025-09-23
+-->
+
+<template>
+  <view>计划列表</view>
+</template>
+
+<script lang="ts" setup>
+  defineOptions({ name: '计划列表' })
+  /* ------------------------ 导入 与 引用 ----------------------------------- */
+  /* ------------------------ 函数 与 方法 ----------------------------------- */
+  /* ------------------------- 生命周期 -------------------------------------- */
+</script>
+
+<style lang="scss" scoped></style>