mirror of
https://github.com/PlayEdu/backend
synced 2025-06-28 08:05:03 +08:00
登录样式优化
This commit is contained in:
parent
be5b7fb24a
commit
d1d4d2c3bd
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 15 KiB |
@ -36,7 +36,7 @@ export function storeCourse(
|
||||
return client.post("/backend/v1/course/create", {
|
||||
title: title,
|
||||
thumb: thumb,
|
||||
isShow: isShow,
|
||||
is_show: isShow,
|
||||
dep_ids: depIds,
|
||||
category_ids: categoryIds,
|
||||
});
|
||||
@ -54,10 +54,10 @@ export function updateCourse(
|
||||
depIds: number[],
|
||||
categoryIds: number[]
|
||||
) {
|
||||
return client.post(`/backend/v1/course/${id}`, {
|
||||
return client.put(`/backend/v1/course/${id}`, {
|
||||
title: title,
|
||||
thumb: thumb,
|
||||
isShow: isShow,
|
||||
is_show: isShow,
|
||||
dep_ids: depIds,
|
||||
category_ids: categoryIds,
|
||||
});
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.4 KiB |
@ -21,6 +21,13 @@ function getItem(label: any, key: any, icon: any, children: any, type: any) {
|
||||
}
|
||||
const items = [
|
||||
getItem("首页概览", "/", <SettingOutlined />, null, null),
|
||||
getItem(
|
||||
"课程内容",
|
||||
"8",
|
||||
<AppstoreOutlined />,
|
||||
[getItem("课程", "/course", null, null, null)],
|
||||
null
|
||||
),
|
||||
getItem(
|
||||
"资源管理",
|
||||
"3",
|
||||
@ -55,7 +62,7 @@ const items = [
|
||||
),
|
||||
];
|
||||
|
||||
const rootSubmenuKeys = ["3", "4", "5", "6", "7"];
|
||||
const rootSubmenuKeys = ["3", "4", "5", "6", "7", "8"];
|
||||
|
||||
export const LeftMenu: React.FC = () => {
|
||||
//展开的subMenu
|
||||
|
@ -82,6 +82,18 @@ code {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
|
||||
.c-yellow {
|
||||
color: #e1a500;
|
||||
}
|
||||
|
||||
.c-green {
|
||||
color: #04c877;
|
||||
}
|
||||
|
||||
.c-gray {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.c-red {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
@ -91,6 +103,11 @@ code {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.form-course-thumb{
|
||||
width: 200px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.playedu-main-body {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
|
192
src/pages/course/create.tsx
Normal file
192
src/pages/course/create.tsx
Normal file
@ -0,0 +1,192 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Row, Col, Form, Input, Cascader, Switch, Button, message } from "antd";
|
||||
import styles from "./create.module.less";
|
||||
import { course, department } from "../../api/index";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { UploadImageButton, BackBartment } from "../../compenents";
|
||||
const { SHOW_CHILD } = Cascader;
|
||||
|
||||
interface Option {
|
||||
value: string | number;
|
||||
label: string;
|
||||
children?: Option[];
|
||||
}
|
||||
|
||||
export const CourseCreatePage: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [departments, setDepartments] = useState<any>([]);
|
||||
const [categories, setCategories] = useState<any>([]);
|
||||
const [thumb, setThumb] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
getParams();
|
||||
getCategory();
|
||||
}, []);
|
||||
|
||||
const getParams = () => {
|
||||
department.departmentList().then((res: any) => {
|
||||
const departments = res.data.departments;
|
||||
if (JSON.stringify(departments) !== "{}") {
|
||||
const new_arr: Option[] = checkArr(departments, 0);
|
||||
setDepartments(new_arr);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getCategory = () => {
|
||||
course.createCourse().then((res: any) => {
|
||||
const categories = res.data.categories;
|
||||
if (JSON.stringify(categories) !== "{}") {
|
||||
const new_arr: Option[] = checkArr(categories, 0);
|
||||
setCategories(new_arr);
|
||||
}
|
||||
form.setFieldsValue({ isShow: 1 });
|
||||
});
|
||||
};
|
||||
|
||||
const checkArr = (departments: any[], id: number) => {
|
||||
const arr = [];
|
||||
for (let i = 0; i < departments[id].length; i++) {
|
||||
if (!departments[departments[id][i].id]) {
|
||||
arr.push({
|
||||
label: departments[id][i].name,
|
||||
value: departments[id][i].id,
|
||||
});
|
||||
} else {
|
||||
const new_arr: Option[] = checkArr(departments, departments[id][i].id);
|
||||
arr.push({
|
||||
label: departments[id][i].name,
|
||||
value: departments[id][i].id,
|
||||
children: new_arr,
|
||||
});
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
console.log("Success:", values);
|
||||
course
|
||||
.storeCourse(
|
||||
values.title,
|
||||
values.thumb,
|
||||
values.isShow,
|
||||
values.dep_ids,
|
||||
values.category_ids
|
||||
)
|
||||
.then((res: any) => {
|
||||
message.success("保存成功!");
|
||||
navigate(-1);
|
||||
});
|
||||
};
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
console.log("Failed:", errorInfo);
|
||||
};
|
||||
const onChange = (checked: boolean) => {
|
||||
if (checked) {
|
||||
form.setFieldsValue({ isShow: 1 });
|
||||
} else {
|
||||
form.setFieldsValue({ isShow: 0 });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Row className="playedu-main-body">
|
||||
<Col>
|
||||
<div className="float-left mb-24">
|
||||
<BackBartment title="新建课程" />
|
||||
</div>
|
||||
<div className="float-left">
|
||||
<Form
|
||||
form={form}
|
||||
name="basic"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
style={{ width: 600 }}
|
||||
initialValues={{ remember: true }}
|
||||
onFinish={onFinish}
|
||||
onFinishFailed={onFinishFailed}
|
||||
autoComplete="off"
|
||||
>
|
||||
<Form.Item
|
||||
label="课程标题"
|
||||
name="title"
|
||||
rules={[{ required: true, message: "请输入课程标题!" }]}
|
||||
>
|
||||
<Input placeholder="请输入课程标题" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="课程封面"
|
||||
name="thumb"
|
||||
rules={[{ required: true, message: "请上传课程封面!" }]}
|
||||
>
|
||||
<div className="c-flex">
|
||||
<div className="d-flex">
|
||||
<UploadImageButton
|
||||
onSelected={(url) => {
|
||||
setThumb(url);
|
||||
form.setFieldsValue({ thumb: url });
|
||||
}}
|
||||
></UploadImageButton>
|
||||
</div>
|
||||
{thumb && (
|
||||
<img
|
||||
className="form-course-thumb mt-10"
|
||||
src={thumb}
|
||||
alt=""
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Form.Item label="显示课程" name="isShow" valuePropName="checked">
|
||||
<Switch onChange={onChange} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="学员部门"
|
||||
name="dep_ids"
|
||||
rules={[{ required: true, message: "请选择学员部门!" }]}
|
||||
>
|
||||
<Cascader
|
||||
options={departments}
|
||||
multiple
|
||||
maxTagCount="responsive"
|
||||
placeholder="请选择学员部门"
|
||||
showCheckedStrategy={SHOW_CHILD}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="资源分类"
|
||||
name="category_ids"
|
||||
rules={[{ required: true, message: "请选择资源分类!" }]}
|
||||
>
|
||||
<Cascader
|
||||
options={categories}
|
||||
multiple
|
||||
maxTagCount="responsive"
|
||||
placeholder="请选择资源分类"
|
||||
showCheckedStrategy={SHOW_CHILD}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
|
||||
<Button type="primary" htmlType="submit">
|
||||
保存
|
||||
</Button>
|
||||
<Button
|
||||
className="ml-15"
|
||||
htmlType="button"
|
||||
onClick={() => navigate(-1)}
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
);
|
||||
};
|
0
src/pages/course/index.module.less
Normal file
0
src/pages/course/index.module.less
Normal file
253
src/pages/course/index.tsx
Normal file
253
src/pages/course/index.tsx
Normal file
@ -0,0 +1,253 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
Button,
|
||||
Row,
|
||||
Col,
|
||||
Popconfirm,
|
||||
Image,
|
||||
Table,
|
||||
Typography,
|
||||
Input,
|
||||
message,
|
||||
Space,
|
||||
} from "antd";
|
||||
import { course } from "../../api";
|
||||
import styles from "./index.module.less";
|
||||
import { PlusOutlined, ReloadOutlined } from "@ant-design/icons";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { dateFormat } from "../../utils/index";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
||||
|
||||
interface DataType {
|
||||
id: React.Key;
|
||||
title: string;
|
||||
created_at: string;
|
||||
thumb: string;
|
||||
charge: number;
|
||||
is_show: number;
|
||||
}
|
||||
|
||||
export const CoursePage = () => {
|
||||
const navigate = useNavigate();
|
||||
const [list, setList] = useState<any>([]);
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const [page, setPage] = useState(1);
|
||||
const [size, setSize] = useState(10);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [category_ids, setCategoryIds] = useState<any>([]);
|
||||
const [title, setTitle] = useState<string>("");
|
||||
const [dep_ids, setDepIds] = useState<any>([]);
|
||||
|
||||
const columns: ColumnsType<DataType> = [
|
||||
{
|
||||
title: "ID",
|
||||
key: "id",
|
||||
dataIndex: "id",
|
||||
},
|
||||
{
|
||||
title: "封面",
|
||||
dataIndex: "thumb",
|
||||
render: (thumb: string) => (
|
||||
<Image preview={false} width={120} height={80} src={thumb}></Image>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "课程标题",
|
||||
dataIndex: "title",
|
||||
render: (text: string) => <span>{text}</span>,
|
||||
},
|
||||
{
|
||||
title: "时间",
|
||||
dataIndex: "created_at",
|
||||
render: (text: string) => <span>{dateFormat(text)}</span>,
|
||||
},
|
||||
{
|
||||
title: "是否显示",
|
||||
dataIndex: "is_show",
|
||||
render: (is_show: number) => (
|
||||
<span className={is_show === 1 ? "c-green" : "c-red"}>
|
||||
{is_show === 1 ? "· 显示" : "· 隐藏"}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
fixed: "right",
|
||||
width: 100,
|
||||
render: (_, record: any) => (
|
||||
<Space size="small">
|
||||
<PerButton
|
||||
type="link"
|
||||
text="详情"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="course"
|
||||
onClick={() => navigate(`/course/update/${record.id}`)}
|
||||
/>
|
||||
<Popconfirm
|
||||
title="警告"
|
||||
description="即将删除此课程,确认操作?"
|
||||
onConfirm={() => removeItem(record.id)}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<PerButton
|
||||
type="link"
|
||||
text="删除"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="course"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
// 删除图片
|
||||
const removeItem = (id: number) => {
|
||||
if (id === 0) {
|
||||
return;
|
||||
}
|
||||
course.destroyCourse(id).then(() => {
|
||||
message.success("删除成功");
|
||||
resetList();
|
||||
});
|
||||
};
|
||||
|
||||
// 获取视频列表
|
||||
const getList = () => {
|
||||
setLoading(true);
|
||||
let categoryIds = category_ids.join(",");
|
||||
let depIds = dep_ids.join(",");
|
||||
course
|
||||
.courseList(page, size, "", "", title, depIds, categoryIds)
|
||||
.then((res: any) => {
|
||||
setTotal(res.data.total);
|
||||
setList(res.data.data);
|
||||
setLoading(false);
|
||||
})
|
||||
.catch((err: any) => {
|
||||
console.log("错误,", err);
|
||||
});
|
||||
};
|
||||
// 重置列表
|
||||
const resetList = () => {
|
||||
setPage(1);
|
||||
setSize(10);
|
||||
setList([]);
|
||||
setRefresh(!refresh);
|
||||
};
|
||||
|
||||
// 加载视频列表
|
||||
useEffect(() => {
|
||||
getList();
|
||||
}, [category_ids, refresh, page, size]);
|
||||
|
||||
const paginationProps = {
|
||||
current: page, //当前页码
|
||||
pageSize: size,
|
||||
total: total, // 总条数
|
||||
onChange: (page: number, pageSize: number) =>
|
||||
handlePageChange(page, pageSize), //改变页码的函数
|
||||
showSizeChanger: true,
|
||||
};
|
||||
|
||||
const handlePageChange = (page: number, pageSize: number) => {
|
||||
setPage(page);
|
||||
setSize(pageSize);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Row>
|
||||
<Col span={4}>
|
||||
<div className="playedu-main-body mb-24" style={{ marginLeft: -24 }}>
|
||||
<div className="float-left mb-24">
|
||||
<div className="d-flex mb-24">
|
||||
<Typography.Text>资源分类:</Typography.Text>
|
||||
</div>
|
||||
<TreeCategory onUpdate={(keys: any) => setCategoryIds(keys)} />
|
||||
</div>
|
||||
<div className="float-left">
|
||||
<div className="d-flex mb-24">
|
||||
<Typography.Text>部门:</Typography.Text>
|
||||
</div>
|
||||
<TreeDepartment onUpdate={(keys: any) => setDepIds(keys)} />
|
||||
</div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col span={20}>
|
||||
<div className="playedu-main-body mb-24">
|
||||
<div className="float-left d-flex">
|
||||
<div className="d-flex mr-24">
|
||||
<Typography.Text>课程名称:</Typography.Text>
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => {
|
||||
setTitle(e.target.value);
|
||||
}}
|
||||
style={{ width: 160 }}
|
||||
placeholder="请输入课程名称"
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex mr-24">
|
||||
<Button className="mr-16" onClick={resetList}>
|
||||
重 置
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
setPage(1);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
>
|
||||
查 询
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="playedu-main-body">
|
||||
<div className="float-left j-b-flex mb-24">
|
||||
<div className="d-flex">
|
||||
<Link style={{ textDecoration: "none" }} to={`/course/create`}>
|
||||
<PerButton
|
||||
type="primary"
|
||||
text="新建"
|
||||
class="mr-16"
|
||||
icon={<PlusOutlined />}
|
||||
p="course"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Button
|
||||
type="link"
|
||||
icon={<ReloadOutlined />}
|
||||
style={{ color: "#333333" }}
|
||||
onClick={() => {
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
></Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="float-left">
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
pagination={paginationProps}
|
||||
rowKey={(record) => record.id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
);
|
||||
};
|
0
src/pages/course/update.module.less
Normal file
0
src/pages/course/update.module.less
Normal file
227
src/pages/course/update.tsx
Normal file
227
src/pages/course/update.tsx
Normal file
@ -0,0 +1,227 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Row, Col, Form, Input, Cascader, Switch, Button, message } from "antd";
|
||||
import styles from "./create.module.less";
|
||||
import { course, department } from "../../api/index";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { UploadImageButton, BackBartment } from "../../compenents";
|
||||
|
||||
interface Option {
|
||||
value: string | number;
|
||||
label: string;
|
||||
children?: Option[];
|
||||
}
|
||||
|
||||
export const CourseUpdatePage: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const params = useParams();
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [departments, setDepartments] = useState<any>([]);
|
||||
const [categories, setCategories] = useState<any>([]);
|
||||
const [thumb, setThumb] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
getParams();
|
||||
getCategory();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
getDetail();
|
||||
}, [params.cid]);
|
||||
|
||||
const getParams = () => {
|
||||
department.departmentList().then((res: any) => {
|
||||
const departments = res.data.departments;
|
||||
if (JSON.stringify(departments) !== "{}") {
|
||||
const new_arr: Option[] = checkArr(departments, 0);
|
||||
setDepartments(new_arr);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getCategory = () => {
|
||||
course.createCourse().then((res: any) => {
|
||||
const categories = res.data.categories;
|
||||
if (JSON.stringify(categories) !== "{}") {
|
||||
const new_arr: Option[] = checkArr(categories, 0);
|
||||
setCategories(new_arr);
|
||||
}
|
||||
form.setFieldsValue({ isShow: 1 });
|
||||
});
|
||||
};
|
||||
|
||||
const checkArr = (departments: any[], id: number) => {
|
||||
const arr = [];
|
||||
for (let i = 0; i < departments[id].length; i++) {
|
||||
if (!departments[departments[id][i].id]) {
|
||||
arr.push({
|
||||
label: departments[id][i].name,
|
||||
value: departments[id][i].id,
|
||||
});
|
||||
} else {
|
||||
const new_arr: Option[] = checkArr(departments, departments[id][i].id);
|
||||
arr.push({
|
||||
label: departments[id][i].name,
|
||||
value: departments[id][i].id,
|
||||
children: new_arr,
|
||||
});
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
|
||||
const getDetail = () => {
|
||||
course.course(Number(params.cid)).then((res: any) => {
|
||||
let data = res.data.course;
|
||||
// let depIds=res.data.dep_ids;
|
||||
// for (let i = 0; i < depIds.length; i++) {
|
||||
// dep_ids.push(depIds[i]);
|
||||
// }
|
||||
form.setFieldsValue({
|
||||
title: data.title,
|
||||
thumb: data.thumb,
|
||||
isShow: data.is_show,
|
||||
dep_ids: res.data.dep_ids,
|
||||
category_ids: res.data.category_ids,
|
||||
});
|
||||
setThumb(data.thumb);
|
||||
});
|
||||
};
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
console.log("Success:", values);
|
||||
let id = Number(params.cid);
|
||||
let dep_ids: any[] = [];
|
||||
for (let i = 0; i < values.dep_ids.length; i++) {
|
||||
dep_ids.push(values.dep_ids[i][values.dep_ids[i].length - 1]);
|
||||
}
|
||||
let category_ids: any[] = [];
|
||||
for (let j = 0; j < values.category_ids.length; j++) {
|
||||
category_ids.push(
|
||||
values.category_ids[j][values.category_ids[j].length - 1]
|
||||
);
|
||||
}
|
||||
course
|
||||
.updateCourse(
|
||||
id,
|
||||
values.title,
|
||||
values.thumb,
|
||||
values.isShow,
|
||||
dep_ids,
|
||||
category_ids
|
||||
)
|
||||
.then((res: any) => {
|
||||
message.success("保存成功!");
|
||||
navigate(-1);
|
||||
});
|
||||
};
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
console.log("Failed:", errorInfo);
|
||||
};
|
||||
|
||||
const onChange = (checked: boolean) => {
|
||||
if (checked) {
|
||||
form.setFieldsValue({ isShow: 1 });
|
||||
} else {
|
||||
form.setFieldsValue({ isShow: 0 });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Row className="playedu-main-body">
|
||||
<Col>
|
||||
<div className="float-left mb-24">
|
||||
<BackBartment title="编辑课程" />
|
||||
</div>
|
||||
<div className="float-left">
|
||||
<Form
|
||||
form={form}
|
||||
name="basic"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
style={{ width: 600 }}
|
||||
initialValues={{ remember: true }}
|
||||
onFinish={onFinish}
|
||||
onFinishFailed={onFinishFailed}
|
||||
autoComplete="off"
|
||||
>
|
||||
<Form.Item
|
||||
label="课程标题"
|
||||
name="title"
|
||||
rules={[{ required: true, message: "请输入课程标题!" }]}
|
||||
>
|
||||
<Input placeholder="请输入课程标题" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="课程封面"
|
||||
name="thumb"
|
||||
rules={[{ required: true, message: "请上传课程封面!" }]}
|
||||
>
|
||||
<div className="c-flex">
|
||||
<div className="d-flex">
|
||||
<UploadImageButton
|
||||
onSelected={(url) => {
|
||||
setThumb(url);
|
||||
form.setFieldsValue({ thumb: url });
|
||||
}}
|
||||
></UploadImageButton>
|
||||
</div>
|
||||
{thumb && (
|
||||
<img
|
||||
className="form-course-thumb mt-10"
|
||||
src={thumb}
|
||||
alt=""
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Form.Item label="显示课程" name="isShow" valuePropName="checked">
|
||||
<Switch onChange={onChange} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="学员部门"
|
||||
name="dep_ids"
|
||||
rules={[{ required: true, message: "请选择学员部门!" }]}
|
||||
>
|
||||
<Cascader
|
||||
options={departments}
|
||||
multiple
|
||||
maxTagCount="responsive"
|
||||
placeholder="请选择学员部门"
|
||||
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="资源分类"
|
||||
name="category_ids"
|
||||
rules={[{ required: true, message: "请选择资源分类!" }]}
|
||||
>
|
||||
<Cascader
|
||||
options={categories}
|
||||
multiple
|
||||
maxTagCount="responsive"
|
||||
placeholder="请选择资源分类"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
|
||||
<Button type="primary" htmlType="submit">
|
||||
保存
|
||||
</Button>
|
||||
<Button
|
||||
className="ml-15"
|
||||
htmlType="button"
|
||||
onClick={() => navigate(-1)}
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
);
|
||||
};
|
@ -1,119 +0,0 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { Typography, Input, Select, Button, Space, Table } from "antd";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import styles from "./index.module.less";
|
||||
import { PlusOutlined, ReloadOutlined } from "@ant-design/icons";
|
||||
import { login } from "../../../api/index";
|
||||
|
||||
interface DataType {
|
||||
key: string;
|
||||
name: string;
|
||||
age: number;
|
||||
address: string;
|
||||
}
|
||||
|
||||
const columns: ColumnsType<DataType> = [
|
||||
{
|
||||
title: "Name",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
render: (text) => <span>{text}</span>,
|
||||
},
|
||||
{
|
||||
title: "Age",
|
||||
dataIndex: "age",
|
||||
key: "age",
|
||||
},
|
||||
{
|
||||
title: "Address",
|
||||
dataIndex: "address",
|
||||
key: "address",
|
||||
},
|
||||
{
|
||||
title: "Action",
|
||||
key: "action",
|
||||
render: (_, record) => (
|
||||
<Space size="middle">
|
||||
<a>Invite {record.name}</a>
|
||||
<a>Delete</a>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const data: DataType[] = [
|
||||
{
|
||||
key: "1",
|
||||
name: "John Brown",
|
||||
age: 32,
|
||||
address: "New York No. 1 Lake Park",
|
||||
},
|
||||
{
|
||||
key: "2",
|
||||
name: "Jim Green",
|
||||
age: 42,
|
||||
address: "London No. 1 Lake Park",
|
||||
},
|
||||
{
|
||||
key: "3",
|
||||
name: "Joe Black",
|
||||
age: 32,
|
||||
address: "Sydney No. 1 Lake Park",
|
||||
},
|
||||
];
|
||||
|
||||
export const VodListPage: React.FC = () => {
|
||||
useEffect(() => {}, []);
|
||||
const handleChange = (e: any) => {
|
||||
console.log(e);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div className="playedu-main-body mb-24">
|
||||
<div className="float-left d-flex">
|
||||
<div className="d-flex mr-24">
|
||||
<Typography.Text>课程名称:</Typography.Text>
|
||||
<Input style={{ width: 160 }} placeholder="请输入课程关键字" />
|
||||
</div>
|
||||
<div className="d-flex mr-24">
|
||||
<Typography.Text>课程分类:</Typography.Text>
|
||||
<Select
|
||||
placeholder="请选择课程分类"
|
||||
style={{ width: 160 }}
|
||||
onChange={handleChange}
|
||||
options={[
|
||||
{ value: "jack", label: "Jack" },
|
||||
{ value: "lucy", label: "Lucy" },
|
||||
{ value: "Yiminghe", label: "yiminghe" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex mr-24">
|
||||
<Button className="mr-16">重 置</Button>
|
||||
<Button type="primary">查 询</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="playedu-main-body">
|
||||
<div className="float-left j-b-flex mb-24">
|
||||
<div className="d-flex">
|
||||
<Button icon={<PlusOutlined />} className="mr-16" type="primary">
|
||||
新建
|
||||
</Button>
|
||||
<Button>删除</Button>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Button
|
||||
type="link"
|
||||
icon={<ReloadOutlined />}
|
||||
style={{ color: "#333333" }}
|
||||
></Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="float-left">
|
||||
<Table columns={columns} dataSource={data} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
@ -63,7 +63,7 @@ export const DepartmentPage: React.FC = () => {
|
||||
text="详情"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="department-update"
|
||||
p="department-cud"
|
||||
onClick={() => navigate(`/department/update/${record.id}`)}
|
||||
/>
|
||||
<Popconfirm
|
||||
@ -78,7 +78,7 @@ export const DepartmentPage: React.FC = () => {
|
||||
text="删除"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="department-destroy"
|
||||
p="department-cud"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Popconfirm>
|
||||
@ -152,7 +152,7 @@ export const DepartmentPage: React.FC = () => {
|
||||
text="新建"
|
||||
class="mr-16"
|
||||
icon={<PlusOutlined />}
|
||||
p="department-store"
|
||||
p="department-cud"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Link>
|
||||
|
@ -3,7 +3,9 @@ export * from "./login";
|
||||
export * from "./dashboard";
|
||||
export * from "./error";
|
||||
export * from "./test";
|
||||
export * from "./course/vod";
|
||||
export * from "./course/index";
|
||||
export * from "./course/create";
|
||||
export * from "./course/update";
|
||||
export * from "./member/index";
|
||||
export * from "./member/create";
|
||||
export * from "./member/update";
|
||||
|
@ -63,3 +63,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import banner from "../../assets/images/login/banner.png";
|
||||
import icon from "../../assets/images/login/icon.png";
|
||||
import "./login.less";
|
||||
|
||||
export const Login: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
8
src/pages/login/login.less
Normal file
8
src/pages/login/login.less
Normal file
@ -0,0 +1,8 @@
|
||||
.ant-btn {
|
||||
font-size: 18px !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
.ant-input {
|
||||
font-size: 18px !important;
|
||||
}
|
@ -25,8 +25,10 @@ export const MemberCreatePage: React.FC = () => {
|
||||
const getParams = () => {
|
||||
department.departmentList().then((res: any) => {
|
||||
const departments = res.data.departments;
|
||||
const new_arr: Option[] = checkArr(departments, 0);
|
||||
setDepartments(new_arr);
|
||||
if (JSON.stringify(departments) !== "{}") {
|
||||
const new_arr: Option[] = checkArr(departments, 0);
|
||||
setDepartments(new_arr);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -29,8 +29,10 @@ export const MemberUpdatePage: React.FC = () => {
|
||||
const getParams = () => {
|
||||
department.departmentList().then((res: any) => {
|
||||
const departments = res.data.departments;
|
||||
const new_arr: Option[] = checkArr(departments, 0);
|
||||
setDepartments(new_arr);
|
||||
if (JSON.stringify(departments) !== "{}") {
|
||||
const new_arr: Option[] = checkArr(departments, 0);
|
||||
setDepartments(new_arr);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -63,7 +63,7 @@ export const ResourceCategoryPage: React.FC = () => {
|
||||
text="详情"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="department-update"
|
||||
p="department-cud"
|
||||
onClick={() => navigate(`/resource-category/update/${record.id}`)}
|
||||
/>
|
||||
<Popconfirm
|
||||
@ -78,7 +78,7 @@ export const ResourceCategoryPage: React.FC = () => {
|
||||
text="删除"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="department-destroy"
|
||||
p="department-cud"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Popconfirm>
|
||||
@ -156,7 +156,7 @@ export const ResourceCategoryPage: React.FC = () => {
|
||||
text="新建"
|
||||
class="mr-16"
|
||||
icon={<PlusOutlined />}
|
||||
p="department-store"
|
||||
p="department-cud"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Link>
|
||||
|
@ -23,7 +23,6 @@ interface DataType {
|
||||
id: React.Key;
|
||||
name: string;
|
||||
created_at: string;
|
||||
duration: string;
|
||||
}
|
||||
|
||||
export const ResourceVideosPage = () => {
|
||||
|
@ -78,7 +78,7 @@ export const SystemAdministratorPage: React.FC = () => {
|
||||
text="详情"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="admin-user-update"
|
||||
p="admin-user-cud"
|
||||
onClick={() =>
|
||||
navigate(`/system/administrator/update/${record.id}`)
|
||||
}
|
||||
@ -95,7 +95,7 @@ export const SystemAdministratorPage: React.FC = () => {
|
||||
text="删除"
|
||||
class="c-red"
|
||||
icon={null}
|
||||
p="admin-user-destroy"
|
||||
p="admin-user-cud"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Popconfirm>
|
||||
@ -190,7 +190,7 @@ export const SystemAdministratorPage: React.FC = () => {
|
||||
text="新建"
|
||||
class="mr-16"
|
||||
icon={<PlusOutlined />}
|
||||
p="admin-user-store"
|
||||
p="admin-user-cud"
|
||||
onClick={() => null}
|
||||
/>
|
||||
</Link>
|
||||
|
@ -4,7 +4,9 @@ import {
|
||||
HomePage,
|
||||
Dashboard,
|
||||
ErrorPage,
|
||||
VodListPage,
|
||||
CoursePage,
|
||||
CourseCreatePage,
|
||||
CourseUpdatePage,
|
||||
TestPage,
|
||||
MemberPage,
|
||||
MemberCreatePage,
|
||||
@ -24,7 +26,7 @@ import {
|
||||
ResourceCategoryPage,
|
||||
ResourceCategoryCreatePage,
|
||||
ResourceCategoryUpdatePage,
|
||||
ResourceVideosPage
|
||||
ResourceVideosPage,
|
||||
} from "../pages";
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
@ -61,9 +63,18 @@ const routes: RouteObject[] = [
|
||||
element: <ResourceVideosPage />,
|
||||
},
|
||||
{
|
||||
path: "/vod",
|
||||
element: <VodListPage />,
|
||||
path: "/course",
|
||||
element: <CoursePage />,
|
||||
},
|
||||
{
|
||||
path: "/course/create",
|
||||
element: <CourseCreatePage />,
|
||||
},
|
||||
{
|
||||
path: "/course/update/:cid",
|
||||
element: <CourseUpdatePage />,
|
||||
},
|
||||
|
||||
{
|
||||
path: "/member",
|
||||
element: <MemberPage />,
|
||||
|
Loading…
x
Reference in New Issue
Block a user