This commit is contained in:
@@ -64,7 +64,7 @@ const videoUpload = multer({
|
||||
storage: storage,
|
||||
fileFilter: mixedFileFilter, // 使用混合文件过滤器
|
||||
limits: {
|
||||
fileSize: 10* 1024 * 1024 * 1024, // 10GB
|
||||
fileSize: 2 * 1024 * 1024 * 1024 // 2GB
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -84,6 +84,7 @@ async function saveVideoToLocal(fileBuffer, filename) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件到图床
|
||||
* @param {Buffer} fileBuffer - 文件缓冲区
|
||||
|
@@ -63,7 +63,7 @@ export const videoApi = {
|
||||
* @returns {Object} 验证结果
|
||||
*/
|
||||
validateVideoFile(file) {
|
||||
const maxSize = apiConfig.upload.video?.maxFileSize || 10* 1024 * 1024 * 1024 // 10GB
|
||||
const maxSize = apiConfig.upload.video?.maxFileSize || 2 * 1024 * 1024 * 1024 // 2GB
|
||||
const allowedTypes = apiConfig.upload.video?.allowedTypes || [
|
||||
'video/mp4',
|
||||
'video/avi',
|
||||
|
@@ -90,7 +90,7 @@ const props = defineProps({
|
||||
},
|
||||
maxSize: {
|
||||
type: Number,
|
||||
default: 10* 1024 * 1024 * 1024, // 10GB
|
||||
default: 2 * 1024 * 1024 * 1024 // 2GB
|
||||
}
|
||||
})
|
||||
|
||||
|
@@ -27,13 +27,13 @@ export const apiConfig = {
|
||||
upload: {
|
||||
// 图片上传配置
|
||||
image: {
|
||||
maxFileSize: 10 * 1024 * 1024, // 10MB
|
||||
maxFileSize: 150 * 1024 * 1024, // 150MB
|
||||
allowedTypes: ['image/jpeg', 'image/png', 'image/webp'],
|
||||
maxCount: 9 // 最多上传9张图片
|
||||
},
|
||||
// 视频上传配置
|
||||
video: {
|
||||
maxFileSize: 10* 1024 * 1024 * 1024, // 10GB
|
||||
maxFileSize: 2 * 1024 * 1024 * 1024, // 2GB
|
||||
allowedTypes: ['video/mp4', 'video/avi', 'video/mov', 'video/wmv', 'video/flv', 'video/webm'],
|
||||
maxCount: 1 // 最多上传1个视频
|
||||
}
|
||||
|
@@ -1102,7 +1102,7 @@ const handleVideoFileSelect = async (event, fieldKey) => {
|
||||
|
||||
// 验证文件类型和大小
|
||||
const validTypes = ['video/mp4', 'video/avi', 'video/mov', 'video/wmv', 'video/flv']
|
||||
const maxSize = 10* 1024 * 1024 * 1024 // 10GB
|
||||
const maxSize = 2 * 1024 * 1024 * 1024 // 2GB
|
||||
|
||||
if (!validTypes.includes(file.type)) {
|
||||
videoErrors.value[fieldKey] = '请选择有效的视频格式 (MP4, AVI, MOV, WMV, FLV)'
|
||||
|
Reference in New Issue
Block a user