fix:问题
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user