bugfix: 没有产品主图时自动选中问题

This commit is contained in:
2026-05-07 17:06:06 +08:00
parent b2c6c61515
commit e093cccb8d
2 changed files with 3 additions and 9 deletions

View File

@@ -313,10 +313,6 @@
if (videoItem) listing.prodImageList.push(videoItem)
})
if (!listing.mainProductImage) {
listing.mainProductImage =
listing.prodImageList.find((item) => item.selected && !item.isVideo)?.url || ""
}
if (coverFromImageUrl) {
listing.coverFrom = resolveCoverSourceFromImageUrl(coverFromImageUrl, listing)
}
@@ -324,11 +320,7 @@
const mainProductIndex = listing.prodImageList.findIndex(
(item) => !item.isVideo && item.url === listing.mainProductImage
)
const selectedIndex =
mainProductIndex === -1
? listing.prodImageList.findIndex((item) => item.selected && !item.isVideo)
: mainProductIndex
listing.firstSelectedIndex = selectedIndex === -1 ? null : selectedIndex
listing.firstSelectedIndex = mainProductIndex === -1 ? null : mainProductIndex
listing.productImage = listing.prodImageList.map((item) => item.url)
listing.apparelSketch = listing.sketchList