fix miss photo for product

This commit is contained in:
Timi
2026-10-30 00:47:08 +08:00
parent d656725334
commit eb6b781d7b
+4 -6
View File
@@ -47,7 +47,7 @@
v-model:items="attachmentItemList"
title="产品公共图片及附件"
:busy="isAttachmentUploading"
@select="handleAttachmentSelected($event.files, $event.source)"
@select="handleAttachmentSelected($event.files)"
/>
</t-form-item>
<t-form-item label="纯色封面" label-width="8rem" content-align="right">
@@ -227,8 +227,7 @@ import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelect
import ProductSkuEditor from "@/pages/product/component/ProductSkuEditor.vue";
import ProductSkuUnitEditor from "@/pages/product/component/ProductSkuUnitEditor.vue";
import ProductSkuUnitBatchEditor from "@/pages/product/component/ProductSkuUnitBatchEditor.vue";
import type { AttachmentSelectorSelection } from "@/components/attachmentSelector/types";
import type { Product, ProductAttachmentType, ProductCategory, ProductSku, ProductSkuUnit, ProductSpec, ProductType } from "@/types/Product";
import type { Product, ProductCategory, ProductSku, ProductSkuUnit, ProductSpec, ProductType } from "@/types/Product";
import type { ProductAttachmentItem, ProductForm, ProductSkuForm as SkuForm, ProductSkuUnitForm as UnitForm, ProductSpecForm as SpecForm, ProductSpecValueForm as SpecValueForm } from "@/types/ProductEditor";
import { compressUploadImageList } from "@/utils/imageCompression";
import { getAttachmentReadURL } from "@/utils/attachment";
@@ -642,11 +641,10 @@ async function confirmCoverColorPicker(): Promise<void> {
}
}
async function handleAttachmentSelected(files: File[], source: AttachmentSelectorSelection["source"]): Promise<void> {
async function handleAttachmentSelected(files: File[]): Promise<void> {
if (!files.length) {
return;
}
const attachType: ProductAttachmentType = source === "photo" ? "PHOTO" : "OTHER";
isAttachmentUploading.value = true;
try {
const compressedFiles = await compressUploadImageList(files);
@@ -656,7 +654,7 @@ async function handleAttachmentSelected(files: File[], source: AttachmentSelecto
continue;
}
attachmentItemList.value.push({
attachType,
attachType: files[index]?.type.startsWith("image/") ? "PHOTO" : "OTHER",
mimeType: files[index]?.type,
tempFileId: tempFile.id,
url: AttachmentAPI.getTempReadURL(tempFile.id)