feat: 修复发布时图片未上传完成导致详情图片丢失的问题,修复详情球局日期展示问题,修复球局管理取消活动无响应的问题

This commit is contained in:
2025-10-24 15:59:03 +08:00
parent 4126ad5679
commit f93b27c4a7
8 changed files with 308 additions and 193 deletions

View File

@@ -48,26 +48,36 @@ class UploadApi {
const authHeader = tokenManager.getAuthHeader()
const { id, ...rest } = req
return Taro.uploadFile({
url: fullUrl,
filePath: rest.filePath,
name: 'file',
formData: {
description: rest.description,
tags: rest.tags,
is_public: rest.is_public,
},
header: authHeader,
}).then(res => {
try {
const res = await Taro.uploadFile({
url: fullUrl,
filePath: rest.filePath,
name: 'file',
formData: {
description: rest.description,
tags: rest.tags,
is_public: rest.is_public,
},
header: authHeader,
});
return {
id,
data: JSON.parse(res.data).data,
}
})
} catch (error) {
throw { id, error }
}
}
async batchUpload(req: UploadFilesData[]): Promise<{ id: string, data: uploadFileResponseData }[]> {
return Promise.all(req.map(item => this.upload(item)))
async batchUpload(req: UploadFilesData[]): Promise<{ id: string, data: uploadFileResponseData | null }[]> {
return Promise.all(req.map(async (item) => {
try {
const res = await this.upload(item);
return res;
} catch (error) {
return { id: item.id, data: null }
}
}))
}
// 上传单张图片到OSS
@@ -84,7 +94,7 @@ class UploadApi {
header: authHeader,
});
const result = JSON.parse(response.data);