主要更新: 1. 按H5网页端完全重构匹配功能(match页面) - 4种匹配类型: 创业合伙/资源对接/导师顾问/团队招募 - 资源对接等类型弹出手机号/微信号输入框 - 去掉重新匹配按钮,改为返回按钮 2. 修复所有卡片对齐和宽度问题 - 目录页附录卡片居中 - 首页阅读进度卡片满宽度 - 我的页面菜单卡片对齐 - 推广中心分享卡片统一宽度 3. 修复目录页图标和文字对齐 - section-icon固定40rpx宽高 - section-title与图标垂直居中 4. 更新真实完整文章标题(62篇) - 从book目录读取真实markdown文件名 - 替换之前的简化标题 5. 新增文章数据API - /api/db/chapters - 获取完整书籍结构 - 支持按ID获取单篇文章内容
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { notFound } from "next/navigation"
|
|
import { ChapterContent } from "@/components/chapter-content"
|
|
import { getSectionBySlug, getChapterBySectionSlug } from "@/lib/book-file-system"
|
|
import { specialSections, getSectionById } from "@/lib/book-data"
|
|
|
|
interface ReadPageProps {
|
|
params: Promise<{ id: string }>
|
|
}
|
|
|
|
export const dynamic = "force-dynamic"
|
|
export const runtime = "nodejs"
|
|
|
|
export default async function ReadPage({ params }: ReadPageProps) {
|
|
const { id } = await params
|
|
|
|
if (id === "preface") {
|
|
return <ChapterContent section={specialSections.preface as any} partTitle="序言" chapterTitle="" />
|
|
}
|
|
|
|
if (id === "epilogue") {
|
|
return <ChapterContent section={specialSections.epilogue as any} partTitle="尾声" chapterTitle="" />
|
|
}
|
|
|
|
if (id.startsWith("appendix-")) {
|
|
const appendixSection = specialSections.appendix.find((a) => a.id === id)
|
|
if (appendixSection) {
|
|
return <ChapterContent section={appendixSection as any} partTitle="附录" chapterTitle="" />
|
|
}
|
|
}
|
|
|
|
try {
|
|
// 先从文件系统获取
|
|
const section = getSectionBySlug(id)
|
|
if (section) {
|
|
const context = getChapterBySectionSlug(id)
|
|
if (context) {
|
|
return <ChapterContent section={section} partTitle={context.part.title} chapterTitle={context.chapter.title} />
|
|
}
|
|
}
|
|
|
|
// 再从book-data获取
|
|
const bookSection = getSectionById(id)
|
|
if (bookSection) {
|
|
return <ChapterContent section={bookSection as any} partTitle="" chapterTitle="" />
|
|
}
|
|
|
|
notFound()
|
|
} catch (error) {
|
|
console.error("[Karuo] Error in ReadPage:", error)
|
|
notFound()
|
|
}
|
|
}
|