线上课课时编辑优化

This commit is contained in:
禺狨 2023-03-22 10:57:46 +08:00
parent b4cb9a0843
commit 3ef7644135
3 changed files with 72 additions and 42 deletions

View File

@ -81,6 +81,10 @@ code {
margin-left: 15px; margin-left: 15px;
} }
.ml-42 {
margin-left: 42px;
}
.ml-120 { .ml-120 {
margin-left: 120px; margin-left: 120px;
} }

View File

@ -1,13 +1,13 @@
.top-content { .top-content {
width: 502px; width: 502px;
height: 80px; height: auto;
background: rgba(255, 77, 79, 0.1); background: rgba(255, 77, 79, 0.1);
border-radius: 6px; border-radius: 6px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
box-sizing: border-box; box-sizing: border-box;
padding: 16px; padding: 8px 16px;
margin: 0 auto; margin: 0 auto;
p { p {
font-size: 14px; font-size: 14px;

View File

@ -158,6 +158,14 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
const delHour = (hid: number) => { const delHour = (hid: number) => {
const data = [...treeData]; const data = [...treeData];
confirm({
title: "操作确认",
icon: <ExclamationCircleFilled />,
content: "确认删除此课时?",
centered: true,
okText: "确认",
cancelText: "取消",
onOk() {
const index = data.findIndex((i: any) => i.rid === hid); const index = data.findIndex((i: any) => i.rid === hid);
let delId = data[index].id; let delId = data[index].id;
if (index >= 0) { if (index >= 0) {
@ -176,6 +184,11 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
console.log("ok"); console.log("ok");
}); });
} }
},
onCancel() {
console.log("Cancel");
},
});
}; };
const transHour = (arr: any) => { const transHour = (arr: any) => {
@ -270,6 +283,14 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
const delChapterHour = (index: number, hid: number) => { const delChapterHour = (index: number, hid: number) => {
const keys = [...chapterHours]; const keys = [...chapterHours];
const data = [...chapters]; const data = [...chapters];
confirm({
title: "操作确认",
icon: <ExclamationCircleFilled />,
content: "确认删除此课时?",
centered: true,
okText: "确认",
cancelText: "取消",
onOk() {
const current = data[index].hours.findIndex((i: any) => i.rid === hid); const current = data[index].hours.findIndex((i: any) => i.rid === hid);
let delId = data[index].hours.map((item: any) => item.id); let delId = data[index].hours.map((item: any) => item.id);
if (current >= 0) { if (current >= 0) {
@ -291,6 +312,11 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
console.log("ok"); console.log("ok");
}); });
} }
},
onCancel() {
console.log("Cancel");
},
});
}; };
const transChapterHour = (index: number, arr: any) => { const transChapterHour = (index: number, arr: any) => {
@ -359,7 +385,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
{chapterType === 0 && ( {chapterType === 0 && (
<div className="c-flex"> <div className="c-flex">
<Form.Item> <Form.Item>
<div className="ml-120"> <div className="ml-42">
<Button <Button
onClick={() => setVideoVisible(true)} onClick={() => setVideoVisible(true)}
type="primary" type="primary"
@ -448,7 +474,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
); );
})} })}
<Form.Item> <Form.Item>
<div className="ml-120"> <div className="ml-42">
<Button onClick={() => addNewChapter()}></Button> <Button onClick={() => addNewChapter()}></Button>
</div> </div>
</Form.Item> </Form.Item>