From c18f4f511a885eb75cc394e516a53bb3ca8a0fb5 Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期四, 27 八月 2026 15:54:05 +0800
Subject: [PATCH] fix0806: 调整课程菜单全部子菜单
---
tcm-training-admin/src/app.tsx | 13 ++++
tcm-training-admin/config/routes.ts | 152 ++++++++++++++++++++++++++------------------------
2 files changed, 91 insertions(+), 74 deletions(-)
diff --git a/tcm-training-admin/config/routes.ts b/tcm-training-admin/config/routes.ts
index ce3e2c3..8b51e35 100644
--- a/tcm-training-admin/config/routes.ts
+++ b/tcm-training-admin/config/routes.ts
@@ -273,26 +273,21 @@
},
{
path: '/live',
- name: '课程与学习',
+ name: '内容',
icon: 'read',
access: 'canViewLiveModule',
routes: [
{
path: '/live',
- redirect: '/live/course',
+ redirect: '/live/course/broadcast',
},
{
path: '/live/expert',
redirect: '/live/course/expert',
},
{
- path: '/live/course',
- name: '课程管理',
+ name: '类直播',
routes: [
- {
- path: '/live/course',
- redirect: '/live/course/broadcast',
- },
{
name: '养生直播',
path: '/live/course/broadcast',
@@ -314,36 +309,67 @@
component: './live/broadcast/edit',
},
{
- name: '微赞直播间设置',
- path: '/live/course/live-room-setting',
- access: 'live:room-setting:view',
- component: './live/live-room-setting',
- }, {
- name: '直播预约记录',
+ name: '预约记录',
path: '/live/course/reserve-records',
access: 'live:reserve:view',
component: './live/reserve-records',
},
{
- name: '直播观看记录',
+ name: '观看记录',
path: '/live/course/watch-records',
access: 'live:watch:view',
component: './live/watch-records',
},
{
- name: '分类管理',
+ name: '直播预约记录跳转',
+ path: '/live/course/broadcast/:courseId/sessions/:sessionId/reserves',
+ hideInMenu: true,
+ access: 'live:reserve:view',
+ component: './live/record-redirect',
+ },
+ {
+ name: '直播观看记录跳转',
+ path: '/live/course/broadcast/:courseId/sessions/:sessionId/watch-records',
+ hideInMenu: true,
+ access: 'live:watch:view',
+ component: './live/record-redirect',
+ },
+ ],
+ },
+ {
+ name: '微赞直播',
+ routes: [
+ {
+ name: '直播设置',
+ path: '/live/course/live-room-setting',
+ access: 'live:room-setting:view',
+ component: './live/live-room-setting',
+ },
+ ],
+ },
+ {
+ name: '课程',
+ routes: [
+ {
+ name: '添加分类',
path: '/live/course/category',
access: 'live:category:view',
component: './live/category',
},
{
- name: '养生课程',
+ name: '添加专家',
+ path: '/live/course/expert',
+ access: 'live:expert:view',
+ component: './live/expert',
+ },
+ {
+ name: '添加课堂',
path: '/live/course/health',
access: 'live:health-course:view',
component: './live/health',
},
{
- name: '视频与课程资源管理',
+ name: '添加视频',
path: '/live/course/video-resources',
access: 'live:health-course:view',
component: './live/video-resources',
@@ -397,61 +423,11 @@
access: 'live:health-course:video:edit',
component: './live/health/video-manage',
},
- {
- name: '直播预约记录跳转',
- path: '/live/course/broadcast/:courseId/sessions/:sessionId/reserves',
- hideInMenu: true,
- access: 'live:reserve:view',
- component: './live/record-redirect',
- },
- {
- name: '直播观看记录跳转',
- path: '/live/course/broadcast/:courseId/sessions/:sessionId/watch-records',
- hideInMenu: true,
- access: 'live:watch:view',
- component: './live/record-redirect',
- },
- {
- name: '授课专家管理',
- path: '/live/course/expert',
- access: 'live:expert:view',
- component: './live/expert',
- },
- {
- path: '/live/course/project-introduction/create',
- hideInMenu: true,
- redirect: '/live/promotion/project-introduction/create',
- },
- {
- path: '/live/course/project-introduction',
- hideInMenu: true,
- redirect: '/live/promotion/project-introduction',
- },
- {
- path: '/live/course/project-introduction-password',
- hideInMenu: true,
- redirect: '/live/promotion/project-introduction-password',
- },
- {
- path: '/live/course/health-popularization/create',
- hideInMenu: true,
- redirect: '/live/promotion/health-popularization/create',
- },
- {
- path: '/live/course/health-popularization',
- hideInMenu: true,
- redirect: '/live/promotion/health-popularization',
- },
],
},
{
- path: '/live/promotion',
- name: '宣传知识',
+ name: '科普',
routes: [
- {
- path: '/live/promotion',
- redirect: '/live/promotion/project-introduction',
- },
{
name: '健康知识',
path: '/live/promotion/health-popularization',
@@ -492,6 +468,17 @@
access: 'live:health-promotion:edit',
component: './live/health-promotion/manage',
},
+ ],
+ },
+ {
+ name: '项目',
+ routes: [
+ {
+ name: '项目密码',
+ path: '/live/promotion/project-introduction-password',
+ access: 'live:project-introduction:view',
+ component: './live/project-introduction-password',
+ },
{
name: '项目介绍',
path: '/live/promotion/project-introduction',
@@ -513,10 +500,29 @@
component: './live/project-introduction/manage',
},
{
- name: '项目介绍密码',
- path: '/live/promotion/project-introduction-password',
- access: 'live:project-introduction:view',
- component: './live/project-introduction-password',
+ path: '/live/course/project-introduction/create',
+ hideInMenu: true,
+ redirect: '/live/promotion/project-introduction/create',
+ },
+ {
+ path: '/live/course/project-introduction',
+ hideInMenu: true,
+ redirect: '/live/promotion/project-introduction',
+ },
+ {
+ path: '/live/course/project-introduction-password',
+ hideInMenu: true,
+ redirect: '/live/promotion/project-introduction-password',
+ },
+ {
+ path: '/live/course/health-popularization/create',
+ hideInMenu: true,
+ redirect: '/live/promotion/health-popularization/create',
+ },
+ {
+ path: '/live/course/health-popularization',
+ hideInMenu: true,
+ redirect: '/live/promotion/health-popularization',
},
],
},
diff --git a/tcm-training-admin/src/app.tsx b/tcm-training-admin/src/app.tsx
index f0c27c3..f60de8d 100644
--- a/tcm-training-admin/src/app.tsx
+++ b/tcm-training-admin/src/app.tsx
@@ -1,4 +1,4 @@
-import type { Settings as LayoutSettings } from '@ant-design/pro-components';
+import type { MenuDataItem, Settings as LayoutSettings } from '@ant-design/pro-components';
import { SettingDrawer } from '@ant-design/pro-components';
import type { RunTimeLayoutConfig } from '@umijs/max';
import { history } from '@umijs/max';
@@ -26,6 +26,16 @@
loading?: boolean;
};
+const ensureMenuKeys = (menuData: MenuDataItem[], parentKey = 'menu'): MenuDataItem[] =>
+ menuData.map((item, index) => {
+ const key = item.key || item.path || `${parentKey}-${String(item.name || index)}`;
+
+ return {
+ ...item,
+ key,
+ children: item.children ? ensureMenuKeys(item.children, String(key)) : item.children,
+ };
+ });
/**
* @see https://umijs.org/zh-CN/plugins/plugin-initial-state
@@ -79,6 +89,7 @@
);
},
...initialState?.settings,
+ menuDataRender: ensureMenuKeys,
pageTitleRender: () => '管理后台',
};
};
--
Gitblit v1.7.1