2026-05-06 17:22:50 +08:00
|
|
|
import { prisma } from "@//app/lib/prisma"
|
|
|
|
|
import { notFound } from "next/navigation"
|
|
|
|
|
import Link from "next/link"
|
|
|
|
|
|
2026-05-12 00:29:37 +08:00
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
|
|
2026-05-06 17:22:50 +08:00
|
|
|
export default async function NewsDetailPage({
|
|
|
|
|
params,
|
|
|
|
|
}: {
|
|
|
|
|
params: Promise<{ id: string }>
|
|
|
|
|
}) {
|
|
|
|
|
const { id } = await params
|
|
|
|
|
const news = await prisma.news.findUnique({
|
|
|
|
|
where: { id: parseInt(id) },
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (!news || !news.published) {
|
|
|
|
|
notFound()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen bg-gray-50">
|
|
|
|
|
<nav className="bg-white border-b border-gray-200">
|
|
|
|
|
<div className="max-w-6xl mx-auto px-6 py-3">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<Link href="/" className="flex items-center gap-2">
|
|
|
|
|
<div className="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
|
|
|
|
|
<span className="text-white font-bold text-sm">AI</span>
|
|
|
|
|
</div>
|
|
|
|
|
<span className="font-bold text-gray-900">冲浪智能体广场</span>
|
|
|
|
|
</Link>
|
|
|
|
|
<div className="flex items-center gap-6">
|
|
|
|
|
<Link href="/" className="text-gray-600 hover:text-blue-600 transition">首页</Link>
|
|
|
|
|
<Link href="/agents" className="text-gray-600 hover:text-blue-600 transition">智能体广场</Link>
|
|
|
|
|
<Link href="/news" className="text-blue-600 font-medium">新闻动态</Link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<main className="max-w-4xl mx-auto px-6 py-12">
|
|
|
|
|
<Link href="/news" className="inline-flex items-center gap-2 text-sm text-gray-500 hover:text-blue-600 mb-8">
|
|
|
|
|
← 返回新闻列表
|
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
|
|
<article className="bg-white rounded-2xl p-8 border border-gray-200">
|
|
|
|
|
<div className="flex items-center gap-2 mb-4">
|
|
|
|
|
<span className="px-2 py-0.5 bg-blue-50 text-blue-600 text-xs font-medium rounded-full">
|
|
|
|
|
{news.type === "news" ? "新闻" : news.type}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="text-xs text-gray-400">
|
|
|
|
|
{new Date(news.createdAt).toLocaleDateString("zh-CN")}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<h1 className="text-3xl font-bold text-gray-900 mb-6">{news.title}</h1>
|
|
|
|
|
|
|
|
|
|
<div className="prose max-w-none">
|
|
|
|
|
<p className="text-gray-600 leading-relaxed">{news.content}</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="mt-8 pt-6 border-t border-gray-200">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<span className="text-sm text-gray-500">
|
|
|
|
|
发布于 {new Date(news.createdAt).toLocaleDateString("zh-CN")}
|
|
|
|
|
</span>
|
|
|
|
|
<Link
|
|
|
|
|
href="/news"
|
|
|
|
|
className="text-blue-600 hover:text-blue-700 text-sm"
|
|
|
|
|
>
|
|
|
|
|
查看更多新闻 →
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|