perf(listings): 优化详情页图片加载链路支持公开变体与分级秒开

This commit is contained in:
yml2213
2026-09-06 21:40:35 +08:00
parent 823632b608
commit 23883d4be5
7 changed files with 168 additions and 11 deletions
@@ -416,3 +416,39 @@ export function isTopTierInsurance(value: string | undefined | null): boolean {
export function getCoinScreenshotURL(item: Listing): string {
return item.cover_url || item.screenshot_urls?.[0] || ''
}
/**
* 转换截图为缩略图 URL(优先使用 16KB 极速缩略图,秒级加载)
*/
export function getScreenshotThumbURL(url: string | undefined | null): string {
if (!url) return ''
if (url.includes('/screenshots/')) {
const separator = url.includes('?') ? '&' : '?'
return `${url}${separator}variant=thumb`
}
return url
}
/**
* 转换截图为中等图 URL(1280px,100KB左右,清晰秒开)
*/
export function getScreenshotMediumURL(url: string | undefined | null): string {
if (!url) return ''
if (url.includes('/screenshots/')) {
const separator = url.includes('?') ? '&' : '?'
return `${url}${separator}variant=medium`
}
return url
}
/**
* 转换截图为原始高清原图 URL(用于全屏放大查看细节)
*/
export function getScreenshotRawURL(url: string | undefined | null): string {
if (!url) return ''
if (url.includes('/screenshots/')) {
const separator = url.includes('?') ? '&' : '?'
return `${url}${separator}variant=raw`
}
return url
}