From cd2c1f061c165b775b35790c5d7bd1a5473467c7 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Thu, 3 Aug 2023 11:20:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E3=80=81=E8=AF=BE=E6=97=B6?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=BC=B9=E7=AA=97=E5=A2=9E=E5=8A=A0loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/select-attachment/index.tsx | 17 +++++++++++++++-- src/compenents/select-resource/index.tsx | 17 +++++++++++++++-- src/compenents/upload-courseware-sub/index.tsx | 2 ++ src/compenents/upload-video-sub/index.tsx | 2 ++ src/index.less | 4 ++++ 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/compenents/select-attachment/index.tsx b/src/compenents/select-attachment/index.tsx index 774b47b..5a4f08a 100644 --- a/src/compenents/select-attachment/index.tsx +++ b/src/compenents/select-attachment/index.tsx @@ -1,5 +1,5 @@ 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 { UploadCoursewareSub } from "../../compenents"; import type { TabsProps } from "antd"; @@ -13,11 +13,13 @@ interface PropsInterface { export const SelectAttachment = (props: PropsInterface) => { const [refresh, setRefresh] = useState(true); + const [init, setInit] = useState(true); const [tabKey, setTabKey] = useState(1); const [selectKeys, setSelectKeys] = useState([]); const [selectVideos, setSelectVideos] = useState([]); useEffect(() => { + setInit(true); setRefresh(!refresh); }, [props.open]); @@ -26,7 +28,10 @@ export const SelectAttachment = (props: PropsInterface) => { key: "1", label: `课件`, children: ( -
+
{ setSelectKeys(arr); setSelectVideos(videos); }} + onSuccess={() => { + setInit(false); + }} />
), @@ -69,6 +77,11 @@ export const SelectAttachment = (props: PropsInterface) => { + {init && ( +
+ +
+ )} ) : null} diff --git a/src/compenents/select-resource/index.tsx b/src/compenents/select-resource/index.tsx index b30c29e..93f4ca8 100644 --- a/src/compenents/select-resource/index.tsx +++ b/src/compenents/select-resource/index.tsx @@ -1,5 +1,5 @@ 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 { UploadVideoSub } from "../../compenents"; import type { TabsProps } from "antd"; @@ -13,11 +13,13 @@ 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([]); const [selectVideos, setSelectVideos] = useState([]); useEffect(() => { + setInit(true); setRefresh(!refresh); }, [props.open]); @@ -26,7 +28,10 @@ export const SelectResource = (props: PropsInterface) => { key: "1", label: `视频`, children: ( -
+
{ setSelectKeys(arr); setSelectVideos(videos); }} + onSuccess={() => { + setInit(false); + }} />
), @@ -69,6 +77,11 @@ export const SelectResource = (props: PropsInterface) => { + {init && ( +
+ +
+ )} ) : null} diff --git a/src/compenents/upload-courseware-sub/index.tsx b/src/compenents/upload-courseware-sub/index.tsx index d2d4689..013264b 100644 --- a/src/compenents/upload-courseware-sub/index.tsx +++ b/src/compenents/upload-courseware-sub/index.tsx @@ -34,6 +34,7 @@ interface PropsInterface { label: string; open: boolean; onSelected: (arr: any[], videos: []) => void; + onSuccess: () => void; } export const UploadCoursewareSub = (props: PropsInterface) => { @@ -75,6 +76,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => { setTotal(res.data.result.total); setExistingTypes(res.data.existing_types); setVideoList(res.data.result.data); + props.onSuccess(); }) .catch((err) => { console.log("错误,", err); diff --git a/src/compenents/upload-video-sub/index.tsx b/src/compenents/upload-video-sub/index.tsx index b9fe6db..cd81a19 100644 --- a/src/compenents/upload-video-sub/index.tsx +++ b/src/compenents/upload-video-sub/index.tsx @@ -35,6 +35,7 @@ interface PropsInterface { label: string; open: boolean; onSelected: (arr: any[], videos: []) => void; + onSuccess: () => void; } export const UploadVideoSub = (props: PropsInterface) => { @@ -68,6 +69,7 @@ export const UploadVideoSub = (props: PropsInterface) => { setTotal(res.data.result.total); setVideoExtra(res.data.videos_extra); setVideoList(res.data.result.data); + props.onSuccess(); }) .catch((err) => { console.log("错误,", err); diff --git a/src/index.less b/src/index.less index 5251d39..1dd6072 100644 --- a/src/index.less +++ b/src/index.less @@ -189,6 +189,10 @@ code { flex: 1; } +.text-center { + text-align: center; +} + .c-admin { font-size: 14px; font-weight: 400;