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:
@@ -2,17 +2,21 @@
|
||||
|
||||
import { useState } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { ChevronRight, Lock, Unlock, Book, BookOpen, Home, List, Sparkles, User } from "lucide-react"
|
||||
import { ChevronRight, Lock, Unlock, Book, BookOpen, Home, List, Sparkles, User, Users, Zap, Crown } from "lucide-react"
|
||||
import { useStore } from "@/lib/store"
|
||||
import { bookData, getTotalSectionCount, specialSections } from "@/lib/book-data"
|
||||
import { bookData, getTotalSectionCount, specialSections, getPremiumBookPrice, getExtraSectionsCount, BASE_SECTIONS_COUNT } from "@/lib/book-data"
|
||||
|
||||
export default function ChaptersPage() {
|
||||
const router = useRouter()
|
||||
const { user, hasPurchased } = useStore()
|
||||
const [expandedPart, setExpandedPart] = useState<string | null>("part-1")
|
||||
const [bookVersion, setBookVersion] = useState<"basic" | "premium">("basic")
|
||||
const [showPremiumTab, setShowPremiumTab] = useState(false) // 控制是否显示最新完整版标签
|
||||
|
||||
const totalSections = getTotalSectionCount()
|
||||
const hasFullBook = user?.hasFullBook || false
|
||||
const premiumPrice = getPremiumBookPrice()
|
||||
const extraSections = getExtraSectionsCount()
|
||||
|
||||
const handleSectionClick = (sectionId: string) => {
|
||||
router.push(`/read/${sectionId}`)
|
||||
@@ -41,6 +45,33 @@ export default function ChaptersPage() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 版本标签切换 - 仅在showPremiumTab为true时显示 */}
|
||||
{showPremiumTab && extraSections > 0 && (
|
||||
<div className="mx-4 mt-3 flex gap-2">
|
||||
<button
|
||||
onClick={() => setBookVersion("basic")}
|
||||
className={`flex-1 py-2.5 rounded-xl text-sm font-medium transition-all ${
|
||||
bookVersion === "basic"
|
||||
? "bg-[#00CED1]/20 text-[#00CED1] border border-[#00CED1]/30"
|
||||
: "bg-[#1c1c1e] text-white/60 border border-white/5"
|
||||
}`}
|
||||
>
|
||||
基础版 ¥9.9
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setBookVersion("premium")}
|
||||
className={`flex-1 py-2.5 rounded-xl text-sm font-medium transition-all flex items-center justify-center gap-1 ${
|
||||
bookVersion === "premium"
|
||||
? "bg-[#FFD700]/20 text-[#FFD700] border border-[#FFD700]/30"
|
||||
: "bg-[#1c1c1e] text-white/60 border border-white/5"
|
||||
}`}
|
||||
>
|
||||
<Crown className="w-4 h-4" />
|
||||
最新版 ¥{premiumPrice.toFixed(1)}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 目录内容 */}
|
||||
<main className="px-4 py-4">
|
||||
@@ -177,12 +208,12 @@ export default function ChaptersPage() {
|
||||
<List className="w-5 h-5 text-[#00CED1] mb-1" />
|
||||
<span className="text-[#00CED1] text-xs font-medium">目录</span>
|
||||
</button>
|
||||
{/* 匹配按钮 - 更大更突出 */}
|
||||
{/* 找伙伴按钮 */}
|
||||
<button onClick={() => router.push("/match")} className="flex flex-col items-center py-2 px-6 -mt-4">
|
||||
<div className="w-14 h-14 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center shadow-lg shadow-[#00CED1]/30">
|
||||
<Sparkles className="w-6 h-6 text-white" />
|
||||
<Users className="w-7 h-7 text-white" />
|
||||
</div>
|
||||
<span className="text-gray-500 text-xs mt-1">匹配</span>
|
||||
<span className="text-gray-500 text-xs mt-1">找伙伴</span>
|
||||
</button>
|
||||
<button onClick={() => router.push("/my")} className="flex flex-col items-center py-2 px-4">
|
||||
<User className="w-5 h-5 text-gray-500 mb-1" />
|
||||
|
||||
Reference in New Issue
Block a user