fix:问题

This commit is contained in:
2026-02-02 02:39:40 +08:00
parent 49c660a6e3
commit 33b748915d
9 changed files with 96 additions and 43 deletions

View File

@@ -133,28 +133,23 @@ export function useUpload() {
fileType: file.type,
groupId,
coverBase64,
duration: file.type.startsWith('video/') ? null : undefined // 视频时长由后端处理或前端可选传递
duration: file.type.startsWith('video/') ? null : undefined
})
// 设置成功状态
state.uploading = false
state.status = 'success'
state.progress = 100
// 通知成功
const fileId = completeData.data?.infraFileId || completeData.data?.userFileId
onSuccess && onSuccess(fileId)
const fileUrl = presignedData.data.presignedUrl
onSuccess && onSuccess(fileId, fileUrl)
return fileId
} catch (error) {
// 设置错误状态
state.uploading = false
state.status = 'error'
state.error = error.message || '上传失败'
// 通知错误
onError && onError(error)
throw error
}
}