mirror of
https://github.com/PlayEdu/backend
synced 2025-06-22 00:52:48 +08:00
课件、课时选择弹窗增加loading
This commit is contained in:
parent
eb1e82fc12
commit
cd2c1f061c
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Row, Modal, Tabs } from "antd";
|
import { Row, Modal, Tabs, Spin } from "antd";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import { UploadCoursewareSub } from "../../compenents";
|
import { UploadCoursewareSub } from "../../compenents";
|
||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
@ -13,11 +13,13 @@ interface PropsInterface {
|
|||||||
|
|
||||||
export const SelectAttachment = (props: PropsInterface) => {
|
export const SelectAttachment = (props: PropsInterface) => {
|
||||||
const [refresh, setRefresh] = useState(true);
|
const [refresh, setRefresh] = useState(true);
|
||||||
|
const [init, setInit] = useState(true);
|
||||||
const [tabKey, setTabKey] = useState(1);
|
const [tabKey, setTabKey] = useState(1);
|
||||||
const [selectKeys, setSelectKeys] = useState<any>([]);
|
const [selectKeys, setSelectKeys] = useState<any>([]);
|
||||||
const [selectVideos, setSelectVideos] = useState<any>([]);
|
const [selectVideos, setSelectVideos] = useState<any>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setInit(true);
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
}, [props.open]);
|
}, [props.open]);
|
||||||
|
|
||||||
@ -26,7 +28,10 @@ export const SelectAttachment = (props: PropsInterface) => {
|
|||||||
key: "1",
|
key: "1",
|
||||||
label: `课件`,
|
label: `课件`,
|
||||||
children: (
|
children: (
|
||||||
<div className="float-left">
|
<div
|
||||||
|
className="float-left"
|
||||||
|
style={{ display: init ? "none" : "block" }}
|
||||||
|
>
|
||||||
<UploadCoursewareSub
|
<UploadCoursewareSub
|
||||||
label="课件"
|
label="课件"
|
||||||
defaultCheckedList={props.defaultKeys}
|
defaultCheckedList={props.defaultKeys}
|
||||||
@ -35,6 +40,9 @@ export const SelectAttachment = (props: PropsInterface) => {
|
|||||||
setSelectKeys(arr);
|
setSelectKeys(arr);
|
||||||
setSelectVideos(videos);
|
setSelectVideos(videos);
|
||||||
}}
|
}}
|
||||||
|
onSuccess={() => {
|
||||||
|
setInit(false);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@ -69,6 +77,11 @@ export const SelectAttachment = (props: PropsInterface) => {
|
|||||||
<Row>
|
<Row>
|
||||||
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
|
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
|
||||||
</Row>
|
</Row>
|
||||||
|
{init && (
|
||||||
|
<div className="float-left text-center mt-30">
|
||||||
|
<Spin></Spin>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Row, Modal, Tabs } from "antd";
|
import { Row, Modal, Tabs, Spin } from "antd";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import { UploadVideoSub } from "../../compenents";
|
import { UploadVideoSub } from "../../compenents";
|
||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
@ -13,11 +13,13 @@ interface PropsInterface {
|
|||||||
|
|
||||||
export const SelectResource = (props: PropsInterface) => {
|
export const SelectResource = (props: PropsInterface) => {
|
||||||
const [refresh, setRefresh] = useState(true);
|
const [refresh, setRefresh] = useState(true);
|
||||||
|
const [init, setInit] = useState(true);
|
||||||
const [tabKey, setTabKey] = useState(1);
|
const [tabKey, setTabKey] = useState(1);
|
||||||
const [selectKeys, setSelectKeys] = useState<any>([]);
|
const [selectKeys, setSelectKeys] = useState<any>([]);
|
||||||
const [selectVideos, setSelectVideos] = useState<any>([]);
|
const [selectVideos, setSelectVideos] = useState<any>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setInit(true);
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
}, [props.open]);
|
}, [props.open]);
|
||||||
|
|
||||||
@ -26,7 +28,10 @@ export const SelectResource = (props: PropsInterface) => {
|
|||||||
key: "1",
|
key: "1",
|
||||||
label: `视频`,
|
label: `视频`,
|
||||||
children: (
|
children: (
|
||||||
<div className="float-left">
|
<div
|
||||||
|
className="float-left"
|
||||||
|
style={{ display: init ? "none" : "block" }}
|
||||||
|
>
|
||||||
<UploadVideoSub
|
<UploadVideoSub
|
||||||
label="视频"
|
label="视频"
|
||||||
defaultCheckedList={props.defaultKeys}
|
defaultCheckedList={props.defaultKeys}
|
||||||
@ -35,6 +40,9 @@ export const SelectResource = (props: PropsInterface) => {
|
|||||||
setSelectKeys(arr);
|
setSelectKeys(arr);
|
||||||
setSelectVideos(videos);
|
setSelectVideos(videos);
|
||||||
}}
|
}}
|
||||||
|
onSuccess={() => {
|
||||||
|
setInit(false);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@ -69,6 +77,11 @@ export const SelectResource = (props: PropsInterface) => {
|
|||||||
<Row>
|
<Row>
|
||||||
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
|
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
|
||||||
</Row>
|
</Row>
|
||||||
|
{init && (
|
||||||
|
<div className="float-left text-center mt-30">
|
||||||
|
<Spin></Spin>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
|
@ -34,6 +34,7 @@ interface PropsInterface {
|
|||||||
label: string;
|
label: string;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onSelected: (arr: any[], videos: []) => void;
|
onSelected: (arr: any[], videos: []) => void;
|
||||||
|
onSuccess: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UploadCoursewareSub = (props: PropsInterface) => {
|
export const UploadCoursewareSub = (props: PropsInterface) => {
|
||||||
@ -75,6 +76,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
|||||||
setTotal(res.data.result.total);
|
setTotal(res.data.result.total);
|
||||||
setExistingTypes(res.data.existing_types);
|
setExistingTypes(res.data.existing_types);
|
||||||
setVideoList(res.data.result.data);
|
setVideoList(res.data.result.data);
|
||||||
|
props.onSuccess();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("错误,", err);
|
console.log("错误,", err);
|
||||||
|
@ -35,6 +35,7 @@ interface PropsInterface {
|
|||||||
label: string;
|
label: string;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onSelected: (arr: any[], videos: []) => void;
|
onSelected: (arr: any[], videos: []) => void;
|
||||||
|
onSuccess: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UploadVideoSub = (props: PropsInterface) => {
|
export const UploadVideoSub = (props: PropsInterface) => {
|
||||||
@ -68,6 +69,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
setTotal(res.data.result.total);
|
setTotal(res.data.result.total);
|
||||||
setVideoExtra(res.data.videos_extra);
|
setVideoExtra(res.data.videos_extra);
|
||||||
setVideoList(res.data.result.data);
|
setVideoList(res.data.result.data);
|
||||||
|
props.onSuccess();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("错误,", err);
|
console.log("错误,", err);
|
||||||
|
@ -189,6 +189,10 @@ code {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.c-admin {
|
.c-admin {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user