import type { Metadata } from 'next'; import { publicApi } from '@/lib/services'; import { Hero } from '@/components/front/Hero'; import { Section } from '@/components/front/Section'; import { ProductCard } from '@/components/front/ProductCard'; import { NewsCard } from '@/components/front/NewsCard'; import { StatsBar } from '@/components/front/StatsBar'; import { FeatureGrid } from '@/components/front/FeatureGrid'; import { SolutionShowcase } from '@/components/front/SolutionShowcase'; import { CtaSection } from '@/components/front/CtaSection'; export const metadata: Metadata = { title: '首页', description: '智管物业 - 让物业管理像发微信一样简单。物业缴费、在线报修、社区公告、巡检管理一站式SaaS平台。', }; export const revalidate = 60; async function fetchHome() { try { const [config, products, news] = await Promise.all([ publicApi.getSiteConfig(), publicApi.getProducts({ page: 1, pageSize: 6 }), publicApi.getNews({ page: 1, pageSize: 5 }), ]); return { config, products: products.list, news: news.list }; } catch { return { config: null, products: [], news: [] }; } } export default async function HomePage() { const { config, products, news } = await fetchHome(); return ( <> {/* 数据条 */} {/* 核心功能 */} {/* 解决方案 */} {/* 产品 */}
{products.map((p) => ( ))}
{products.length === 0 && }
{/* 新闻 */}
{news.map((n) => ( ))}
{news.length === 0 && }
{/* 转化引导 */} ); } function Empty({ text }: { text: string }) { return (
{text}
); }