fix save fail for product photo and sku photo
This commit is contained in:
@@ -662,24 +662,33 @@ async function handleAttachmentSelected(event: Event): Promise<void> {
|
|||||||
|
|
||||||
function buildAttachmentList(): Attachment[] {
|
function buildAttachmentList(): Attachment[] {
|
||||||
return attachmentItemList.value.flatMap(item => {
|
return attachmentItemList.value.flatMap(item => {
|
||||||
|
if (item.tempFileId) {
|
||||||
|
return [{
|
||||||
|
...item.attachment,
|
||||||
|
attachType: item.attachType || item.attachment?.attachType || "PHOTO",
|
||||||
|
tempFileId: item.tempFileId,
|
||||||
|
metadata: item.isSolidColorCover && item.solidColor ? { purpose: SOLID_COLOR_COVER_PURPOSE, color: item.solidColor } : undefined
|
||||||
|
} as Attachment];
|
||||||
|
}
|
||||||
if (item.attachment) {
|
if (item.attachment) {
|
||||||
return [{ ...item.attachment, attachType: item.attachType || item.attachment.attachType || "PHOTO" }];
|
return [{ ...item.attachment, attachType: item.attachType || item.attachment.attachType || "PHOTO" }];
|
||||||
}
|
}
|
||||||
if (item.tempFileId) {
|
|
||||||
return [{ attachType: item.attachType, tempFileId: item.tempFileId, metadata: item.isSolidColorCover && item.solidColor ? { purpose: SOLID_COLOR_COVER_PURPOSE, color: item.solidColor } : undefined }];
|
|
||||||
}
|
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildSkuAttachmentList(photoItemList: PhotoItem[]): Attachment[] {
|
function buildSkuAttachmentList(photoItemList: PhotoItem[]): Attachment[] {
|
||||||
return photoItemList.flatMap(item => {
|
return photoItemList.flatMap(item => {
|
||||||
|
if (item.tempFileId) {
|
||||||
|
return [{
|
||||||
|
...item.attachment,
|
||||||
|
attachType: item.attachType || item.attachment?.attachType || "PHOTO",
|
||||||
|
tempFileId: item.tempFileId
|
||||||
|
} as Attachment];
|
||||||
|
}
|
||||||
if (item.attachment) {
|
if (item.attachment) {
|
||||||
return [{ ...item.attachment, attachType: item.attachType || item.attachment.attachType || "PHOTO" } as Attachment];
|
return [{ ...item.attachment, attachType: item.attachType || item.attachment.attachType || "PHOTO" } as Attachment];
|
||||||
}
|
}
|
||||||
if (item.tempFileId) {
|
|
||||||
return [{ attachType: item.attachType || "PHOTO", tempFileId: item.tempFileId } as Attachment];
|
|
||||||
}
|
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user