mirror of
https://github.com/PlayEdu/backend
synced 2025-06-07 23:44:10 +08:00
视频上传增加限制
This commit is contained in:
parent
fbf95bbb66
commit
6ed4d50006
@ -64,7 +64,18 @@ export const UploadVideoFloatButton = () => {
|
|||||||
|
|
||||||
const uploadProps = {
|
const uploadProps = {
|
||||||
multiple: true,
|
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") {
|
if (file.type === "video/mp4") {
|
||||||
// 视频封面解析 || 视频时长解析
|
// 视频封面解析 || 视频时长解析
|
||||||
let videoInfo = await parseVideo(file);
|
let videoInfo = await parseVideo(file);
|
||||||
@ -175,7 +186,7 @@ export const UploadVideoFloatButton = () => {
|
|||||||
</p>
|
</p>
|
||||||
<p className="ant-upload-text">请将视频拖拽到此处上传</p>
|
<p className="ant-upload-text">请将视频拖拽到此处上传</p>
|
||||||
<p className="ant-upload-hint">
|
<p className="ant-upload-hint">
|
||||||
支持一次上传多个 / 支持 mp4 格式视频
|
支持一次上传多个 / 支持2G以内的mp4文件
|
||||||
</p>
|
</p>
|
||||||
</Dragger>
|
</Dragger>
|
||||||
</Col>
|
</Col>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user