import {
createBrowserRouter,
IndexRouteObject,
Link,
NonIndexRouteObject,
} from "react-router-dom";
import { RolePerms } from "@nice/common";
import ErrorPage from "../app/error";
import DepartmentAdminPage from "../app/admin/department/page";
import TermAdminPage from "../app/admin/term/page";
import StaffAdminPage from "../app/admin/staff/page";
import RoleAdminPage from "../app/admin/role/page";
import WithAuth from "../components/utils/with-auth";
import LoginPage from "../app/login";
import BaseSettingPage from "../app/admin/base-setting/page";
import { MainLayout } from "../components/layout/main/MainLayout";
import StudentCoursesPage from "../app/main/courses/student/page";
import InstructorCoursesPage from "../app/main/courses/instructor/page";
import HomePage from "../app/main/home/page";
import { CourseDetailPage } from "../app/main/course/detail/page";
import { CourseBasicForm } from "../components/models/course/editor/form/CourseBasicForm";
import CourseContentForm from "../components/models/course/editor/form/CourseContentForm";
import { CourseGoalForm } from "../components/models/course/editor/form/CourseGoalForm";
import CourseSettingForm from "../components/models/course/editor/form/CourseSettingForm";
import CourseEditorLayout from "../components/models/course/editor/layout/CourseEditorLayout";
interface CustomIndexRouteObject extends IndexRouteObject {
name?: string;
breadcrumb?: string;
}
interface CustomIndexRouteObject extends IndexRouteObject {
name?: string;
breadcrumb?: string;
}
export interface CustomNonIndexRouteObject extends NonIndexRouteObject {
name?: string;
children?: CustomRouteObject[];
breadcrumb?: string;
handle?: {
crumb: (data?: any) => void;
};
}
export type CustomRouteObject =
| CustomIndexRouteObject
| CustomNonIndexRouteObject;
export const routes: CustomRouteObject[] = [
{
path: "/",
errorElement: ,
handle: {
crumb() {
return 主页;
},
},
children: [
{
element: ,
children: [
{
index: true,
element: ,
},
{
path: "courses",
children: [
{
path: "student",
element: (
),
},
{
path: "instructor",
element: (
),
},
],
},
],
},
{
path: "course",
children: [
{
path: ":id?/editor",
element: ,
children: [{
index: true,
element:
},
{
path: 'goal',
element:
},
{
path: 'content',
element:
},
{
path: 'setting',
element:
}
]
},
{
path: ":id?/detail", // 使用 ? 表示 id 参数是可选的
element: ,
},
],
},
{
path: "admin",
children: [
{
path: "base-setting",
element: (
),
handle: {
crumb() {
return (
基本设置
);
},
},
},
{
path: "department",
breadcrumb: "单位管理",
element: (
),
handle: {
crumb() {
return (
组织架构
);
},
},
},
{
path: "staff",
element: (
),
handle: {
crumb() {
return (
用户管理
);
},
},
},
{
path: "term",
breadcrumb: "分类配置",
element: (
),
handle: {
crumb() {
return 分类配置;
},
},
},
{
path: "role",
breadcrumb: "角色管理",
element: (
),
handle: {
crumb() {
return 角色管理;
},
},
},
],
},
],
},
{
path: "/login",
breadcrumb: "登录",
element: ,
},
];
export const router = createBrowserRouter(routes);