update
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
toom1996
2026-09-06 00:50:52 +08:00
parent 36f3ad039f
commit 19fb597bb4
20 changed files with 497 additions and 548 deletions

View File

@ -93,6 +93,7 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
{/* 单图收藏:hover 显示,已收藏常驻实心 */}
<button
login-required
type="button"
data-fav-id={im.id}
data-fav-url={im.raw}
@ -121,7 +122,7 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
<figure
x-show="!isAuthed && preview"
x-cloak
@click="goLogin()"
login-redirect
class="relative bg-[#f2f2f2] cursor-pointer group overflow-hidden"
>
{/* 与真实图片等高的 3:4 图位:锁图标 + 提示,点击跳登录 */}
@ -160,6 +161,7 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
class="w-full aspect-[3/4] object-cover group-hover:opacity-90 transition-opacity"
/>
<button
login-required
type="button"
:data-fav-id="im.id"
:data-fav-url="im.raw"
@ -215,6 +217,7 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
></div>
<button
login-required
type="button"
@click.stop="toggleFav(currentFavId, currentFavUrl)"
:class="isFav(currentFavId) ? 'is-fav' : ''"
@ -413,6 +416,19 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
}))
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)
})
}
await this.$nextTick()
this.imageCount = document.querySelectorAll(
"#snap-gallery [data-image-index]"
@ -425,13 +441,6 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
}
},
// 未登录门禁:跳登录并回跳本篇详情
goLogin() {
const back = window.location.pathname + window.location.search
const loc = window.location.pathname.startsWith("/cn") ? "cn" : "en"
window.location.href = `/${loc}/login?redirect=${encodeURIComponent(back)}`
},
// ?img=<图片uid> 深链:个人中心点单图收藏 → 打开所属图集并滚动定位到该图。
// 默认只定位 + 短暂高亮,不弹灯箱(不打断浏览);显式带 &lb=1 才自动开灯箱。
maybeLocateImageFromUrl() {
@ -501,13 +510,6 @@ const displayTitle = (snap?.title || "").replace(/\t/g, " · ")
toggleFav(id: string, url: string) {
if (!id) return
// 未登录:收藏无处落盘(服务端无 token、本地无用户 key),引导登录后回跳本篇
if (!getUser()) {
const back = window.location.pathname + window.location.search
const loc = window.location.pathname.startsWith("/cn") ? "cn" : "en"
window.location.href = `/${loc}/login?redirect=${encodeURIComponent(back)}`
return
}
toggleImageFavorite({
imageId: id,
type: this.favType === "snap_image" ? "snap_image" : "runway_image",