fix: resolve homepage 404 and add mock data for user portrait

Add landing page, fix type errors, mark dynamic API route, and refactor user portrait page.

Co-authored-by: null <4804959+fnvtk@users.noreply.github.com>
This commit is contained in:
v0
2025-08-09 03:04:39 +00:00
parent c94bde6f89
commit 9bb0ee2758
9 changed files with 462 additions and 430 deletions

View File

@@ -1,7 +1,7 @@
"use client"
import { useState, useEffect } from "react"
import { Search, Users, TrendingUp, Database, RefreshCw, BarChart3, Activity, Globe } from 'lucide-react'
import { Search, Users, TrendingUp, Database, RefreshCw, BarChart3, Activity, Globe, Smartphone, Brain } from 'lucide-react'
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
@@ -10,6 +10,7 @@ import { useRouter } from "next/navigation"
import { Toaster } from "@/components/ui/toaster"
import UserSearch from '@/components/home/user-search'
import UserList from '@/components/home/user-list'
import Link from "next/link"
interface SystemStats {
userCount: number
@@ -36,6 +37,8 @@ function StatCard({ icon, label, value }: { icon: React.ReactNode; label: string
)
}
export const dynamic = "force-static"
export default function OverviewPage() {
const router = useRouter()
const [searchQuery, setSearchQuery] = useState("")
@@ -113,6 +116,33 @@ export default function OverviewPage() {
return num.toString()
}
const tiles = [
{
href: "/user-portrait",
title: "用户画像",
desc: "管理与分群、标签与画像洞察",
icon: <Users className="h-5 w-5 text-purple-500" />,
},
{
href: "/devices",
title: "设备管理",
desc: "查看设备状态与执行任务",
icon: <Smartphone className="h-5 w-5 text-emerald-500" />,
},
{
href: "/data-platform",
title: "数据中台",
desc: "数据接入、质量监控与查询",
icon: <Database className="h-5 w-5 text-indigo-500" />,
},
{
href: "/ai-assistant",
title: "AI 助手",
desc: "智能问答与自动化报表",
icon: <Brain className="h-5 w-5 text-rose-500" />,
},
]
return (
<div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50">
<div className="container mx-auto px-4 py-8">
@@ -302,58 +332,21 @@ export default function OverviewPage() {
</div>
{/* 快速访问入口 */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<Card
className="cursor-pointer hover:shadow-lg transition-all duration-200 border-2 border-blue-100 hover:border-blue-300"
onClick={() => router.push("/data-platform")}
>
<CardContent className="p-6 text-center">
<div className="p-3 bg-blue-100 rounded-full w-fit mx-auto mb-3">
<Database className="w-8 h-8 text-blue-600" />
</div>
<h3 className="font-semibold text-lg mb-2"></h3>
<p className="text-sm text-gray-600">AI模型</p>
</CardContent>
</Card>
<Card
className="cursor-pointer hover:shadow-lg transition-all duration-200 border-2 border-green-100 hover:border-green-300"
onClick={() => router.push("/user-portrait")}
>
<CardContent className="p-6 text-center">
<div className="p-3 bg-green-100 rounded-full w-fit mx-auto mb-3">
<Users className="w-8 h-8 text-green-600" />
</div>
<h3 className="font-semibold text-lg mb-2"></h3>
<p className="text-sm text-gray-600"></p>
</CardContent>
</Card>
<Card
className="cursor-pointer hover:shadow-lg transition-all duration-200 border-2 border-purple-100 hover:border-purple-300"
onClick={() => router.push("/ai-assistant")}
>
<CardContent className="p-6 text-center">
<div className="p-3 bg-purple-100 rounded-full w-fit mx-auto mb-3">
<BarChart3 className="w-8 h-8 text-purple-600" />
</div>
<h3 className="font-semibold text-lg mb-2">AI智能助手</h3>
<p className="text-sm text-gray-600"></p>
</CardContent>
</Card>
<Card
className="cursor-pointer hover:shadow-lg transition-all duration-200 border-2 border-orange-100 hover:border-orange-300"
onClick={() => router.push("/intelligent-search")}
>
<CardContent className="p-6 text-center">
<div className="p-3 bg-orange-100 rounded-full w-fit mx-auto mb-3">
<Globe className="w-8 h-8 text-orange-600" />
</div>
<h3 className="font-semibold text-lg mb-2"></h3>
<p className="text-sm text-gray-600">AI分析</p>
</CardContent>
</Card>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
{tiles.map((t) => (
<Card key={t.href} className="transition hover:shadow-md">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-lg">{t.title}</CardTitle>
{t.icon}
</CardHeader>
<CardContent className="flex items-center justify-between">
<p className="text-sm text-muted-foreground">{t.desc}</p>
<Button asChild size="sm" className="ml-3">
<Link href={t.href}></Link>
</Button>
</CardContent>
</Card>
))}
</div>
{/* 快速指标示例(可后续接入真实数据) */}