mirror of
https://github.com/PlayEdu/backend
synced 2025-07-08 13:42:47 +08:00
重构
This commit is contained in:
parent
e7421f67cc
commit
9f90bd75d3
@ -1,6 +1,7 @@
|
|||||||
|
import { Suspense } from "react";
|
||||||
import styles from "./App.module.less";
|
import styles from "./App.module.less";
|
||||||
import { useRoutes } from "react-router-dom";
|
import { useRoutes } from "react-router-dom";
|
||||||
import routes from "./router/routes";
|
import routes from "./routes";
|
||||||
import { getToken } from "./utils/index";
|
import { getToken } from "./utils/index";
|
||||||
import { login } from "./api/index";
|
import { login } from "./api/index";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
@ -9,9 +10,11 @@ import {
|
|||||||
SetUserActionCreator,
|
SetUserActionCreator,
|
||||||
SetPermisssionsActionCreator,
|
SetPermisssionsActionCreator,
|
||||||
} from "./store/user/userActions";
|
} from "./store/user/userActions";
|
||||||
|
import LoadingPage from "./pages/loading";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const Views = () => useRoutes(routes);
|
const Views = () => useRoutes(routes);
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const getUser = () => {
|
const getUser = () => {
|
||||||
login.getUser().then((res: any) => {
|
login.getUser().then((res: any) => {
|
||||||
@ -26,9 +29,11 @@ function App() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Suspense fallback={<LoadingPage />}>
|
||||||
<div className={styles.App}>
|
<div className={styles.App}>
|
||||||
<Views />
|
<Views />
|
||||||
</div>
|
</div>
|
||||||
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import React from "react";
|
|
||||||
import { Row, Col, Form, Input, Button, message } from "antd";
|
import { Row, Col, Form, Input, Button, message } from "antd";
|
||||||
import styles from "./create.module.less";
|
// import styles from "./create.module.less";
|
||||||
import { login } from "../../api/index";
|
import { login } from "../../api/index";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { BackBartment } from "../../compenents";
|
import { BackBartment } from "../../compenents";
|
||||||
|
|
||||||
export const ChangePasswordPage: React.FC = () => {
|
const ChangePasswordPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
@ -74,3 +73,5 @@ export const ChangePasswordPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default ChangePasswordPage;
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
Dropdown,
|
Dropdown,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { course } from "../../api";
|
import { course } from "../../api";
|
||||||
import styles from "./index.module.less";
|
// import styles from "./index.module.less";
|
||||||
import {
|
import {
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
DownOutlined,
|
DownOutlined,
|
||||||
@ -21,7 +21,7 @@ import {
|
|||||||
import type { MenuProps } from "antd";
|
import type { MenuProps } from "antd";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import { dateFormat } from "../../utils/index";
|
import { dateFormat } from "../../utils/index";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
import { CourseCreate } from "./compenents/create";
|
import { CourseCreate } from "./compenents/create";
|
||||||
@ -39,7 +39,7 @@ interface DataType {
|
|||||||
is_show: number;
|
is_show: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CoursePage = () => {
|
const CoursePage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [list, setList] = useState<any>([]);
|
const [list, setList] = useState<any>([]);
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
@ -423,3 +423,5 @@ export const CoursePage = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default CoursePage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import { Row, Col } from "antd";
|
import { Row, Col } from "antd";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
@ -12,7 +12,7 @@ import { dashboard } from "../../api/index";
|
|||||||
import { timeFormat } from "../../utils/index";
|
import { timeFormat } from "../../utils/index";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
|
||||||
export const Dashboard: React.FC<any> = () => {
|
const DashboardPage = () => {
|
||||||
let chartRef = useRef(null);
|
let chartRef = useRef(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [basicData, setBasicData] = useState<any>([]);
|
const [basicData, setBasicData] = useState<any>([]);
|
||||||
@ -536,3 +536,5 @@ export const Dashboard: React.FC<any> = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default DashboardPage;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Spin, Button, Tree, Modal, message, Tooltip } from "antd";
|
import { Spin, Button, Tree, Modal, message, Tooltip } from "antd";
|
||||||
import styles from "./index.module.less";
|
// import styles from "./index.module.less";
|
||||||
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import { department } from "../../api/index";
|
import { department } from "../../api/index";
|
||||||
import { PerButton } from "../../compenents";
|
import { PerButton } from "../../compenents";
|
||||||
@ -18,14 +18,7 @@ interface Option {
|
|||||||
children?: Option[];
|
children?: Option[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataType {
|
const DepartmentPage = () => {
|
||||||
id: React.Key;
|
|
||||||
name: string;
|
|
||||||
created_at: string;
|
|
||||||
sort: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DepartmentPage: React.FC = () => {
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const permisssions = useSelector((state: any) => state.permisssions);
|
const permisssions = useSelector((state: any) => state.permisssions);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
@ -398,3 +391,5 @@ export const DepartmentPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default DepartmentPage;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { Button, Result } from "antd";
|
import { Button, Result } from "antd";
|
||||||
import React from "react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
|
|
||||||
export const ErrorPage: React.FC<any> = () => {
|
const ErrorPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -25,3 +24,5 @@ export const ErrorPage: React.FC<any> = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default ErrorPage;
|
||||||
|
@ -3,7 +3,7 @@ import styles from "./index.module.less";
|
|||||||
import { Outlet } from "react-router-dom";
|
import { Outlet } from "react-router-dom";
|
||||||
import { Header, LeftMenu } from "../../compenents";
|
import { Header, LeftMenu } from "../../compenents";
|
||||||
|
|
||||||
export const HomePage: React.FC = () => {
|
const HomePage = () => {
|
||||||
useEffect(() => {}, []);
|
useEffect(() => {}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -25,3 +25,5 @@ export const HomePage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default HomePage;
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
export * from "./home";
|
|
||||||
export * from "./login";
|
|
||||||
export * from "./dashboard";
|
|
||||||
export * from "./error";
|
|
||||||
export * from "./test";
|
|
||||||
export * from "./course/index";
|
|
||||||
export * from "./member/index";
|
|
||||||
export * from "./member/import";
|
|
||||||
export * from "./system/config/index";
|
|
||||||
export * from "./system/administrator/index";
|
|
||||||
export * from "./system/adminroles/index";
|
|
||||||
export * from "./department";
|
|
||||||
export * from "./change-password";
|
|
||||||
export * from "./resource/images";
|
|
||||||
export * from "./resource/resource-category/index";
|
|
||||||
export * from "./resource/videos";
|
|
||||||
|
|
7
src/pages/init/index.tsx
Normal file
7
src/pages/init/index.tsx
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
const InitPage = () => {
|
||||||
|
return <><Outlet /></>
|
||||||
|
};
|
||||||
|
|
||||||
|
export default InitPage;
|
11
src/pages/loading/index.tsx
Normal file
11
src/pages/loading/index.tsx
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { Spin } from "antd";
|
||||||
|
|
||||||
|
const LoadingPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Spin />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoadingPage;
|
@ -14,7 +14,7 @@ import banner from "../../assets/images/login/banner.png";
|
|||||||
import icon from "../../assets/images/login/icon.png";
|
import icon from "../../assets/images/login/icon.png";
|
||||||
import "./login.less";
|
import "./login.less";
|
||||||
|
|
||||||
export const Login: React.FC = () => {
|
const LoginPage = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
@ -166,3 +166,5 @@ export const Login: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default LoginPage;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import { useState } from "react";
|
||||||
import * as XLSX from "xlsx";
|
import * as XLSX from "xlsx";
|
||||||
import { Row, Col, Form, Input, Cascader, Button, Upload, message } from "antd";
|
import { Row, Col, Button, Upload, message } from "antd";
|
||||||
import { BackBartment } from "../../compenents";
|
import { BackBartment } from "../../compenents";
|
||||||
import { user } from "../../api/index";
|
import { user } from "../../api/index";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { getHost } from "../../utils/index";
|
import { getHost } from "../../utils/index";
|
||||||
|
|
||||||
export const MemberImportPage: React.FC = () => {
|
const MemberImportPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [tableData, setWageTableData] = useState<any>([]);
|
const [tableData, setWageTableData] = useState<any>([]);
|
||||||
const [errorData, setErrorData] = useState<any>([]);
|
const [errorData, setErrorData] = useState<any>([]);
|
||||||
@ -106,3 +106,5 @@ export const MemberImportPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default MemberImportPage;
|
||||||
|
@ -30,7 +30,7 @@ interface DataType {
|
|||||||
is_lock: number;
|
is_lock: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MemberPage: React.FC = () => {
|
const MemberPage = () => {
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [size, setSize] = useState(10);
|
const [size, setSize] = useState(10);
|
||||||
@ -303,3 +303,5 @@ export const MemberPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default MemberPage;
|
||||||
|
@ -31,7 +31,7 @@ interface ImageItem {
|
|||||||
created_at: string;
|
created_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ResourceImagesPage = () => {
|
const ResourceImagesPage = () => {
|
||||||
const [imageList, setImageList] = useState<ImageItem[]>([]);
|
const [imageList, setImageList] = useState<ImageItem[]>([]);
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
@ -273,3 +273,5 @@ export const ResourceImagesPage = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default ResourceImagesPage;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Spin, Button, Tree, Modal, message, Tooltip } from "antd";
|
import { Button, Tree, Modal, message, Tooltip } from "antd";
|
||||||
import styles from "./index.module.less";
|
// import styles from "./index.module.less";
|
||||||
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import { resourceCategory } from "../../../api/index";
|
import { resourceCategory } from "../../../api/index";
|
||||||
import { PerButton } from "../../../compenents";
|
import { PerButton } from "../../../compenents";
|
||||||
@ -18,14 +18,7 @@ interface Option {
|
|||||||
children?: Option[];
|
children?: Option[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataType {
|
const ResourceCategoryPage = () => {
|
||||||
id: React.Key;
|
|
||||||
name: string;
|
|
||||||
created_at: string;
|
|
||||||
sort: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ResourceCategoryPage: React.FC = () => {
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const permisssions = useSelector((state: any) => state.permisssions);
|
const permisssions = useSelector((state: any) => state.permisssions);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
@ -406,3 +399,5 @@ export const ResourceCategoryPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default ResourceCategoryPage;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Button, Modal, Table, message, Space } from "antd";
|
import { Modal, Table, message, Space } from "antd";
|
||||||
import { resource } from "../../../api";
|
import { resource } from "../../../api";
|
||||||
import styles from "./index.module.less";
|
// import styles from "./index.module.less";
|
||||||
import { ExclamationCircleFilled } from "@ant-design/icons";
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import { dateFormat } from "../../../utils/index";
|
import { dateFormat } from "../../../utils/index";
|
||||||
@ -18,7 +18,7 @@ interface DataType {
|
|||||||
disk: string;
|
disk: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ResourceVideosPage = () => {
|
const ResourceVideosPage = () => {
|
||||||
const [videoList, setVideoList] = useState<any>([]);
|
const [videoList, setVideoList] = useState<any>([]);
|
||||||
const [videosExtra, setVideoExtra] = useState<any>([]);
|
const [videosExtra, setVideoExtra] = useState<any>([]);
|
||||||
const [adminUsers, setAdminUsers] = useState<any>({});
|
const [adminUsers, setAdminUsers] = useState<any>({});
|
||||||
@ -203,3 +203,5 @@ export const ResourceVideosPage = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default ResourceVideosPage;
|
||||||
|
@ -20,7 +20,7 @@ interface DataType {
|
|||||||
is_ban_login: number;
|
is_ban_login: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SystemAdministratorPage: React.FC = () => {
|
const SystemAdministratorPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
@ -228,3 +228,5 @@ export const SystemAdministratorPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default SystemAdministratorPage;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Button, Space, Table, Modal, message } from "antd";
|
import { Button, Space, Table, Modal, message } from "antd";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import styles from "./index.module.less";
|
// import styles from "./index.module.less";
|
||||||
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import { adminRole } from "../../../api/index";
|
import { adminRole } from "../../../api/index";
|
||||||
import { dateFormat } from "../../../utils/index";
|
import { dateFormat } from "../../../utils/index";
|
||||||
@ -17,7 +17,7 @@ interface DataType {
|
|||||||
created_at: string;
|
created_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SystemAdminrolesPage: React.FC = () => {
|
const SystemAdminrolesPage = () => {
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [list, setList] = useState<any>([]);
|
const [list, setList] = useState<any>([]);
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
@ -153,3 +153,5 @@ export const SystemAdminrolesPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default SystemAdminrolesPage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import {
|
import {
|
||||||
Row,
|
Row,
|
||||||
Form,
|
Form,
|
||||||
@ -17,7 +17,7 @@ import { UploadImageButton } from "../../../compenents";
|
|||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
import type { CheckboxChangeEvent } from "antd/es/checkbox";
|
import type { CheckboxChangeEvent } from "antd/es/checkbox";
|
||||||
|
|
||||||
export const SystemIndexPage: React.FC = () => {
|
const SystemConfigPage = () => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [logo, setLogo] = useState<string>("");
|
const [logo, setLogo] = useState<string>("");
|
||||||
@ -367,3 +367,5 @@ export const SystemIndexPage: React.FC = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default SystemConfigPage;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React from "react";
|
|
||||||
import { UploadVideoButton } from "../../compenents/upload-video-button";
|
import { UploadVideoButton } from "../../compenents/upload-video-button";
|
||||||
|
|
||||||
export const TestPage: React.FC = () => {
|
const TestPage = () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<UploadVideoButton
|
<UploadVideoButton
|
||||||
@ -13,3 +12,5 @@ export const TestPage: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default TestPage;
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
import { RouteObject } from "react-router-dom";
|
|
||||||
import {
|
|
||||||
Login,
|
|
||||||
HomePage,
|
|
||||||
Dashboard,
|
|
||||||
ErrorPage,
|
|
||||||
CoursePage,
|
|
||||||
TestPage,
|
|
||||||
MemberPage,
|
|
||||||
MemberImportPage,
|
|
||||||
SystemAdministratorPage,
|
|
||||||
SystemAdminrolesPage,
|
|
||||||
DepartmentPage,
|
|
||||||
ChangePasswordPage,
|
|
||||||
ResourceImagesPage,
|
|
||||||
ResourceCategoryPage,
|
|
||||||
ResourceVideosPage,
|
|
||||||
SystemIndexPage,
|
|
||||||
} from "../pages";
|
|
||||||
|
|
||||||
const routes: RouteObject[] = [
|
|
||||||
{
|
|
||||||
path: "/",
|
|
||||||
element: <HomePage />,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "/",
|
|
||||||
element: <Dashboard />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/change-password",
|
|
||||||
element: <ChangePasswordPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/resource-category",
|
|
||||||
element: <ResourceCategoryPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/images",
|
|
||||||
element: <ResourceImagesPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/videos",
|
|
||||||
element: <ResourceVideosPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/course",
|
|
||||||
element: <CoursePage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/member",
|
|
||||||
element: <MemberPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/member/import",
|
|
||||||
element: <MemberImportPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/system/config/index",
|
|
||||||
element: <SystemIndexPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/system/administrator",
|
|
||||||
element: <SystemAdministratorPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/system/adminroles",
|
|
||||||
element: <SystemAdminrolesPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/department",
|
|
||||||
element: <DepartmentPage />,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/login",
|
|
||||||
element: <Login />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/test",
|
|
||||||
element: <TestPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "*",
|
|
||||||
element: <ErrorPage />,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default routes;
|
|
102
src/routes/index.tsx
Normal file
102
src/routes/index.tsx
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
import { lazy } from "react";
|
||||||
|
import { RouteObject } from "react-router-dom";
|
||||||
|
|
||||||
|
import InitPage from "../pages/init";
|
||||||
|
|
||||||
|
const LoginPage = lazy(() => import("../pages/login"));
|
||||||
|
const HomePage = lazy(() => import("../pages/home"));
|
||||||
|
const DashboardPage = lazy(() => import("../pages/dashboard"));
|
||||||
|
const ErrorPage = lazy(() => import("../pages/error"));
|
||||||
|
const CoursePage = lazy(() => import("../pages/course"));
|
||||||
|
const TestPage = lazy(() => import("../pages/test"));
|
||||||
|
const MemberPage = lazy(() => import("../pages/member"));
|
||||||
|
const MemberImportPage = lazy(() => import("../pages/member/import"));
|
||||||
|
const SystemAdministratorPage = lazy(
|
||||||
|
() => import("../pages/system/administrator")
|
||||||
|
);
|
||||||
|
const SystemAdminrolesPage = lazy(() => import("../pages/system/adminroles"));
|
||||||
|
const DepartmentPage = lazy(() => import("../pages/department"));
|
||||||
|
const ChangePasswordPage = lazy(() => import("../pages/change-password"));
|
||||||
|
const ResourceImagesPage = lazy(() => import("../pages/resource/images"));
|
||||||
|
const ResourceCategoryPage = lazy(
|
||||||
|
() => import("../pages/resource/resource-category")
|
||||||
|
);
|
||||||
|
const ResourceVideosPage = lazy(() => import("../pages/resource/videos"));
|
||||||
|
const SystemConfigPage = lazy(() => import("../pages/system/config"));
|
||||||
|
|
||||||
|
const routes: RouteObject[] = [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <InitPage />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <HomePage />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <DashboardPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/change-password",
|
||||||
|
element: <ChangePasswordPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/resource-category",
|
||||||
|
element: <ResourceCategoryPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/images",
|
||||||
|
element: <ResourceImagesPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/videos",
|
||||||
|
element: <ResourceVideosPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/course",
|
||||||
|
element: <CoursePage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/member",
|
||||||
|
element: <MemberPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/member/import",
|
||||||
|
element: <MemberImportPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/system/config/index",
|
||||||
|
element: <SystemConfigPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/system/administrator",
|
||||||
|
element: <SystemAdministratorPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/system/adminroles",
|
||||||
|
element: <SystemAdminrolesPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/department",
|
||||||
|
element: <DepartmentPage />,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/login",
|
||||||
|
element: <LoginPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/test",
|
||||||
|
element: <TestPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "*",
|
||||||
|
element: <ErrorPage />,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default routes;
|
Loading…
x
Reference in New Issue
Block a user