From 6ed4d500064fb74e892166d64865249cda0140d4 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Tue, 9 Jan 2024 11:10:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=B8=8A=E4=BC=A0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../upload-video-float-button/index.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/compenents/upload-video-float-button/index.tsx b/src/compenents/upload-video-float-button/index.tsx index b5a8aaa..88144c4 100644 --- a/src/compenents/upload-video-float-button/index.tsx +++ b/src/compenents/upload-video-float-button/index.tsx @@ -64,7 +64,18 @@ export const UploadVideoFloatButton = () => { const uploadProps = { multiple: true, - beforeUpload: async (file: File) => { + beforeUpload: async (file: File, fileList: any) => { + if (file.size > 2 * 1024 * 1024 * 1024) { + message.error(`${file.name} 大小超过2G`); + return Upload.LIST_IGNORE; + } + if (fileList.length > 10) { + message.config({ maxCount: 1 }); + message.error("单次最多上传10个视频"); + return Upload.LIST_IGNORE; + } else { + message.config({ maxCount: 10 }); + } if (file.type === "video/mp4") { // 视频封面解析 || 视频时长解析 let videoInfo = await parseVideo(file); @@ -175,7 +186,7 @@ export const UploadVideoFloatButton = () => {
请将视频拖拽到此处上传
- 支持一次上传多个 / 支持 mp4 格式视频 + 支持一次上传多个 / 支持2G以内的mp4文件