学员、线上课编辑优化

This commit is contained in:
禺狨 2023-03-10 14:17:00 +08:00
parent 8fd8b597f5
commit f34c57dc30
7 changed files with 155 additions and 4 deletions

View File

@ -55,6 +55,7 @@ const items = [
<SettingOutlined />, <SettingOutlined />,
[ [
getItem("管理人员", "/system/administrator", null, null, null), getItem("管理人员", "/system/administrator", null, null, null),
getItem("系统配置", "/system/index", null, null, null),
getItem("角色配置", "/system/adminroles", null, null, null), getItem("角色配置", "/system/adminroles", null, null, null),
], ],
null null
@ -72,6 +73,7 @@ const children2Parent: any = {
"/system/administrator": ["6"], "/system/administrator": ["6"],
"/system/adminroles": ["6"], "/system/adminroles": ["6"],
"/system/index": ["6"],
}; };
export const LeftMenu: React.FC = () => { export const LeftMenu: React.FC = () => {

View File

@ -56,7 +56,9 @@ export const CourseUpdatePage: React.FC = () => {
for (let i = 0; i < box.length; i++) { for (let i = 0; i < box.length; i++) {
let item = checkChild(deps, box[i]); let item = checkChild(deps, box[i]);
let arr: any[] = []; let arr: any[] = [];
if (item.parent_chain === "") { if (item === undefined) {
arr.push(box[i]);
} else if (item.parent_chain === "") {
arr.push(box[i]); arr.push(box[i]);
} else { } else {
let new_arr = item.parent_chain.split(","); let new_arr = item.parent_chain.split(",");
@ -76,7 +78,9 @@ export const CourseUpdatePage: React.FC = () => {
for (let i = 0; i < box2.length; i++) { for (let i = 0; i < box2.length; i++) {
let item = checkChild(cats, box2[i]); let item = checkChild(cats, box2[i]);
let arr: any[] = []; let arr: any[] = [];
if (item.parent_chain === "") { if (item === undefined) {
arr.push(box2[i]);
} else if (item.parent_chain === "") {
arr.push(box2[i]); arr.push(box2[i]);
} else { } else {
let new_arr = item.parent_chain.split(","); let new_arr = item.parent_chain.split(",");

View File

@ -10,6 +10,7 @@ export * from "./member/index";
export * from "./member/create"; export * from "./member/create";
export * from "./member/update"; export * from "./member/update";
export * from "./member/import"; export * from "./member/import";
export * from "./system/index";
export * from "./system/administrator/index"; export * from "./system/administrator/index";
export * from "./system/administrator/create"; export * from "./system/administrator/create";
export * from "./system/administrator/update"; export * from "./system/administrator/update";

View File

@ -44,7 +44,9 @@ export const MemberUpdatePage: React.FC = () => {
for (let i = 0; i < box.length; i++) { for (let i = 0; i < box.length; i++) {
let item = checkChild(deps, box[i]); let item = checkChild(deps, box[i]);
let arr: any[] = []; let arr: any[] = [];
if (item.parent_chain === "") { if (item === undefined) {
arr.push(box[i]);
} else if (item.parent_chain === "") {
arr.push(box[i]); arr.push(box[i]);
} else { } else {
let new_arr = item.parent_chain.split(","); let new_arr = item.parent_chain.split(",");

View File

@ -0,0 +1,45 @@
.title {
width: 100%;
height: 16px;
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 16px;
margin-bottom: 24px;
}
.body {
width: 100%;
height: auto;
box-sizing: border-box;
display: grid;
gap: 20px;
grid-template-columns: repeat(5, minmax(0, 1fr));
.item {
width: auto;
height: 88px;
background: #f3f4f5;
box-shadow: 0px 2px 4px 0px rgba(102, 102, 102, 0.05);
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
box-sizing: border-box;
padding-left: 30px;
cursor: pointer;
&:hover {
opacity: 0.8;
}
img {
width: 48px;
height: 48px;
margin-right: 20px;
}
span {
height: 16px;
font-size: 16px;
font-weight: 400;
color: #333333;
line-height: 16px;
}
}
}

View File

@ -0,0 +1,92 @@
import React, { useState, useEffect } from "react";
import { Button, Space, Col, Empty } from "antd";
import type { ColumnsType } from "antd/es/table";
import styles from "./index.module.less";
import { PlusOutlined, ReloadOutlined } from "@ant-design/icons";
import { appConfig } from "../../api/index";
import { dateFormat } from "../../utils/index";
import { Link, useNavigate } from "react-router-dom";
interface DataType {
id: React.Key;
name: string;
created_at: string;
}
export const SystemIndexPage: React.FC = () => {
const navigate = useNavigate();
const [loading, setLoading] = useState<boolean>(true);
const [list, setList] = useState<any>([]);
const [refresh, setRefresh] = useState(false);
const columns: ColumnsType<DataType> = [
{
title: "角色名",
dataIndex: "name",
render: (text: string) => <span>{text}</span>,
},
{
title: "时间",
dataIndex: "created_at",
render: (text: string) => <span>{text && dateFormat(text)}</span>,
},
{
title: "操作",
key: "action",
fixed: "right",
width: 160,
render: (_, record) => (
<Space size="small">
<Button
type="link"
danger
className="b-link c-red"
onClick={() => navigate(`/system/adminroles/update/${record.id}`)}
>
</Button>
</Space>
),
},
];
useEffect(() => {
getData();
}, [refresh]);
const getData = () => {
setLoading(true);
appConfig.appConfig().then((res: any) => {
setList(res.data);
setLoading(false);
});
};
const resetData = () => {
setList([]);
setRefresh(!refresh);
};
return (
<>
<div className="playedu-main-body">
<div className={styles["title"]}></div>
{list.length === 0 && (
<Col span={24}>
<Empty description="暂无配置" />
</Col>
)}
<div className={styles["body"]}>
{list.map((item: any, index: number) => {
return (
<div key={index} className={styles["item"]}>
<img src={item.images} />
<span>{item.name}</span>
</div>
);
})}
</div>
</div>
</>
);
};

View File

@ -27,6 +27,7 @@ import {
ResourceCategoryCreatePage, ResourceCategoryCreatePage,
ResourceCategoryUpdatePage, ResourceCategoryUpdatePage,
ResourceVideosPage, ResourceVideosPage,
SystemIndexPage
} from "../pages"; } from "../pages";
const routes: RouteObject[] = [ const routes: RouteObject[] = [
@ -91,6 +92,10 @@ const routes: RouteObject[] = [
path: "/member/import", path: "/member/import",
element: <MemberImportPage />, element: <MemberImportPage />,
}, },
{
path: "/system/index",
element: <SystemIndexPage />,
},
{ {
path: "/system/administrator", path: "/system/administrator",
element: <SystemAdministratorPage />, element: <SystemAdministratorPage />,