perf(image): 图片列表默认加载缩略图

This commit is contained in:
yml
2026-11-24 22:30:37 +08:00
parent 3cc61615f9
commit 43df96a973
22 changed files with 227 additions and 85 deletions
+6 -20
View File
@@ -1,4 +1,5 @@
import type { Listing, PublicListingItem } from '@/features/listings/api/listings'
import { getFileVariantURL } from '@/shared/utils/fileURLs'
import { centToYuan } from '@/shared/utils/money'
export interface ListingDisplayChip {
@@ -436,37 +437,22 @@ export function getCoinScreenshotURL(item: Listing): string {
}
/**
* 转换截图为缩略图 URL(优先使用 16KB 极速缩略图,秒级加载)
* 转换截图为缩略图 URL(优先使用上传时生成的缩略图,秒级加载)
*/
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
return getFileVariantURL(url, 'thumb')
}
/**
* 转换截图为中等图 URL(1280px,100KB左右,清晰秒开)
* 转换截图为中等图 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
return getFileVariantURL(url, 'medium')
}
/**
* 转换截图为原始高清原图 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
return getFileVariantURL(url, 'raw')
}