选择课时、课件弹窗组件loading加载逻辑优化

This commit is contained in:
unknown
2023-08-04 09:35:46 +08:00
parent 7f1902d490
commit 3b2f7f222c
4 changed files with 79 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { Row, Modal, Tabs, Spin } from "antd";
import { Row, Modal, Tabs } from "antd";
import styles from "./index.module.less";
import { UploadVideoSub } from "../../compenents";
import type { TabsProps } from "antd";
@@ -13,13 +13,11 @@ interface PropsInterface {
export const SelectResource = (props: PropsInterface) => {
const [refresh, setRefresh] = useState(true);
const [init, setInit] = useState(true);
const [tabKey, setTabKey] = useState(1);
const [selectKeys, setSelectKeys] = useState<any>([]);
const [selectVideos, setSelectVideos] = useState<any>([]);
useEffect(() => {
setInit(true);
setRefresh(!refresh);
}, [props.open]);
@@ -28,10 +26,7 @@ export const SelectResource = (props: PropsInterface) => {
key: "1",
label: `视频`,
children: (
<div
className="float-left"
style={{ display: init ? "none" : "block" }}
>
<div className="float-left">
<UploadVideoSub
label="视频"
defaultCheckedList={props.defaultKeys}
@@ -40,9 +35,6 @@ export const SelectResource = (props: PropsInterface) => {
setSelectKeys(arr);
setSelectVideos(videos);
}}
onSuccess={() => {
setInit(false);
}}
/>
</div>
),
@@ -77,11 +69,6 @@ export const SelectResource = (props: PropsInterface) => {
<Row>
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
</Row>
{init && (
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
</Modal>
) : null}
</>