From 1046bb70b8e0eb34e460d78a0b40d6df38cba0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Wed, 5 Jul 2023 11:21:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/upload-video-button/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compenents/upload-video-button/index.tsx b/src/compenents/upload-video-button/index.tsx index f41c1fa..ffbcc27 100644 --- a/src/compenents/upload-video-button/index.tsx +++ b/src/compenents/upload-video-button/index.tsx @@ -42,6 +42,7 @@ interface FileItem { export const UploadVideoButton = (props: PropsInterface) => { const [showModal, setShowModal] = useState(false); + const [loading, setLoading] = useState(false); const localFileList = useRef([]); const [fileList, setFileList] = useState([]); @@ -54,6 +55,7 @@ export const UploadVideoButton = (props: PropsInterface) => { multiple: true, beforeUpload: async (file: File) => { if (file.type === "video/mp4") { + setLoading(true); // 视频封面解析 || 视频时长解析 let videoInfo = await parseVideo(file); // 添加到本地待上传 @@ -91,6 +93,7 @@ export const UploadVideoButton = (props: PropsInterface) => { item.isSuc = true; setFileList([...localFileList.current]); message.success(`${item.file.name} 上传成功`); + setLoading(false); }); }); item.run.on("retry", () => { @@ -106,6 +109,7 @@ export const UploadVideoButton = (props: PropsInterface) => { item.isErr = true; item.errMsg = msg; setFileList([...localFileList.current]); + setLoading(false); }); setTimeout(() => { item.run.start(); @@ -120,6 +124,10 @@ export const UploadVideoButton = (props: PropsInterface) => { }; const closeWin = () => { + if (loading) { + message.error(`等待上传成功后才能关闭`); + return; + } setShowModal(false); setFileList([]); props.onUpdate();