"use client" import { useState, useEffect } from "react" import { useRouter } from "next/navigation" import { ChevronLeft, Users, Database, TrendingUp, Calendar, Clock } from "lucide-react" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import BottomNav from "@/app/components/BottomNav" interface DistributionPlan { id: string name: string status: "active" | "paused" source: string sourceIcon: string targetGroups: string[] totalUsers: number dailyAverage: number deviceCount: number poolCount: number lastUpdated: string createTime: string creator: string devices: { id: string name: string status: "online" | "offline" }[] pools: { id: string name: string count: number keywords: string[] }[] dailyStats: { date: string distributed: number }[] } export default function DistributionPlanDetailPage({ params }: { params: { id: string } }) { const { id } = params const router = useRouter() const [plan, setPlan] = useState(null) const [loading, setLoading] = useState(true) useEffect(() => { // 模拟API请求 setTimeout(() => { setPlan({ id: id, name: "抖音直播引流计划", status: "active", source: "douyin", sourceIcon: "🎬", targetGroups: ["新客户", "潜在客户"], totalUsers: 1250, dailyAverage: 85, deviceCount: 3, poolCount: 2, lastUpdated: "2024-03-18 10:30:00", createTime: "2024-03-10 08:30:00", creator: "admin", devices: [ { id: "dev1", name: "iPhone 13", status: "online" }, { id: "dev2", name: "Xiaomi 12", status: "online" }, { id: "dev3", name: "Huawei P40", status: "offline" }, ], pools: [ { id: "pool1", name: "抖音流量池", count: 850, keywords: ["抖音直播", "短视频", "网红"] }, { id: "pool2", name: "通用流量池", count: 400, keywords: ["电商", "购物", "促销"] }, ], dailyStats: [ { date: "03-15", distributed: 78 }, { date: "03-16", distributed: 92 }, { date: "03-17", distributed: 85 }, { date: "03-18", distributed: 103 }, { date: "03-19", distributed: 67 }, { date: "03-20", distributed: 89 }, { date: "03-21", distributed: 95 }, ], }) setLoading(false) }, 500) }, [id]) if (loading) { return (

加载中...

) } if (!plan) { return (

未找到计划

无法找到ID为 {id} 的分发计划

) } return (

计划详情

{/* 计划概览 */}
{plan.sourceIcon}
{plan.name}
{plan.status === "active" ? "进行中" : "已暂停"}
创建人: {plan.creator}
创建时间: {plan.createTime.split(" ")[0]}
最近更新: {plan.lastUpdated.split(" ")[0]}
{/* 统计数据区域:上3下2布局,单元格加分隔线 */}
{plan.dailyAverage}
日均分发人数
{plan.deviceCount}
分发设备
{plan.poolCount}
流量池
{/* 横向分隔线 */}
{plan.dailyAverage}
日均分发量
{plan.totalUsers}
总流量池数量
{/* 详细信息标签页 */} 设备 流量池 分发统计 分发设备 ({plan.devices.length})
{plan.devices.map((device) => (
{device.name}
ID: {device.id}
{device.status === "online" ? "在线" : "离线"}
))}
流量池 ({plan.pools.length})
{plan.pools.map((pool) => (
{pool.name}
{pool.count} 人
{pool.keywords.map((keyword, idx) => ( {keyword} ))}
))}
分发统计
{/* 这里可以放置图表组件,例如使用 recharts 或其他图表库 */}
{plan.dailyStats.map((stat, idx) => (
{stat.date}
{stat.distributed}
))}
最近7天分发数据统计
) }