fix(listings): 首页卡片统一接入 AuthImage 解决私有对象存储鉴权加载失败问题

This commit is contained in:
yml2213
2026-09-06 20:22:47 +08:00
parent 87aa0b0a2b
commit ac909d6757
6 changed files with 73 additions and 16 deletions
+16 -4
View File
@@ -416,10 +416,22 @@ export function isTopTierInsurance(value: string | undefined | null): boolean {
export function getCoinScreenshotURL(item: Listing): string {
const groups = item.asset_summary?.screenshot_groups
if (typeof groups === 'object' && groups !== null) {
const coinUrls = (groups as Record<string, unknown>)['coin']
if (Array.isArray(coinUrls)) {
const firstCoin = coinUrls.find(url => typeof url === 'string' && Boolean(url))
if (firstCoin) return firstCoin
const groupRecord = groups as Record<string, unknown>
const orderedKeys = ['coin', 'tencentSecurity', 'skin', 'gameId', 'totalAsset']
for (const key of orderedKeys) {
const urls = groupRecord[key]
if (Array.isArray(urls)) {
const found = urls.find(url => typeof url === 'string' && Boolean(url))
if (found) return found
}
}
for (const key of Object.keys(groupRecord)) {
if (orderedKeys.includes(key)) continue
const urls = groupRecord[key]
if (Array.isArray(urls)) {
const found = urls.find(url => typeof url === 'string' && Boolean(url))
if (found) return found
}
}
}
return item.cover_url || item.screenshot_urls?.[0] || ''