Files

287 lines
14 KiB
TypeScript
Raw Permalink Normal View History

import { prisma } from "@/app/lib/prisma"
2026-05-06 17:22:50 +08:00
import Link from "next/link"
import Image from "next/image"
export const dynamic = "force-dynamic"
2026-05-06 17:22:50 +08:00
export default async function HomePage() {
const agents = await prisma.agent.findMany({
where: { isFeatured: true },
2026-05-06 17:22:50 +08:00
include: { category: true },
orderBy: { featuredOrder: "asc" },
2026-05-06 17:22:50 +08:00
take: 6,
})
const news = await prisma.news.findMany({
where: { published: true },
orderBy: { createdAt: "desc" },
take: 3,
})
const categories = await prisma.category.findMany({
include: { _count: { select: { agents: true } } },
2026-05-06 17:22:50 +08:00
})
2026-04-29 19:06:38 +08:00
return (
2026-05-06 17:22:50 +08:00
<div className="min-h-screen bg-gray-50">
{/* 导航栏 */}
<nav className="bg-white border-b border-gray-200 fixed top-0 left-0 right-0 z-50 shadow-sm">
<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-gray-600 hover:text-blue-600 transition"></Link>
<Link href="/ocr" className="text-blue-600 font-medium transition">OCR识别</Link>
2026-05-06 17:22:50 +08:00
<Link
href="/admin/login"
className="bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition"
>
</Link>
</div>
</div>
2026-04-29 19:06:38 +08:00
</div>
2026-05-06 17:22:50 +08:00
</nav>
<main className="pt-16">
{/* Hero 区域 */}
<section className="bg-gradient-to-r from-blue-600 to-blue-700 text-white py-20">
<div className="max-w-6xl mx-auto px-6">
<div className="flex flex-col lg:flex-row items-center gap-8">
<div className="lg:w-1/2 space-y-6">
<h1 className="text-4xl md:text-5xl font-bold">
AI <br />
</h1>
<p className="text-lg text-white/90 leading-relaxed">
广 AI
</p>
<div className="flex flex-wrap gap-4">
<Link
href="/agents"
className="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition"
>
</Link>
<Link
href="#features"
className="border border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white/10 transition"
>
</Link>
</div>
</div>
<div className="lg:w-1/2">
<div className="bg-white p-6 rounded-2xl shadow-2xl">
<div className="flex items-center gap-3 mb-4">
<div className="w-10 h-10 bg-blue-600 rounded-full flex items-center justify-center text-white">
🤖
</div>
<div>
<h3 className="font-semibold text-gray-900"></h3>
<p className="text-xs text-gray-500">24/7 线</p>
</div>
</div>
<div className="space-y-4 mb-4">
<div className="flex gap-3">
<div className="w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center flex-shrink-0">
👤
</div>
<div className="bg-gray-100 rounded-lg p-3 max-w-[80%]">
<p className="text-sm text-gray-800"></p>
</div>
</div>
<div className="flex gap-3 justify-end">
<div className="bg-blue-50 rounded-lg p-3 max-w-[80%]">
<p className="text-sm text-gray-800">24线</p>
</div>
<div className="w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center text-white flex-shrink-0">
🤖
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{/* 热门智能体 */}
<section className="py-16 bg-white">
<div className="max-w-6xl mx-auto px-6">
<div className="text-center mb-10">
<h2 className="text-2xl font-bold text-gray-900 mb-2"></h2>
<p className="text-gray-500"></p>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5">
{agents.map((agent) => (
<Link
key={agent.id}
href={`/agents/${agent.slug}`}
className="bg-white rounded-2xl border border-gray-200 p-5 hover:border-blue-300 shadow-sm hover:shadow-md transition-all duration-300"
>
<div className="flex items-center gap-4 mb-4">
<div className="w-14 h-14 bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl flex items-center justify-center text-3xl flex-shrink-0">
{agent.icon || "🤖"}
</div>
<div className="min-w-0">
<h3 className="font-semibold text-gray-900 truncate">{agent.name}</h3>
{agent.category && (
<span className="inline-block mt-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-50 text-blue-600">
{agent.category.name}
</span>
)}
</div>
</div>
<p className="text-gray-500 text-sm leading-relaxed mb-4">{agent.description}</p>
<div className="flex items-center justify-end">
<span className="text-blue-600 font-medium hover:underline transition-colors"> </span>
</div>
</Link>
))}
</div>
<div className="text-center mt-10">
<Link href="/agents" className="text-blue-600 font-medium hover:text-blue-700 transition">
</Link>
</div>
</div>
</section>
{/* 数字人应用 */}
<section className="py-16 bg-gradient-to-br from-purple-50 to-pink-50">
<div className="max-w-6xl mx-auto px-6">
<div className="text-center mb-10">
<h2 className="text-2xl font-bold text-gray-900 mb-2"></h2>
<p className="text-gray-500"></p>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5">
{[
{ name: "小雅", avatar: "👩‍💼", category: "商务助手", color: "from-purple-500 to-pink-500" },
{ name: "书淇", avatar: "👩‍🎓", category: "教育导师", color: "from-blue-500 to-cyan-500" },
{ name: "樱桃", avatar: "👧", category: "生活陪伴", color: "from-pink-500 to-rose-500" },
].map((human) => (
<Link
key={human.name}
href="/digital-humans"
className="bg-white rounded-2xl border border-gray-200 p-5 hover:border-purple-300 shadow-sm hover:shadow-md transition-all duration-300"
>
<div className="flex items-center gap-4 mb-4">
<div className={`w-14 h-14 bg-gradient-to-br ${human.color} rounded-xl flex items-center justify-center text-3xl flex-shrink-0`}>
{human.avatar}
</div>
<div className="min-w-0">
<h3 className="font-semibold text-gray-900 truncate">{human.name}</h3>
<span className="inline-block mt-1 px-2 py-0.5 rounded-full text-xs font-medium bg-purple-50 text-purple-600">
{human.category}
</span>
</div>
</div>
<p className="text-gray-500 text-sm leading-relaxed mb-4">
</p>
<div className="flex items-center justify-end">
<span className="text-purple-600 font-medium hover:underline transition-colors"> </span>
</div>
</Link>
))}
</div>
<div className="text-center mt-10">
<Link href="/digital-humans" className="inline-block bg-purple-600 text-white px-6 py-3 rounded-lg font-medium hover:bg-purple-700 transition">
</Link>
</div>
</div>
</section>
2026-05-06 17:22:50 +08:00
{/* 智能分类与使用场景 */}
<section id="features" className="py-16 bg-white rounded-3xl shadow-xl -mt-10 relative z-20">
<div className="max-w-6xl mx-auto px-6">
<h2 className="text-2xl font-bold text-gray-900 mb-8 text-center">使</h2>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{categories.map((category) => (
<Link
key={category.id}
href={`/agents?category=${category.id}`}
className="bg-blue-50 rounded-2xl p-6 cursor-pointer hover:bg-blue-100 transition-colors"
>
<div className="w-16 h-16 bg-blue-600 rounded-2xl flex items-center justify-center mx-auto mb-4 text-3xl">
{category.icon || "📊"}
</div>
<h3 className="font-semibold text-gray-900 text-center mb-2">{category.name}</h3>
<p className="text-xs text-gray-500 text-center mb-4">{category._count.agents}</p>
<p className="text-sm text-gray-600 text-center">{category.description || "智能应用场景"}</p>
</Link>
))}
</div>
</div>
</section>
{/* 前沿动态 */}
<section className="py-16">
<div className="max-w-6xl mx-auto px-6">
<h2 className="text-2xl font-bold text-gray-900 mb-8">沿</h2>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5">
{news.map((item) => (
<Link
key={item.id}
href={`/news/${item.id}`}
className="bg-white rounded-2xl border border-gray-200 overflow-hidden hover:border-blue-300 hover:shadow-md transition"
>
<div className="h-36 bg-gradient-to-br from-blue-100 to-indigo-100 flex items-center justify-center">
<span className="text-5xl">📰</span>
</div>
<div className="p-5">
<div className="flex items-center gap-2 mb-3">
<span className="px-2 py-0.5 bg-blue-50 text-blue-600 text-xs font-medium rounded-full">
{item.type === "news" ? "新闻" : item.type}
</span>
<span className="text-xs text-gray-400">
{new Date(item.createdAt).toLocaleDateString("zh-CN")}
</span>
</div>
<h3 className="font-semibold text-gray-900 mb-2 leading-snug">{item.title}</h3>
<p className="text-gray-500 text-sm leading-relaxed">{item.content.substring(0, 100)}...</p>
</div>
</Link>
))}
</div>
<div className="text-center mt-10">
<Link href="/news" className="text-blue-600 font-medium hover:text-blue-700 transition">
</Link>
</div>
</div>
</section>
2026-04-29 19:06:38 +08:00
</main>
2026-05-06 17:22:50 +08:00
{/* 底部 */}
<div className="border-t border-gray-200 py-8">
<div className="max-w-6xl mx-auto px-6 flex flex-col md:flex-row items-center justify-between gap-4">
<div className="flex items-center gap-3">
<div className="w-7 h-7 bg-blue-600 rounded-lg flex items-center justify-center">
<span className="text-white font-bold text-xs">AI</span>
</div>
<span className="font-semibold text-gray-700 text-sm"></span>
</div>
<div className="text-gray-400 text-sm text-center">
© 2026 · AI 广
</div>
<div className="flex gap-4 text-xs text-gray-400">
<a className="hover:text-gray-600 cursor-pointer transition"></a>
<a className="hover:text-gray-600 cursor-pointer transition"></a>
<a className="hover:text-gray-600 cursor-pointer transition"></a>
</div>
</div>
</div>
2026-04-29 19:06:38 +08:00
</div>
2026-05-06 17:22:50 +08:00
)
2026-04-29 19:06:38 +08:00
}