diff --git a/src/locales/en.ts b/src/locales/en.ts index ab44e71..8375904 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -537,7 +537,7 @@ export default { retry: 'Retry', retryAll: 'Retry all', remove: 'Remove', - hint: 'Supports MP4 / MOV / MKV / WEBM, max 500MB each; up to 2 files in parallel.', + hint: 'Supports MP4 / MOV / MKV / WEBM, max 500MB each; multi-select allowed, 2 upload in parallel, the rest queue automatically.', invalidType: 'Only MP4, MOV, MKV, WEBM are allowed', oversize: 'File exceeds 500MB and was not queued', overallProgress: 'Overall progress', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index a66b726..63286e2 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -531,7 +531,7 @@ export default { retry: '重试', retryAll: '全部重试', remove: '移除', - hint: '支持 MP4 / MOV / MKV / WEBM,单文件不超过 500MB;同时最多上传 2 个文件。', + hint: '支持 MP4 / MOV / MKV / WEBM,单文件不超过 500MB;可一次多选,同时上传 2 个,其余自动排队。', invalidType: '仅支持 MP4、MOV、MKV、WEBM', oversize: '文件超过 500MB,未入队', overallProgress: '总进度', diff --git a/src/views/contentManagement/EpisodeManagementView.vue b/src/views/contentManagement/EpisodeManagementView.vue index bc7f1f2..6c7eac7 100644 --- a/src/views/contentManagement/EpisodeManagementView.vue +++ b/src/views/contentManagement/EpisodeManagementView.vue @@ -20,7 +20,7 @@ import { useI18n } from '@/hooks/web/useI18n' import { probeVideoDuration, uploadFile } from '@/utils/uploader' import BatchUploadDialog from './upload/BatchUploadDialog.vue' import { listPendingSessions } from './upload/uploadSessions' -import { MAX_VIDEO_SIZE } from './upload/videoLimit' +import { MAX_VIDEO_SIZE, VIDEO_ACCEPT_ATTR, VIDEO_EXTENSIONS } from './upload/videoLimit' const route = useRoute() const { can } = useRbac() @@ -62,7 +62,6 @@ const statusOptions = [ { code: 'offline', text: '已下线' } ] -const VIDEO_EXTENSIONS = ['mp4', 'mov'] const formRules = { number: [{ required: true, message: '请输入集号', trigger: 'change' }], title: [{ required: true, message: '请输入剧集标题', trigger: 'blur' }], @@ -218,7 +217,7 @@ function beforeVideoUpload(file) { .pop() ?.toLowerCase() if (!VIDEO_EXTENSIONS.includes(extension)) { - videoError.value = '视频仅支持 MP4 或 MOV 格式' + videoError.value = t('episodeBatch.invalidType') return false } if (file.size > MAX_VIDEO_SIZE) { @@ -556,7 +555,7 @@ onMounted(async () => { drag class="episode-video-empty-upload" :show-file-list="false" - accept=".mp4,.mov" + :accept="VIDEO_ACCEPT_ATTR" :before-upload="beforeVideoUpload" :http-request="uploadVideo" :disabled="uploadingVideo" @@ -564,7 +563,7 @@ onMounted(async () => {
拖放或点击上传 - MP4、MOV + MP4、MOV、MKV、WEBM
@@ -582,7 +581,7 @@ onMounted(async () => { {{ videoDisplayName }}
-

支持 MP4、MOV,单个文件不超过 500MB。

+

{{ t('episodeBatch.hint') }}

{ props.modelValue, set: (value: boolean) => emit('update:modelValue', value) @@ -208,7 +205,7 @@ function onEpisodesCreated(): void { type="file" multiple hidden - :accept="ACCEPT_ATTR" + :accept="VIDEO_ACCEPT_ATTR" @change="onPickFiles" /> diff --git a/src/views/contentManagement/upload/videoLimit.ts b/src/views/contentManagement/upload/videoLimit.ts index a649d8a..4f66667 100644 --- a/src/views/contentManagement/upload/videoLimit.ts +++ b/src/views/contentManagement/upload/videoLimit.ts @@ -1,3 +1,9 @@ // Author: fruit.com.cn /** 剧集视频大小上限,单文件上传与批量上传共用。 */ export const MAX_VIDEO_SIZE = 500 * 1024 * 1024 + +/** 允许的视频扩展名(小写,不含点),单文件与批量上传同源。 */ +export const VIDEO_EXTENSIONS: string[] = ['mp4', 'mov', 'mkv', 'webm'] + +/** el-upload / input[type=file] 的 accept 属性,与 VIDEO_EXTENSIONS 保持一致。 */ +export const VIDEO_ACCEPT_ATTR = '.mp4,.mov,.mkv,.webm,video/*'