debug1
All checks were successful
Deploy to Server / deploy (push) Successful in 31s

This commit is contained in:
jeremygan2021
2026-03-22 23:58:48 +08:00
parent 9608b6c4a5
commit 0ba05cb687

View File

@@ -248,14 +248,32 @@ const ProjectSubmission = ({ competitionId, initialValues, onCancel, onSuccess }
uploadProjectFile(formData)
.then(res => {
const imageUrl = res.data.file_url_display || res.data.file_url;
updateProject(projectId, { cover_image_url: imageUrl })
const currentValues = form.getFieldsValue();
const updateData = {
...currentValues,
cover_image_url: imageUrl,
};
if (updateData.cover_image_url && updateData.cover_image_url.startsWith('data:')) {
delete updateData.cover_image_url;
}
console.log('Updating project with:', updateData);
updateProject(projectId, updateData)
.then(() => {
form.setFieldsValue({ cover_image_url: imageUrl });
message.success('封面上传成功');
})
.catch(err => {
console.error('更新封面失败:', err);
message.error(`更新封面失败: ${err.response?.data?.detail || err.message}`);
const errorData = err.response?.data;
let errorMsg = '更新失败';
if (errorData) {
if (typeof errorData === 'object') {
errorMsg = Object.entries(errorData).map(([k, v]) => `${k}: ${Array.isArray(v) ? v.join(', ') : v}`).join('; ');
} else {
errorMsg = String(errorData);
}
}
message.error(`更新封面失败: ${errorMsg}`);
});
})
.catch(err => {