Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -486,14 +486,7 @@ function resolvePhotoDim3(item, secondColorDisplay = '') {
|
||||
}
|
||||
|
||||
function resolvePhotoDim1ID(item) {
|
||||
const candidates = [
|
||||
item?.ItemDim1Code,
|
||||
item?.itemDim1Code,
|
||||
item?.ITEMDIM1CODE,
|
||||
item?.Beden,
|
||||
item?.RenkID,
|
||||
item?.Renk_Id
|
||||
]
|
||||
const candidates = [item?.ItemDim1Code, item?.itemDim1Code, item?.ITEMDIM1CODE, item?.Beden]
|
||||
for (const value of candidates) {
|
||||
const s = String(value || '').trim()
|
||||
if (/^\d+$/.test(s)) return s
|
||||
@@ -502,12 +495,7 @@ function resolvePhotoDim1ID(item) {
|
||||
}
|
||||
|
||||
function resolvePhotoDim3ID(item) {
|
||||
const candidates = [
|
||||
item?.ItemDim3Code,
|
||||
item?.itemDim3Code,
|
||||
item?.ITEMDIM3CODE,
|
||||
item?.Renk2
|
||||
]
|
||||
const candidates = [item?.ItemDim3Code, item?.itemDim3Code, item?.ITEMDIM3CODE, item?.Renk2]
|
||||
for (const value of candidates) {
|
||||
const s = String(value || '').trim()
|
||||
if (/^\d+$/.test(s)) return s
|
||||
@@ -553,7 +541,7 @@ function normalizeUploadsPath(storagePath) {
|
||||
|
||||
function resolveProductImageUrl(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return { contentUrl: '', publicUrl: '' }
|
||||
return { contentUrl: '', publicUrl: '', thumbUrl: '', fullUrl: '' }
|
||||
}
|
||||
|
||||
let contentUrl = ''
|
||||
@@ -577,11 +565,16 @@ function resolveProductImageUrl(item) {
|
||||
}
|
||||
}
|
||||
|
||||
return { contentUrl, publicUrl }
|
||||
const thumbUrl = String(item.thumb_url || item.thumbUrl || '').trim()
|
||||
const fullUrl = String(item.full_url || item.fullUrl || '').trim()
|
||||
|
||||
return { contentUrl, publicUrl, thumbUrl, fullUrl }
|
||||
}
|
||||
|
||||
async function resolveProductImageUrlForCarousel(item) {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
const fullUrl = String(resolved.fullUrl || '').trim()
|
||||
if (fullUrl) return fullUrl
|
||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||
if (contentUrl) {
|
||||
try {
|
||||
@@ -597,7 +590,7 @@ async function resolveProductImageUrlForCarousel(item) {
|
||||
}
|
||||
}
|
||||
const publicUrl = String(resolved.publicUrl || '').trim()
|
||||
return String(publicUrl || contentUrl || '').trim()
|
||||
return String(publicUrl || fullUrl || contentUrl || '').trim()
|
||||
}
|
||||
|
||||
function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') {
|
||||
@@ -670,7 +663,7 @@ async function ensureProductImage(code, color, secondColor = '', dim1Id = '', di
|
||||
|
||||
const resolved = resolveProductImageUrl(first)
|
||||
|
||||
productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
|
||||
productImageCache.value[key] = resolved.thumbUrl || resolved.fullUrl || resolved.contentUrl || resolved.publicUrl || ''
|
||||
productImageFallbackByKey.value[key] = resolved.contentUrl || ''
|
||||
} catch (err) {
|
||||
console.warn('[ProductStockByAttributes] product image fetch failed', { code, color, err })
|
||||
|
||||
@@ -479,14 +479,7 @@ function resolvePhotoDim3(item, secondColorDisplay = '') {
|
||||
}
|
||||
|
||||
function resolvePhotoDim1ID(item) {
|
||||
const candidates = [
|
||||
item?.ItemDim1Code,
|
||||
item?.itemDim1Code,
|
||||
item?.ITEMDIM1CODE,
|
||||
item?.Beden,
|
||||
item?.RenkID,
|
||||
item?.Renk_Id
|
||||
]
|
||||
const candidates = [item?.ItemDim1Code, item?.itemDim1Code, item?.ITEMDIM1CODE, item?.Beden]
|
||||
for (const value of candidates) {
|
||||
const s = String(value || '').trim()
|
||||
if (/^\d+$/.test(s)) return s
|
||||
@@ -495,12 +488,7 @@ function resolvePhotoDim1ID(item) {
|
||||
}
|
||||
|
||||
function resolvePhotoDim3ID(item) {
|
||||
const candidates = [
|
||||
item?.ItemDim3Code,
|
||||
item?.itemDim3Code,
|
||||
item?.ITEMDIM3CODE,
|
||||
item?.Renk2
|
||||
]
|
||||
const candidates = [item?.ItemDim3Code, item?.itemDim3Code, item?.ITEMDIM3CODE, item?.Renk2]
|
||||
for (const value of candidates) {
|
||||
const s = String(value || '').trim()
|
||||
if (/^\d+$/.test(s)) return s
|
||||
@@ -542,7 +530,7 @@ function normalizeUploadsPath(storagePath) {
|
||||
|
||||
function resolveProductImageUrl(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return { contentUrl: '', publicUrl: '' }
|
||||
return { contentUrl: '', publicUrl: '', thumbUrl: '', fullUrl: '' }
|
||||
}
|
||||
|
||||
let contentUrl = ''
|
||||
@@ -564,11 +552,16 @@ function resolveProductImageUrl(item) {
|
||||
if (fileName) publicUrl = `/uploads/image/${fileName}`
|
||||
}
|
||||
|
||||
return { contentUrl, publicUrl }
|
||||
const thumbUrl = String(item.thumb_url || item.thumbUrl || '').trim()
|
||||
const fullUrl = String(item.full_url || item.fullUrl || '').trim()
|
||||
|
||||
return { contentUrl, publicUrl, thumbUrl, fullUrl }
|
||||
}
|
||||
|
||||
async function resolveProductImageUrlForCarousel(item) {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
const fullUrl = String(resolved.fullUrl || '').trim()
|
||||
if (fullUrl) return fullUrl
|
||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||
if (contentUrl) {
|
||||
try {
|
||||
@@ -584,7 +577,7 @@ async function resolveProductImageUrlForCarousel(item) {
|
||||
}
|
||||
}
|
||||
const publicUrl = String(resolved.publicUrl || '').trim()
|
||||
return String(publicUrl || contentUrl || '').trim()
|
||||
return String(publicUrl || fullUrl || contentUrl || '').trim()
|
||||
}
|
||||
|
||||
function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') {
|
||||
@@ -654,7 +647,7 @@ async function ensureProductImage(code, color, secondColor = '', dim1Id = '', di
|
||||
const first = list[0] || null
|
||||
|
||||
const resolved = resolveProductImageUrl(first)
|
||||
productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
|
||||
productImageCache.value[key] = resolved.thumbUrl || resolved.fullUrl || resolved.contentUrl || resolved.publicUrl || ''
|
||||
productImageFallbackByKey.value[key] = resolved.contentUrl || ''
|
||||
} catch (err) {
|
||||
console.warn('[ProductStockQuery] product image fetch failed', { code, color, err })
|
||||
|
||||
Reference in New Issue
Block a user