上传视频关闭窗口取消所有任务

This commit is contained in:
unknown 2023-07-20 09:17:48 +08:00
parent b4dd5a6b46
commit defc71697a

View File

@ -124,14 +124,29 @@ export const UploadVideoButton = (props: PropsInterface) => {
}; };
const closeWin = () => { const closeWin = () => {
if (upRef.current > 0) { // if (upRef.current > 0) {
message.error(`等待上传成功后才能关闭`); // message.error(`等待上传成功后才能关闭`);
return; // return;
} // }
if (fileList.length > 0) {
let i = 0;
fileList.map((item: any) => {
item.run.cancel();
i++;
});
if (i === fileList.length) {
setShowModal(false); setShowModal(false);
setFileList([]); setFileList([]);
localFileList.current = []; localFileList.current = [];
props.onUpdate(); props.onUpdate();
}
} else {
setShowModal(false);
setFileList([]);
localFileList.current = [];
props.onUpdate();
}
}; };
return ( return (