feat: 完整重构小程序匹配功能 + 修复UI对齐 + 文章数据API
主要更新: 1. 按H5网页端完全重构匹配功能(match页面) - 4种匹配类型: 创业合伙/资源对接/导师顾问/团队招募 - 资源对接等类型弹出手机号/微信号输入框 - 去掉重新匹配按钮,改为返回按钮 2. 修复所有卡片对齐和宽度问题 - 目录页附录卡片居中 - 首页阅读进度卡片满宽度 - 我的页面菜单卡片对齐 - 推广中心分享卡片统一宽度 3. 修复目录页图标和文字对齐 - section-icon固定40rpx宽高 - section-title与图标垂直居中 4. 更新真实完整文章标题(62篇) - 从book目录读取真实markdown文件名 - 替换之前的简化标题 5. 新增文章数据API - /api/db/chapters - 获取完整书籍结构 - 支持按ID获取单篇文章内容
This commit is contained in:
@@ -25,11 +25,29 @@ export interface Part {
|
||||
|
||||
export const BASE_BOOK_PRICE = 9.9
|
||||
export const SECTION_PRICE = 1
|
||||
export const PREMIUM_SECTION_PRICE = 1 // 最新版每小节额外价格
|
||||
|
||||
// 基础版价格(固定9.9)
|
||||
export function getFullBookPrice(): number {
|
||||
return 9.9
|
||||
}
|
||||
|
||||
// 最新完整版价格(基础9.9 + 新增小节数 * 1元)
|
||||
// 假设基础版包含前50个小节,之后每增加一个小节+1元
|
||||
export const BASE_SECTIONS_COUNT = 50
|
||||
|
||||
export function getPremiumBookPrice(): number {
|
||||
const totalSections = getTotalSectionCount()
|
||||
const extraSections = Math.max(0, totalSections - BASE_SECTIONS_COUNT)
|
||||
return BASE_BOOK_PRICE + extraSections * PREMIUM_SECTION_PRICE
|
||||
}
|
||||
|
||||
// 获取新增小节数量
|
||||
export function getExtraSectionsCount(): number {
|
||||
const totalSections = getTotalSectionCount()
|
||||
return Math.max(0, totalSections - BASE_SECTIONS_COUNT)
|
||||
}
|
||||
|
||||
export const bookData: Part[] = [
|
||||
{
|
||||
id: "part-1",
|
||||
@@ -670,4 +688,24 @@ export function getChapterBySection(sectionId: string): { part: Part; chapter: C
|
||||
return undefined
|
||||
}
|
||||
|
||||
// 获取下一篇文章
|
||||
export function getNextSection(currentId: string): Section | undefined {
|
||||
const allSections = getAllSections()
|
||||
const currentIndex = allSections.findIndex((s) => s.id === currentId)
|
||||
if (currentIndex === -1 || currentIndex >= allSections.length - 1) {
|
||||
return undefined
|
||||
}
|
||||
return allSections[currentIndex + 1]
|
||||
}
|
||||
|
||||
// 获取上一篇文章
|
||||
export function getPrevSection(currentId: string): Section | undefined {
|
||||
const allSections = getAllSections()
|
||||
const currentIndex = allSections.findIndex((s) => s.id === currentId)
|
||||
if (currentIndex <= 0) {
|
||||
return undefined
|
||||
}
|
||||
return allSections[currentIndex - 1]
|
||||
}
|
||||
|
||||
export const FULL_BOOK_PRICE = getFullBookPrice()
|
||||
|
||||
Reference in New Issue
Block a user