视频上传增加限制

This commit is contained in:
unknown 2024-01-09 11:10:51 +08:00
parent fbf95bbb66
commit 6ed4d50006

View File

@ -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 = () => {
</p>
<p className="ant-upload-text"></p>
<p className="ant-upload-hint">
/ mp4
/ 2G以内的mp4文件
</p>
</Dragger>
</Col>