fix: 预上传导致切片实效

This commit is contained in:
Lan
2026-01-07 19:27:08 +08:00
parent 589bb74461
commit b7da890897
3 changed files with 4 additions and 26 deletions
+1 -16
View File
@@ -74,7 +74,6 @@ export function usePresignedUpload() {
const isError = computed(() => presignStatus.value === PRESIGN_UPLOAD_STATUS.ERROR)
const currentMode = computed<PresignUploadMode | null>(() => uploadSession.value?.mode ?? null)
/**
* 文件大小验证
*/
@@ -144,7 +143,6 @@ export function usePresignedUpload() {
alertStore.showAlert(errorMessage.value, 'error')
}
/**
* 初始化上传会话
*/
@@ -224,7 +222,6 @@ export function usePresignedUpload() {
}
}
/**
* 代理模式上传
*/
@@ -263,30 +260,19 @@ export function usePresignedUpload() {
}
}
/**
* 上传文件(主入口方法)
* 根据 mode 自动选择直传或代理上传
*/
const uploadFile = async (
file: File,
options?: PresignUploadOptions
): Promise<string | null> => {
// 重置状态
const uploadFile = async (file: File, options?: PresignUploadOptions): Promise<string | null> => {
reset()
// 验证文件大小
if (!validateFileSize(file)) {
presignStatus.value = PRESIGN_UPLOAD_STATUS.ERROR
return null
}
// 初始化上传会话
const session = await initUploadSession(file, options)
if (!session) {
return null
}
// 根据模式选择上传方式
if (session.mode === 'direct') {
return await uploadDirect(file, session, options)
} else {
@@ -294,7 +280,6 @@ export function usePresignedUpload() {
}
}
/**
* 取消上传
*/