revert(listings): 首页卡片恢复使用原生 img 与公开缩略图链路 (16KB秒开)
This commit is contained in:
@@ -411,28 +411,8 @@ 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 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] || ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user