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

This commit is contained in:
toom1996
2026-08-30 10:28:22 +08:00
parent e24bfe164d
commit dd66e5b693
3 changed files with 26 additions and 19 deletions

View File

@ -275,11 +275,12 @@ const seasonOptions: { value: string; label: string }[] = [
locale: '',
hotBrands,
SPIN_SVG,
// 侧栏分组折叠状态:默认全部收起(不做 localStorage 持久化,每次进页都是关着的)。
collapsedGroups: {
designers: localStorage.getItem("showsg-designers") === "1",
collection: localStorage.getItem("showsg-collection") === "1",
season: localStorage.getItem("showsg-season") === "1",
year: localStorage.getItem("showsg-year") === "1",
designers: true,
collection: true,
season: true,
year: true,
},
selectedBrand: null as (string | null),
selectedCt: "" as string,
@ -342,10 +343,9 @@ const seasonOptions: { value: string; label: string }[] = [
return list
},
// 点击抽屉开关
// 点击抽屉开关:仅切换内存状态,刷新后回到默认(全部收起)
toggleGroup(group: "designers" | "collection" | "season" | "year") {
this.collapsedGroups[group] = !this.collapsedGroups[group]
localStorage.setItem(`showsg-${group}`, this.collapsedGroups[group] ? "1" : "")
},
refreshFilter() {
@ -491,9 +491,16 @@ const seasonOptions: { value: string; label: string }[] = [
// 渲染文章url
itemHref(it: { id: string | number }) { return clientHref(this.locale, ROUTES.item(it.id)) },
// 渲染thumb图片列表(复用共享工具:固定 5 槽位 + 末位 moreLabel 兜底)
// 渲染 thumb 图片列表(复用共享工具):固定 5 个槽位 + 末位叠加「共 N 张」遮罩。
//
// 注意参数顺序:makeCardSlots(images, count, opts) —— 第二个参数是「槽位数量」不是图片总数。
// 曾误把 it.image_count(如 31)传成 count,导致每张卡片生成 31 个槽位(大量灰色占位块)。
// 图片总数只用于末位遮罩文案,通过 moreLabel 回调传入。
getCardSlots(it: ArticleItem) {
return makeCardSlots(it.gallery || [], it.image_count || 0)
const total = it.image_count || 0
return makeCardSlots(it.gallery || [], 5, {
moreLabel: () => (total > 30 ? "30+" : `${total}+`),
})
}
}
})

View File

@ -196,8 +196,8 @@ const sortOptions: { value: string; label: string }[] = [
selectedYear: '' as string,
selectedSort: DEFAULT_SORT as string,
// 侧栏分组折叠状态
collapsedGroups: { year: false, sort: false } as Record<string, boolean>,
// 侧栏分组折叠状态:默认全部收起(不做持久化,每次进页都是关着的)
collapsedGroups: { year: true, sort: true } as Record<string, boolean>,
items: [] as (StreetSnapItem & { _imgLoaded?: boolean })[],
loading: false,