refactor: 统一文件存储与上传流程,解耦 OSS 客户端、存储类型与前端上传模式

This commit is contained in:
2026-08-25 00:00:19 +08:00
parent 78dbc865fd
commit 81358e6d7c
57 changed files with 776 additions and 672 deletions
@@ -19,8 +19,8 @@ import dayjs from 'dayjs';
import {
createCompanyApi,
updateCompanyApi,
uploadCompanyLogoApi,
} from '#/api/company';
import { uploadFile } from '#/utils/upload-file';
interface Emits {
(e: 'success'): void;
@@ -271,11 +271,13 @@ async function uploadLogoAndGetId(): Promise<number | undefined> {
}
try {
const response = await uploadCompanyLogoApi(newLogoFile.value);
return response.id;
const fileInfo = await uploadFile(newLogoFile.value, {
category: 'company-logo',
errorMessage: 'Logo上传失败',
});
return fileInfo.id;
} catch (error) {
console.error('Logo上传失败:', error);
message.error('Logo上传失败');
throw error;
}
}