Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -539,6 +539,25 @@ function resolveProductImageUrl(item) {
|
||||
return { contentUrl, publicUrl }
|
||||
}
|
||||
|
||||
async function resolveProductImageUrlForCarousel(item) {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||
if (contentUrl) {
|
||||
try {
|
||||
const blobRes = await api.get(contentUrl, { baseURL: '', responseType: 'blob' })
|
||||
const blob = blobRes?.data
|
||||
if (blob instanceof Blob) {
|
||||
const objectUrl = URL.createObjectURL(blob)
|
||||
productImageBlobUrls.value.push(objectUrl)
|
||||
return objectUrl
|
||||
}
|
||||
} catch {
|
||||
// fall through to public url
|
||||
}
|
||||
}
|
||||
return String(resolved.publicUrl || contentUrl || '').trim()
|
||||
}
|
||||
|
||||
function getProductImageUrl(code, color, secondColor = '') {
|
||||
const key = buildImageKey(code, color, secondColor)
|
||||
const existing = productImageCache.value[key]
|
||||
@@ -1073,12 +1092,10 @@ async function openProductCard(grp1, grp2) {
|
||||
}
|
||||
}
|
||||
|
||||
const images = list
|
||||
.map((item) => {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
return resolved.publicUrl || resolved.contentUrl || ''
|
||||
})
|
||||
.filter((x) => String(x || '').trim() !== '')
|
||||
const imageCandidates = await Promise.all(
|
||||
list.map((item) => resolveProductImageUrlForCarousel(item))
|
||||
)
|
||||
const images = imageCandidates.filter((x) => String(x || '').trim() !== '')
|
||||
const uniqueImages = Array.from(new Set(images))
|
||||
|
||||
if (!uniqueImages.length) {
|
||||
|
||||
@@ -526,6 +526,25 @@ function resolveProductImageUrl(item) {
|
||||
return { contentUrl, publicUrl }
|
||||
}
|
||||
|
||||
async function resolveProductImageUrlForCarousel(item) {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||
if (contentUrl) {
|
||||
try {
|
||||
const blobRes = await api.get(contentUrl, { baseURL: '', responseType: 'blob' })
|
||||
const blob = blobRes?.data
|
||||
if (blob instanceof Blob) {
|
||||
const objectUrl = URL.createObjectURL(blob)
|
||||
productImageBlobUrls.value.push(objectUrl)
|
||||
return objectUrl
|
||||
}
|
||||
} catch {
|
||||
// fall through to public url
|
||||
}
|
||||
}
|
||||
return String(resolved.publicUrl || contentUrl || '').trim()
|
||||
}
|
||||
|
||||
function getProductImageUrl(code, color, secondColor = '') {
|
||||
const key = buildImageKey(code, color, secondColor)
|
||||
const existing = productImageCache.value[key]
|
||||
@@ -945,12 +964,10 @@ async function openProductCard(grp1, grp2) {
|
||||
}
|
||||
}
|
||||
|
||||
const images = list
|
||||
.map((item) => {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
return resolved.publicUrl || resolved.contentUrl || ''
|
||||
})
|
||||
.filter((x) => String(x || '').trim() !== '')
|
||||
const imageCandidates = await Promise.all(
|
||||
list.map((item) => resolveProductImageUrlForCarousel(item))
|
||||
)
|
||||
const images = imageCandidates.filter((x) => String(x || '').trim() !== '')
|
||||
const uniqueImages = Array.from(new Set(images))
|
||||
|
||||
if (!uniqueImages.length) {
|
||||
|
||||
Reference in New Issue
Block a user