feat: 优化

This commit is contained in:
2025-11-16 22:59:26 +08:00
parent 1540e44288
commit bd2e8b3291
10 changed files with 550 additions and 178 deletions

View File

@@ -31,14 +31,23 @@ export const MaterialService = {
/**
* 上传文件
* @param {FormData} formData - 文件表单数据
* @param {File} file - 文件对象
* @param {string} fileCategory - 文件分类video/generate/audio/mix/voice
* @param {string} coverBase64 - 视频封面 base64可选data URI 格式)
* @returns {Promise}
*/
uploadFile(file, fileCategory) {
uploadFile(file, fileCategory, coverBase64 = null) {
const formData = new FormData()
formData.append('file', file)
formData.append('fileCategory', fileCategory)
// 如果有封面 base64添加到表单数据
if (coverBase64) {
// base64 格式data:image/jpeg;base64,/9j/4AAQ...
// 后端会解析这个格式
formData.append('coverBase64', coverBase64)
}
// 大文件上传需要更长的超时时间30分钟
return http.post(`${BASE_URL}/upload`, formData, {
timeout: 30 * 60 * 1000 // 30分钟