线上课课时、课件编辑增加loading

This commit is contained in:
unknown 2023-08-04 09:16:07 +08:00
parent 425033f672
commit 7f1902d490
2 changed files with 178 additions and 150 deletions

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
import { Button, Drawer, Form, Modal, message } from "antd";
import { Button, Drawer, Form, Modal, message, Spin } from "antd";
import styles from "./hour-update.module.less";
import { course, courseAttachment } from "../../../api/index";
import { SelectAttachment } from "../../../compenents";
@ -20,11 +20,13 @@ export const CourseAttachmentUpdate: React.FC<PropInterface> = ({
onCancel,
}) => {
const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [attachmentVisible, setAttachmentVisible] = useState<boolean>(false);
const [attachmentData, setAttachmentData] = useState<any>([]);
const [attachments, setAttachments] = useState<any>([]);
useEffect(() => {
setInit(true);
if (id === 0) {
return;
}
@ -43,6 +45,7 @@ export const CourseAttachmentUpdate: React.FC<PropInterface> = ({
setAttachmentData(arr);
setAttachments(keys);
}
setInit(false);
});
};
@ -169,6 +172,15 @@ export const CourseAttachmentUpdate: React.FC<PropInterface> = ({
selectAttachmentData(arr, videos);
}}
></SelectAttachment>
{init && (
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left"
style={{ display: init ? "none" : "block" }}
>
<Form
form={form}
name="attachment-update-basic"
@ -211,6 +223,7 @@ export const CourseAttachmentUpdate: React.FC<PropInterface> = ({
</div>
</Form>
</div>
</div>
</Drawer>
) : null}
</>

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
import { Button, Drawer, Form, Input, Modal, message } from "antd";
import { Button, Drawer, Form, Input, Modal, message, Spin } from "antd";
import styles from "./hour-update.module.less";
import { course, courseHour, courseChapter } from "../../../api/index";
import { SelectResource } from "../../../compenents";
@ -20,6 +20,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
onCancel,
}) => {
const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [chapterType, setChapterType] = useState(0);
const [chapters, setChapters] = useState<any>([]);
const [hours, setHours] = useState<any>([]);
@ -29,6 +30,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
const [addvideoCurrent, setAddvideoCurrent] = useState(0);
useEffect(() => {
setInit(true);
if (id === 0) {
return;
}
@ -77,6 +79,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
setHours([]);
}
}
setInit(false);
});
};
@ -373,6 +376,15 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
}
}}
/>
{init && (
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left"
style={{ display: init ? "none" : "block" }}
>
<Form
form={form}
name="hour-update-basic"
@ -478,13 +490,16 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
})}
<Form.Item>
<div className="ml-42">
<Button onClick={() => addNewChapter()}></Button>
<Button onClick={() => addNewChapter()}>
</Button>
</div>
</Form.Item>
</div>
)}
</Form>
</div>
</div>
</Drawer>
) : null}
</>