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

This commit is contained in:
toom1996
2026-08-31 00:43:39 +08:00
parent 662b12c612
commit 0d13748d7e
10 changed files with 347 additions and 331 deletions

View File

@ -502,6 +502,7 @@ const seasonOptions: { value: string; label: string }[] = [
// 图片总数只用于末位遮罩文案,通过 moreLabel 回调传入。
getCardSlots(it: ArticleItem) {
const total = it.image_count || 0
// 缩略图条带跳过主图(it.cover 即 gallery[0]),从第二张起,避免首张缩略图与主图重复。
return makeCardSlots(it.gallery || [], 5, {
moreLabel: () => (total > 30 ? "30+" : `${total}+`),
})

View File

@ -297,6 +297,7 @@ const cityOptions: { value: string; label: string }[] = [
// 卡片右侧缩略图条带:固定 5 个槽位,缺图留 placeholder
// 街拍 images 是 { image, name }[](与 runway 的 string[] gallery 不同),先抽成纯 URL 数组
getCardSlots(it: StreetSnapItem) {
// 缩略图条带跳过主图(it.cover 即 images[0]),从第二张起,避免首张缩略图与主图重复。
const imgs = (it.images || []).map((im: any) => (im && (im.image || im)) || "")
return makeCardSlots(imgs)
},
@ -341,7 +342,7 @@ const cityOptions: { value: string; label: string }[] = [
nextPage() { this.goPage(this.page + 1) },
toAbsUrl(url: string) { return toAbs(url) },
// 街拍详情统一收口到 /item/[id](与服务端 /item 回落逻辑对应)
// 街拍详情与走秀统一收口 /item/[id],前端按编码前缀 r/s 分流(见后端 hashid.EncodeTyped)
itemHref(it: { id: string | number }) { return clientHref(this.locale, ROUTES.item(it.id)) },
// theimpression 标题含字面 \t:地点 \t 场次,拆成 [location, event]

View File

@ -141,10 +141,10 @@ const headers = {
))}
</ul>
</div>
<div class="flex items-center gap-2" id="auth-slot" data-hi-label={hiLabel} data-logout-label={logoutLabel}>
<!-- <div class="flex items-center gap-2" id="auth-slot" data-hi-label={hiLabel} data-logout-label={logoutLabel}>
<a href={href(locale, ROUTES.login)} class="hover:opacity-60 transition-opacity duration-200">{t('Login')}</a>
<a href={href(locale, ROUTES.register)} class="hover:opacity-60 transition-opacity duration-200">{t('Signup')}</a>
</div>
</div> -->
</div>
</nav>

View File

@ -16,9 +16,13 @@ export const ROUTES = {
runwayLooks: '/runway-looks',
// 街拍
streetSnaps: '/street-snaps',
// 动态路由(工厂函数)。所有详情(走秀 lookbook / 街拍)统一收口到 /item/[id],
// 由 src/pages/{locale}/item/[id].astro 按 article→street 顺序回落渲染。
// 动态路由(工厂函数)。
// 走秀 lookbook 详情统一收口到 /item/[id](src/pages/{locale}/item/[id].astro)。
// 街拍详情独立收口到 /street-snaps/[id](src/pages/{locale}/street-snaps/[id].astro),
// 与 runway 分路由是为了避免 HashID 类型无关导致两类 id 在同一 /item 路由里撞车
//(runway 与 street_snap 共用一套自增数字 id + 同一盐值,编码串不可区分类型)。
item: (id: string | number) => `/item/${id}`,
// 街拍详情与走秀详情统一收口到 /item/[id],由前端按编码前缀(r=runway/s=snap)分流。
streetSnap: (id: string | number) => `/item/${id}`,
} as const;

View File

@ -4,19 +4,29 @@ import Item from "@/components/Item.astro"
import StreetSnap from "@/components/StreetSnap.astro"
import { getSsrArticle, getSsrStreetSnap } from "@/lib/api"
// 按需 SSR:走秀详情与街拍详情统一收口到 /item/[id]。
// 先按 article 取数(runway lookbook);取不到再回落 street snap,实现「所有详情进 /item」。
// 按需 SSR:走秀(runway)与街拍(street snap)详情统一收口到 /item/[id]。
// 对外 id 带类型前缀(r=runway / s=snap,见后端 hashid.EncodeTyped),据此直接查对应表,无歧义、无需回落。
export const prerender = false
const { id } = Astro.params
const { article, error: articleErr } = await getSsrArticle(id, Astro.currentLocale)
const isSnap = !!id && id[0] === "s"
let article = null
let articleErr = null
let snap = null
let snapErr: "missing" | "failed" | null = null
if (!article) {
const res = await getSsrStreetSnap(id, Astro.currentLocale)
snap = res.snap
snapErr = res.error
let snapErr = null
// await 必须位于 frontmatter 顶层(Astro 不支持块内顶层 await)
const data = isSnap
? await getSsrStreetSnap(id, Astro.currentLocale)
: await getSsrArticle(id, Astro.currentLocale)
if (isSnap) {
snap = data.snap
snapErr = data.error
} else {
article = data.article
articleErr = data.error
}
---

View File

@ -4,19 +4,29 @@ import Item from "@/components/Item.astro"
import StreetSnap from "@/components/StreetSnap.astro"
import { getSsrArticle, getSsrStreetSnap } from "@/lib/api"
// 按需 SSR:走秀详情与街拍详情统一收口到 /item/[id]。
// 先按 article 取数(runway lookbook);取不到再回落 street snap,实现「所有详情进 /item」。
// 按需 SSR:走秀(runway)与街拍(street snap)详情统一收口到 /item/[id]。
// 对外 id 带类型前缀(r=runway / s=snap,见后端 hashid.EncodeTyped),据此直接查对应表,无歧义、无需回落。
export const prerender = false
const { id } = Astro.params
const { article, error: articleErr } = await getSsrArticle(id, Astro.currentLocale)
const isSnap = !!id && id[0] === "s"
let article = null
let articleErr = null
let snap = null
let snapErr: "missing" | "failed" | null = null
if (!article) {
const res = await getSsrStreetSnap(id, Astro.currentLocale)
snap = res.snap
snapErr = res.error
let snapErr = null
// await 必须位于 frontmatter 顶层(Astro 不支持块内顶层 await)
const data = isSnap
? await getSsrStreetSnap(id, Astro.currentLocale)
: await getSsrArticle(id, Astro.currentLocale)
if (isSnap) {
snap = data.snap
snapErr = data.error
} else {
article = data.article
articleErr = data.error
}
---