重构小程序图标组件,替换传统 emoji 为 SVG 图标,提升视觉一致性和可维护性。更新多个页面以使用新图标组件,优化用户界面体验。同时,调整了数据加载逻辑,确保更高效的状态管理和用户交互。

This commit is contained in:
Alex-larget
2026-03-18 16:00:57 +08:00
parent 46f94a9c81
commit c55e54efbd
62 changed files with 2033 additions and 1270 deletions

View File

@@ -1,4 +1,4 @@
/**
/**
* 章节树 - 仿照 catalog 设计,支持篇、章、节拖拽排序
* 整行可拖拽;节和章可跨篇
*/
@@ -347,8 +347,8 @@ export function ChapterTree({
)
}
// 2026每日派对干货独立篇章带六点拖拽、可拖可放
const is2026Daily = part.title === '2026每日派对干货' || part.title.includes('2026每日派对干货')
// 2026每日派对干货独立篇章带六点拖拽、可拖可放(以 part_id 识别,标题来自 DB
const is2026Daily = part.id === 'part-2026-daily'
if (is2026Daily) {
const partDragOver = isDragOver('part', part.id)
return (

View File

@@ -158,32 +158,21 @@ function buildTree(sections: SectionListItem[]): Part[] {
hotRank: s.hotRank ?? 0,
})
}
// 确保「2026每日派对干货」篇章存在不在第六篇编号体系内
const DAILY_PART_ID = 'part-2026-daily'
const DAILY_PART_TITLE = '2026每日派对干货'
const hasDailyPart = Array.from(partMap.values()).some((p) => p.title === DAILY_PART_TITLE || p.title.includes(DAILY_PART_TITLE))
if (!hasDailyPart) {
partMap.set(DAILY_PART_ID, {
id: DAILY_PART_ID,
title: DAILY_PART_TITLE,
chapters: new Map([['chapter-2026-daily', { id: 'chapter-2026-daily', title: DAILY_PART_TITLE, sections: [] }]]),
})
}
const parts = Array.from(partMap.values()).map((p) => ({
...p,
chapters: Array.from(p.chapters.values()),
}))
// 固定顺序:序言首位,2026每日派对干货(附录前),附录/尾声末位
const orderKey = (t: string) => {
if (t.includes('序言')) return 0
if (t.includes(DAILY_PART_TITLE)) return 1.5
if (t.includes('附录')) return 2
if (t.includes('尾声')) return 3
// 固定顺序:序言首位,part-2026-daily(附录前),附录/尾声末位;标题均来自 DB
const orderKey = (p: { id: string; title: string }) => {
if (p.title.includes('序言')) return 0
if (p.id === 'part-2026-daily') return 1.5
if (p.title.includes('附录')) return 2
if (p.title.includes('尾声')) return 3
return 1
}
return parts.sort((a, b) => {
const ka = orderKey(a.title)
const kb = orderKey(b.title)
const ka = orderKey(a)
const kb = orderKey(b)
if (ka !== kb) return ka - kb
return 0
})