This commit is contained in:
toom1996
2026-09-13 00:49:42 +08:00
parent 19fb597bb4
commit c85c561a99
19 changed files with 552 additions and 245 deletions

View File

@ -40,7 +40,6 @@ const previewImages = images.slice(0, PREVIEW_LIMIT)
const lockedCount = preview ? Math.max(0, (imageTotal || 0) - previewImages.length) : 0
const homeHref = href(locale, ROUTES.home)
const archiveHref = href(locale, ROUTES.streetSnaps)
// theimpression 标题含字面 \t:地点 \t 场次,列表/详情统一以 " · " 呈现
const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
@ -360,8 +359,6 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
lbOpen: false,
lbIndex: 0,
lbZoomed: false,
touchStartX: 0,
touchStartY: 0,
imageCount: 0,
currentImageName: "",
@ -379,7 +376,6 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
preview: false,
// 已登录后客户端补拉的全量图片(前 PREVIEW_LIMIT 张已由 SSR 服务端渲染)
extraImages: [] as { id: string; url: string; raw: string; name: string }[],
showAll: false,
init() {
this.favType = this.$el.dataset.favType || "snap_image"
@ -415,20 +411,8 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
name: im.name || "",
}))
this.extraImages = mapped
this.showAll = true
// VIP:首屏前 PREVIEW_LIMIT 张为 SSR 普通样式图,已登录 VIP 替换为高清原图(同 Item.astro)。
const me = getUser()
if (me && me.tier === "vip") {
const hd = (full.images || []).slice(0, 5).map((im: any) => toAbs(im.image || ""))
hd.forEach((url: string, i: number) => {
if (!url) return
const fig = document.querySelector<HTMLElement>(`#snap-gallery [data-image-index="${i}"]`)
if (!fig) return
fig.dataset.imageUrl = url
const img = fig.querySelector("img")
if (img) img.setAttribute("src", url)
})
}
// 后端详情接口对所有用户统一返回 high 高清样式(付费墙已取消),首屏图即为高清,
// 无需客户端再按 VIP 替换。仅把第 6 张起的图片追加进 extraImages 渲染。
await this.$nextTick()
this.imageCount = document.querySelectorAll(
"#snap-gallery [data-image-index]"