mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 01:49:19 +08:00
refactor: 统一文件存储与上传流程,解耦 OSS 客户端、存储类型与前端上传模式
This commit is contained in:
+6
-4
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user