mirror of
https://github.com/PlayEdu/backend
synced 2025-06-28 05:33:06 +08:00
Compare commits
28 Commits
c13bf7ef3c
...
895385c4d7
Author | SHA1 | Date | |
---|---|---|---|
|
895385c4d7 | ||
|
46e9949ce0 | ||
|
57e216fc07 | ||
|
1cf8b33a81 | ||
|
0666d9a769 | ||
|
5b124ca821 | ||
|
54b47dc105 | ||
|
3b3be12cac | ||
|
e479ec7848 | ||
|
2b8e8777c7 | ||
|
3d6ea85e41 | ||
|
d9850260e9 | ||
|
da6fc9639f | ||
|
d2e28b9548 | ||
|
e12c13e5cd | ||
|
b553659a95 | ||
|
f69b432b12 | ||
|
d6a0d2bfec | ||
|
42f5d77e4f | ||
|
aa8e1d88aa | ||
|
f7fe5e35f4 | ||
|
8013964441 | ||
|
caf377eb1a | ||
|
272e9a5d50 | ||
|
7d37329713 | ||
|
e0bd169069 | ||
|
d06214aec0 | ||
|
a8432cece7 |
@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Row, Col, Empty, Table, Spin } from "antd";
|
||||
import { Row, Col, Empty, Table, Spin, Typography, Input, Button } from "antd";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { resource } from "../../api";
|
||||
import styles from "./index.module.less";
|
||||
@ -47,6 +47,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
||||
const [size, setSize] = useState(10);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]);
|
||||
const [title, setTitle] = useState("");
|
||||
|
||||
// 加载列表
|
||||
useEffect(() => {
|
||||
@ -70,7 +71,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
||||
size,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
title,
|
||||
"WORD,EXCEL,PPT,PDF,TXT,RAR,ZIP",
|
||||
categoryIds
|
||||
)
|
||||
@ -92,6 +93,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
||||
const resetVideoList = () => {
|
||||
setPage(1);
|
||||
setVideoList([]);
|
||||
setTitle("");
|
||||
setRefresh(!refresh);
|
||||
};
|
||||
|
||||
@ -178,14 +180,42 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
||||
</Col>
|
||||
<Col span={17}>
|
||||
<Row style={{ marginBottom: 24, paddingLeft: 10 }}>
|
||||
<Col span={24}>
|
||||
<div className="float-left j-b-flex">
|
||||
<UploadCoursewareButton
|
||||
categoryIds={category_ids}
|
||||
onUpdate={() => {
|
||||
resetVideoList();
|
||||
}}
|
||||
></UploadCoursewareButton>
|
||||
</Col>
|
||||
<div className="d-flex">
|
||||
<div className="d-flex mr-24">
|
||||
<Typography.Text>名称:</Typography.Text>
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => {
|
||||
setTitle(e.target.value);
|
||||
}}
|
||||
allowClear
|
||||
style={{ width: 160 }}
|
||||
placeholder="请输入名称关键字"
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Button className="mr-16" onClick={resetVideoList}>
|
||||
重 置
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
setPage(1);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
>
|
||||
查 询
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Row>
|
||||
{init && (
|
||||
<div className="float-left text-center mt-30">
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Row, Col, Empty, Table, Spin } from "antd";
|
||||
import { Row, Col, Empty, Table, Spin, Typography, Input, Button } from "antd";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { resource } from "../../api";
|
||||
import styles from "./index.module.less";
|
||||
@ -48,6 +48,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
||||
const [size, setSize] = useState(10);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]);
|
||||
const [title, setTitle] = useState("");
|
||||
|
||||
// 加载列表
|
||||
useEffect(() => {
|
||||
@ -66,7 +67,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
||||
setLoading(true);
|
||||
let categoryIds = category_ids.join(",");
|
||||
resource
|
||||
.resourceList(page, size, "", "", "", "VIDEO", categoryIds)
|
||||
.resourceList(page, size, "", "", title, "VIDEO", categoryIds)
|
||||
.then((res: any) => {
|
||||
setTotal(res.data.result.total);
|
||||
setVideoExtra(res.data.videos_extra);
|
||||
@ -85,6 +86,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
||||
const resetVideoList = () => {
|
||||
setPage(1);
|
||||
setVideoList([]);
|
||||
setTitle("");
|
||||
setRefresh(!refresh);
|
||||
};
|
||||
|
||||
@ -170,14 +172,42 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
||||
</Col>
|
||||
<Col span={17}>
|
||||
<Row style={{ marginBottom: 24, paddingLeft: 10 }}>
|
||||
<Col span={24}>
|
||||
<div className="float-left j-b-flex">
|
||||
<UploadVideoButton
|
||||
categoryIds={category_ids}
|
||||
onUpdate={() => {
|
||||
resetVideoList();
|
||||
}}
|
||||
></UploadVideoButton>
|
||||
</Col>
|
||||
<div className="d-flex">
|
||||
<div className="d-flex mr-24">
|
||||
<Typography.Text>名称:</Typography.Text>
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => {
|
||||
setTitle(e.target.value);
|
||||
}}
|
||||
allowClear
|
||||
style={{ width: 160 }}
|
||||
placeholder="请输入名称关键字"
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Button className="mr-16" onClick={resetVideoList}>
|
||||
重 置
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
setPage(1);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
>
|
||||
查 询
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Row>
|
||||
{init && (
|
||||
<div className="float-left text-center mt-30">
|
||||
|
@ -20,6 +20,10 @@ code {
|
||||
monospace;
|
||||
}
|
||||
|
||||
.w-100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.w-174px {
|
||||
max-width: 134px;
|
||||
overflow: hidden;
|
||||
|
@ -234,7 +234,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
|
||||
const arr = [...chapters];
|
||||
if (arr[index].id) {
|
||||
courseChapter
|
||||
.updateCourseChapter(id, Number(arr[index].id), value, arr.length)
|
||||
.updateCourseChapter(id, Number(arr[index].id), value, index + 1)
|
||||
.then((res: any) => {
|
||||
console.log("ok");
|
||||
getDetail();
|
||||
|
@ -65,6 +65,7 @@ export const TreeHours = (props: PropInterface) => {
|
||||
}
|
||||
props.onRemoveItem(id);
|
||||
};
|
||||
|
||||
const onDrop: TreeProps["onDrop"] = (info) => {
|
||||
const dropKey = info.node.key;
|
||||
const dragKey = info.dragNode.key;
|
||||
@ -96,23 +97,35 @@ export const TreeHours = (props: PropInterface) => {
|
||||
|
||||
// Find dragObject
|
||||
let dragObj: DataNode;
|
||||
loop(data, dragKey, (item, index, arr) => {
|
||||
arr.splice(index, 1);
|
||||
dragObj = item;
|
||||
});
|
||||
let dragLength = (info.dragNode as any).props.pos.split("-").length;
|
||||
let dropLength = (info.node as any).props.pos.split("-").length;
|
||||
|
||||
if (!info.dropToGap) {
|
||||
// Drop on the content
|
||||
loop(data, dropKey, (item) => {
|
||||
item.children = item.children || [];
|
||||
// where to insert 示例添加到头部,可以是随意位置
|
||||
item.children.unshift(dragObj);
|
||||
});
|
||||
if (
|
||||
(dropPosition == 0 && dropPos.length == 3) ||
|
||||
(dropPosition == 0 && dropPos.length == 2 && dragLength == 2)
|
||||
) {
|
||||
} else {
|
||||
loop(data, dragKey, (item, index, arr) => {
|
||||
arr.splice(index, 1);
|
||||
dragObj = item;
|
||||
});
|
||||
loop(data, dropKey, (item) => {
|
||||
item.children = item.children || [];
|
||||
// where to insert 示例添加到头部,可以是随意位置
|
||||
item.children.unshift(dragObj);
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
((info.node as any).props.children || []).length > 0 && // Has children
|
||||
(info.node as any).props.expanded && // Is expanded
|
||||
dropPosition === 1 // On the bottom gap
|
||||
) {
|
||||
loop(data, dragKey, (item, index, arr) => {
|
||||
arr.splice(index, 1);
|
||||
dragObj = item;
|
||||
});
|
||||
loop(data, dropKey, (item) => {
|
||||
item.children = item.children || [];
|
||||
// where to insert 示例添加到头部,可以是随意位置
|
||||
@ -121,6 +134,16 @@ export const TreeHours = (props: PropInterface) => {
|
||||
// item to the tail of the children
|
||||
});
|
||||
} else {
|
||||
if (
|
||||
(dragLength == 3 && dropLength == 2) ||
|
||||
(dragLength == 2 && dropLength == 3)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
loop(data, dragKey, (item, index, arr) => {
|
||||
arr.splice(index, 1);
|
||||
dragObj = item;
|
||||
});
|
||||
let ar: DataNode[] = [];
|
||||
let i: number;
|
||||
loop(data, dropKey, (_item, index, arr) => {
|
||||
|
@ -60,6 +60,22 @@ type HourCountModel = {
|
||||
[key: number]: string;
|
||||
};
|
||||
|
||||
type PerCourseRecordsModel = {
|
||||
[key: number]: {
|
||||
course_id: number;
|
||||
created_at: string;
|
||||
finished_at: string;
|
||||
finished_duration: number;
|
||||
hour_id: number;
|
||||
id: number;
|
||||
is_finished: number;
|
||||
real_duration: number;
|
||||
total_duration: number;
|
||||
updated_at: string;
|
||||
user_id: number;
|
||||
};
|
||||
};
|
||||
|
||||
const CourseUserPage = () => {
|
||||
const params = useParams();
|
||||
const result = new URLSearchParams(useLocation().search);
|
||||
@ -69,6 +85,7 @@ const CourseUserPage = () => {
|
||||
const [hourCount, setHourCount] = useState<HourCountModel>({});
|
||||
const [userDepIds, setUserDepIds] = useState<DepIdsModel>({});
|
||||
const [departments, setDepartments] = useState<DepartmentsModel>({});
|
||||
const [perRecords, setPerRecords] = useState<PerCourseRecordsModel>({});
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const [page, setPage] = useState(1);
|
||||
const [size, setSize] = useState(10);
|
||||
@ -135,8 +152,8 @@ const CourseUserPage = () => {
|
||||
dataIndex: "created_at",
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
{records[record.id] ? (
|
||||
<span>{dateFormat(records[record.id].created_at)}</span>
|
||||
{perRecords[record.id] ? (
|
||||
<span>{dateFormat(perRecords[record.id].created_at)}</span>
|
||||
) : hourCount[record.id] ? (
|
||||
<span>{dateFormat(hourCount[record.id])}</span>
|
||||
) : (
|
||||
@ -213,6 +230,7 @@ const CourseUserPage = () => {
|
||||
setList(res.data.data);
|
||||
setHourCount(res.data.user_course_hour_user_first_at);
|
||||
setRecords(res.data.user_course_records);
|
||||
setPerRecords(res.data.per_user_earliest_records);
|
||||
setCourse(res.data.course);
|
||||
setDepartments(res.data.departments);
|
||||
setUserDepIds(res.data.user_dep_ids);
|
||||
|
@ -558,7 +558,7 @@ const DashboardPage = () => {
|
||||
<div className={styles["usage-guide"]}>
|
||||
<img className={styles["banner"]} src={banner} alt="" />
|
||||
<Link
|
||||
to="https://www.playedu.xyz/docs/docs/guide/"
|
||||
to="https://www.playedu.xyz/book/opensource-handbook/article/wFymJ4SXcX"
|
||||
target="blank"
|
||||
className={styles["link"]}
|
||||
>
|
||||
|
@ -413,16 +413,6 @@ const DepartmentPage = () => {
|
||||
<div className="playedu-main-top mb-24">
|
||||
{contextHolder}
|
||||
<div className="d-flex">
|
||||
<PerButton
|
||||
type="primary"
|
||||
text="新建部门"
|
||||
class="mr-16"
|
||||
icon={<PlusOutlined />}
|
||||
p="department-cud"
|
||||
onClick={() => setCreateVisible(true)}
|
||||
disabled={null}
|
||||
/>
|
||||
|
||||
{ldapEnabled ? (
|
||||
<PerButton
|
||||
type="primary"
|
||||
@ -433,7 +423,17 @@ const DepartmentPage = () => {
|
||||
onClick={() => ldapSync()}
|
||||
disabled={null}
|
||||
/>
|
||||
) : null}
|
||||
) : (
|
||||
<PerButton
|
||||
type="primary"
|
||||
text="新建部门"
|
||||
class="mr-16"
|
||||
icon={<PlusOutlined />}
|
||||
p="department-cud"
|
||||
onClick={() => setCreateVisible(true)}
|
||||
disabled={null}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
{
|
||||
title: "课时标题",
|
||||
dataIndex: "title",
|
||||
|
||||
render: (title: string) => (
|
||||
<>
|
||||
<span>{title}</span>
|
||||
@ -68,7 +67,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
},
|
||||
{
|
||||
title: "总时长",
|
||||
width: 120,
|
||||
dataIndex: "duration",
|
||||
render: (duration: number) => (
|
||||
<>
|
||||
@ -78,7 +76,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
},
|
||||
{
|
||||
title: "已学习时长",
|
||||
width: 120,
|
||||
dataIndex: "finished_duration",
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
@ -96,7 +93,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
},
|
||||
{
|
||||
title: "是否学完",
|
||||
width: 100,
|
||||
dataIndex: "is_finished",
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
@ -112,7 +108,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
},
|
||||
{
|
||||
title: "开始时间",
|
||||
width: 150,
|
||||
dataIndex: "created_at",
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
@ -126,7 +121,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
},
|
||||
{
|
||||
title: "学完时间",
|
||||
width: 150,
|
||||
dataIndex: "finished_at",
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
@ -142,7 +136,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
title: "操作",
|
||||
key: "action",
|
||||
fixed: "right",
|
||||
width: 70,
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
{records && records[record.id] ? (
|
||||
@ -222,7 +215,7 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
maskClosable={false}
|
||||
footer={null}
|
||||
>
|
||||
<div className="d-flex mt-24">
|
||||
<div className="mt-24">
|
||||
<PerButton
|
||||
type="primary"
|
||||
text="重置学习记录"
|
||||
@ -235,10 +228,7 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
||||
disabled={null}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="d-flex mt-24"
|
||||
style={{ maxHeight: 800, overflowY: "auto" }}
|
||||
>
|
||||
<div className="mt-24" style={{ maxHeight: 800, overflowY: "auto" }}>
|
||||
<Table
|
||||
columns={column}
|
||||
dataSource={list}
|
||||
|
@ -89,13 +89,13 @@ const MemberPage = () => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setDid(Number(result.get("did")));
|
||||
if (Number(result.get("did"))) {
|
||||
let arr = [];
|
||||
arr.push(Number(result.get("did")));
|
||||
setDepIds(arr);
|
||||
if (result.get("refresh")) {
|
||||
resetLocalSearchParams({
|
||||
page: 1,
|
||||
});
|
||||
setRefresh(!refresh);
|
||||
}
|
||||
}, [result.get("did")]);
|
||||
}, [result.get("refresh")]);
|
||||
|
||||
const columns: ColumnsType<DataType> = [
|
||||
{
|
||||
|
@ -57,6 +57,22 @@ type DepartmentsListModel = {
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
type PerCourseRecordsModel = {
|
||||
[key: number]: {
|
||||
course_id: number;
|
||||
created_at: string;
|
||||
finished_at: string;
|
||||
finished_duration: number;
|
||||
hour_id: number;
|
||||
id: number;
|
||||
is_finished: number;
|
||||
real_duration: number;
|
||||
total_duration: number;
|
||||
updated_at: string;
|
||||
user_id: number;
|
||||
};
|
||||
};
|
||||
|
||||
const MemberLearnPage = () => {
|
||||
let chartRef = useRef(null);
|
||||
const navigate = useNavigate();
|
||||
@ -69,6 +85,7 @@ const MemberLearnPage = () => {
|
||||
const [currentCourses, setCurrentCourses] = useState<DataType[]>([]);
|
||||
const [openCourses, setOpenCourses] = useState<CourseModel[]>([]);
|
||||
const [records, setRecords] = useState<UserCourseRecordsModel>({});
|
||||
const [perRecords, setPerRecords] = useState<PerCourseRecordsModel>({});
|
||||
const [hourCount, setHourCount] = useState<HourCountModel>({});
|
||||
const [total2, setTotal2] = useState(0);
|
||||
const [refresh2, setRefresh2] = useState(false);
|
||||
@ -194,6 +211,7 @@ const MemberLearnPage = () => {
|
||||
setOpenCourses(res.data.open_courses);
|
||||
setHourCount(res.data.user_course_hour_count);
|
||||
setRecords(res.data.user_course_records);
|
||||
setPerRecords(res.data.per_course_earliest_records);
|
||||
if (res.data.departments.length > 0) {
|
||||
let box: OptionModel[] = [];
|
||||
res.data.departments.map((item: any) => {
|
||||
@ -247,8 +265,8 @@ const MemberLearnPage = () => {
|
||||
dataIndex: "created_at",
|
||||
render: (_, record: any) => (
|
||||
<>
|
||||
{records[record.id] ? (
|
||||
<span>{dateFormat(records[record.id].created_at)}</span>
|
||||
{perRecords[record.id] ? (
|
||||
<span>{dateFormat(perRecords[record.id].created_at)}</span>
|
||||
) : (
|
||||
<span>-</span>
|
||||
)}
|
||||
|
@ -1,5 +1,14 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Modal, Table, message, Space, Dropdown, Button } from "antd";
|
||||
import {
|
||||
Modal,
|
||||
Table,
|
||||
message,
|
||||
Space,
|
||||
Dropdown,
|
||||
Typography,
|
||||
Input,
|
||||
Button,
|
||||
} from "antd";
|
||||
import type { MenuProps } from "antd";
|
||||
import { resource } from "../../../api";
|
||||
import { useLocation } from "react-router-dom";
|
||||
@ -63,6 +72,7 @@ const ResourceVideosPage = () => {
|
||||
const [multiConfig, setMultiConfig] = useState(false);
|
||||
const [updateId, setUpdateId] = useState(0);
|
||||
const [playUrl, setPlayUrl] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
setCateId(Number(result.get("cid")));
|
||||
@ -231,7 +241,7 @@ const ResourceVideosPage = () => {
|
||||
setLoading(true);
|
||||
let categoryIds = category_ids.join(",");
|
||||
resource
|
||||
.resourceList(page, size, "", "", "", "VIDEO", categoryIds)
|
||||
.resourceList(page, size, "", "", title, "VIDEO", categoryIds)
|
||||
.then((res: any) => {
|
||||
setTotal(res.data.result.total);
|
||||
setVideoList(res.data.result.data);
|
||||
@ -250,6 +260,7 @@ const ResourceVideosPage = () => {
|
||||
setSize(10);
|
||||
setVideoList([]);
|
||||
setSelectedRowKeys([]);
|
||||
setTitle("");
|
||||
setRefresh(!refresh);
|
||||
};
|
||||
|
||||
@ -328,7 +339,34 @@ const ResourceVideosPage = () => {
|
||||
删除
|
||||
</Button>
|
||||
</div>
|
||||
<div className="d-flex"></div>
|
||||
<div className="d-flex">
|
||||
<div className="d-flex mr-24">
|
||||
<Typography.Text>名称:</Typography.Text>
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => {
|
||||
setTitle(e.target.value);
|
||||
}}
|
||||
allowClear
|
||||
style={{ width: 160 }}
|
||||
placeholder="请输入名称关键字"
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Button className="mr-16" onClick={resetVideoList}>
|
||||
重 置
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
setPage(1);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
>
|
||||
查 询
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="float-left">
|
||||
{multiConfig ? (
|
||||
|
@ -149,12 +149,12 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
||||
<Form.Item
|
||||
label="邮箱"
|
||||
name="email"
|
||||
rules={[{ required: true, message: "请输入学员邮箱!" }]}
|
||||
rules={[{ required: true, message: "请输入管理员邮箱!" }]}
|
||||
>
|
||||
<Input
|
||||
allowClear
|
||||
style={{ width: 200 }}
|
||||
placeholder="请输入学员邮箱"
|
||||
placeholder="请输入管理员邮箱"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
|
@ -111,7 +111,7 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
||||
<>
|
||||
{open ? (
|
||||
<Modal
|
||||
title="编辑管理人员"
|
||||
title="编辑管理员"
|
||||
centered
|
||||
forceRender
|
||||
open={true}
|
||||
@ -168,12 +168,12 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
||||
<Form.Item
|
||||
label="邮箱"
|
||||
name="email"
|
||||
rules={[{ required: true, message: "请输入学员邮箱!" }]}
|
||||
rules={[{ required: true, message: "请输入管理员邮箱!" }]}
|
||||
>
|
||||
<Input
|
||||
allowClear
|
||||
style={{ width: 200 }}
|
||||
placeholder="请输入学员邮箱"
|
||||
placeholder="请输入管理员邮箱"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="密码" name="password">
|
||||
|
@ -39,86 +39,53 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
||||
|
||||
const getParams = () => {
|
||||
adminRole.createAdminRole().then((res: any) => {
|
||||
const arr: Option[] = [
|
||||
{
|
||||
title: "学员",
|
||||
value: "学员-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员",
|
||||
value: "管理员-n",
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
const arr2: Option[] = [
|
||||
{
|
||||
title: "学员",
|
||||
value: "学员-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员",
|
||||
value: "管理员-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员日志",
|
||||
value: "管理员日志-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员角色",
|
||||
value: "管理员角色-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "线上课",
|
||||
value: "线上课-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "资源分类",
|
||||
value: "资源分类-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "部门",
|
||||
value: "部门-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "系统配置",
|
||||
value: "系统配置-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "其它",
|
||||
value: "其它-n",
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
const arr: any = [];
|
||||
const arr2: any = [];
|
||||
let actions = res.data.perm_action.action;
|
||||
let permissions = res.data.perm_action.data;
|
||||
for (let i = 0; i < permissions.length; i++) {
|
||||
arr.map((item: any) => {
|
||||
if (item.title === permissions[i].group_name) {
|
||||
item.children.push({
|
||||
title: permissions[i].name,
|
||||
value: permissions[i].id,
|
||||
});
|
||||
}
|
||||
});
|
||||
const key = arr.findIndex(
|
||||
(it: any) => it.title === permissions[i].group_name
|
||||
);
|
||||
if (key >= 0) {
|
||||
arr[key].children.push({
|
||||
title: permissions[i].name,
|
||||
value: permissions[i].id,
|
||||
});
|
||||
} else {
|
||||
arr.push({
|
||||
title: permissions[i].group_name,
|
||||
value: permissions[i].group_name + "-n",
|
||||
children: [
|
||||
{
|
||||
title: permissions[i].name,
|
||||
value: permissions[i].id,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
for (let j = 0; j < actions.length; j++) {
|
||||
arr2.map((item: any) => {
|
||||
if (item.title === actions[j].group_name) {
|
||||
item.children.push({
|
||||
title: actions[j].name,
|
||||
value: actions[j].id,
|
||||
});
|
||||
}
|
||||
});
|
||||
const key = arr2.findIndex(
|
||||
(it: any) => it.title === actions[j].group_name
|
||||
);
|
||||
if (key >= 0) {
|
||||
arr2[key].children.push({
|
||||
title: actions[j].name,
|
||||
value: actions[j].id,
|
||||
});
|
||||
} else {
|
||||
arr2.push({
|
||||
title: actions[j].group_name,
|
||||
value: actions[j].group_name + "-n",
|
||||
children: [
|
||||
{
|
||||
title: actions[j].name,
|
||||
value: actions[j].id,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
setPermissions(arr);
|
||||
setActions(arr2);
|
||||
|
@ -53,86 +53,53 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
||||
|
||||
const getParams = () => {
|
||||
adminRole.createAdminRole().then((res: any) => {
|
||||
const arr: Option[] = [
|
||||
{
|
||||
title: "学员",
|
||||
value: "学员-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员",
|
||||
value: "管理员-n",
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
const arr2: Option[] = [
|
||||
{
|
||||
title: "学员",
|
||||
value: "学员-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员",
|
||||
value: "管理员-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员日志",
|
||||
value: "管理员日志-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "管理员角色",
|
||||
value: "管理员角色-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "线上课",
|
||||
value: "线上课-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "资源分类",
|
||||
value: "资源分类-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "部门",
|
||||
value: "部门-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "系统配置",
|
||||
value: "系统配置-n",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
title: "其它",
|
||||
value: "其它-n",
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
const arr: any = [];
|
||||
const arr2: any = [];
|
||||
let actions = res.data.perm_action.action;
|
||||
let permissions = res.data.perm_action.data;
|
||||
for (let i = 0; i < permissions.length; i++) {
|
||||
arr.map((item: any) => {
|
||||
if (item.title === permissions[i].group_name) {
|
||||
item.children.push({
|
||||
title: permissions[i].name,
|
||||
value: permissions[i].id,
|
||||
});
|
||||
}
|
||||
});
|
||||
const key = arr.findIndex(
|
||||
(it: any) => it.title === permissions[i].group_name
|
||||
);
|
||||
if (key >= 0) {
|
||||
arr[key].children.push({
|
||||
title: permissions[i].name,
|
||||
value: permissions[i].id,
|
||||
});
|
||||
} else {
|
||||
arr.push({
|
||||
title: permissions[i].group_name,
|
||||
value: permissions[i].group_name + "-n",
|
||||
children: [
|
||||
{
|
||||
title: permissions[i].name,
|
||||
value: permissions[i].id,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
for (let j = 0; j < actions.length; j++) {
|
||||
arr2.map((item: any) => {
|
||||
if (item.title === actions[j].group_name) {
|
||||
item.children.push({
|
||||
title: actions[j].name,
|
||||
value: actions[j].id,
|
||||
});
|
||||
}
|
||||
});
|
||||
const key = arr2.findIndex(
|
||||
(it: any) => it.title === actions[j].group_name
|
||||
);
|
||||
if (key >= 0) {
|
||||
arr2[key].children.push({
|
||||
title: actions[j].name,
|
||||
value: actions[j].id,
|
||||
});
|
||||
} else {
|
||||
arr2.push({
|
||||
title: actions[j].group_name,
|
||||
value: actions[j].group_name + "-n",
|
||||
children: [
|
||||
{
|
||||
title: actions[j].name,
|
||||
value: actions[j].id,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
setPermissions(arr);
|
||||
setActions(arr2);
|
||||
|
@ -14,13 +14,14 @@ import {
|
||||
} from "antd";
|
||||
import { appConfig, system } from "../../../api/index";
|
||||
import { UploadImageButton } from "../../../compenents";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import type { TabsProps } from "antd";
|
||||
import type { CheckboxChangeEvent } from "antd/es/checkbox";
|
||||
import {
|
||||
SystemConfigStoreInterface,
|
||||
saveConfigAction,
|
||||
} from "../../../store/system/systemConfigSlice";
|
||||
import logoIcon from "../../../assets/logo.png";
|
||||
|
||||
const SystemConfigPage = () => {
|
||||
const dispatch = useDispatch();
|
||||
@ -33,6 +34,9 @@ const SystemConfigPage = () => {
|
||||
const [nameChecked, setNameChecked] = useState(false);
|
||||
const [emailChecked, setEmailChecked] = useState(false);
|
||||
const [idCardchecked, setIdCardChecked] = useState(false);
|
||||
const memberDefaultAvatar = useSelector(
|
||||
(state: any) => state.systemConfig.value.memberDefaultAvatar
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
getDetail();
|
||||
@ -52,6 +56,8 @@ const SystemConfigPage = () => {
|
||||
});
|
||||
if (configData[i].key_value !== "") {
|
||||
setLogo(configData[i].key_value);
|
||||
} else {
|
||||
setLogo(logoIcon);
|
||||
}
|
||||
} else if (configData[i].key_name === "system.api_url") {
|
||||
form.setFieldsValue({
|
||||
@ -122,7 +128,11 @@ const SystemConfigPage = () => {
|
||||
"system.pc_index_footer_msg": configData[i].key_value,
|
||||
});
|
||||
} else if (configData[i].key_name === "member.default_avatar") {
|
||||
setAvatar(configData[i].key_value);
|
||||
if (configData[i].key_value !== "") {
|
||||
setAvatar(configData[i].key_value);
|
||||
} else {
|
||||
setAvatar(memberDefaultAvatar);
|
||||
}
|
||||
form.setFieldsValue({
|
||||
"member.default_avatar": configData[i].key_value,
|
||||
});
|
||||
|
@ -24,22 +24,12 @@ export function timeFormat(dateStr: number) {
|
||||
return "-";
|
||||
}
|
||||
var d = moment.duration(dateStr, "seconds");
|
||||
let value =
|
||||
Math.floor(d.asDays()) +
|
||||
"天" +
|
||||
d.hours() +
|
||||
"时" +
|
||||
d.minutes() +
|
||||
"分" +
|
||||
d.seconds() +
|
||||
"秒";
|
||||
let value = d.hours() + "时" + d.minutes() + "分" + d.seconds() + "秒";
|
||||
|
||||
if (Math.floor(d.asDays()) === 0) {
|
||||
if (d.hours() === 0) {
|
||||
value = d.minutes() + "分" + d.seconds() + "秒";
|
||||
} else {
|
||||
value = d.hours() + "时" + d.minutes() + "分" + d.seconds() + "秒";
|
||||
}
|
||||
if (d.hours() === 0) {
|
||||
value = d.minutes() + "分" + d.seconds() + "秒";
|
||||
} else {
|
||||
value = d.hours() + "时" + d.minutes() + "分" + d.seconds() + "秒";
|
||||
}
|
||||
|
||||
return value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user