"use client" import { format, subDays } from "date-fns" import { Activity, ArrowDownRight, ArrowUpRight, BarChart3, Calendar, DoorOpenIcon, Server, TrendingUp, UserPlus, Users, } from "lucide-react" import Link from "next/link" import { useMemo, useState } from "react" import { SimpleBarChart, SimpleHorizontalBarChart, SimpleLineChart, } from "@/components/charts" import { Page } from "@/components/page" type TimeRange = "today" | "7d" | "30d" | "90d" | "custom" const timeRangeLabels: Record = { today: "今日", "7d": "近7天", "30d": "近30天", "90d": "近90天", custom: "自定义", } function mulberry32(seed: number) { let t = seed return () => { t |= 0 t = (t + 0x6d2b79f5) | 0 let n = Math.imul(t ^ (t >>> 15), 1 | t) n = (n + Math.imul(n ^ (n >>> 7), 61 | n)) ^ n return ((n ^ (n >>> 14)) >>> 0) / 4294967296 } } export default function DashboardPage() { const [timeRange, setTimeRange] = useState("7d") const [showCustomPicker, setShowCustomPicker] = useState(false) const [startDate, setStartDate] = useState("") const [endDate, setEndDate] = useState("") const chartData = useMemo(() => { const days = 14 const seed = 42 const rng = mulberry32(seed) const proxyData = [] const tradeData = [] const customerData = [] const extractData = [] for (let i = days - 1; i >= 0; i--) { const date = subDays(new Date(), i) const dateStr = format(date, "MM-dd") proxyData.push({ date: dateStr, value: Math.floor(rng() * 50) + 80, }) tradeData.push({ date: dateStr, value: Math.floor(rng() * 3000) + 5000, }) customerData.push({ date: dateStr, value: Math.floor(rng() * 20) + 5, }) extractData.push({ date: dateStr, value: Math.floor(rng() * 800) + 1200, }) } const userData = [ { name: "张三", activity: 287 }, { name: "李四", activity: 245 }, { name: "王五", activity: 198 }, { name: "赵六", activity: 156 }, { name: "孙七", activity: 132 }, { name: "周八", activity: 98 }, { name: "吴九", activity: 76 }, ] return { proxyData, tradeData, customerData, extractData, userData } }, []) // 处理自定义日期按钮点击 const handleCustomClick = () => { setShowCustomPicker(true) setTimeRange("custom") // 清空之前的日期 setStartDate("") setEndDate("") } // 处理日期确认 const handleDateConfirm = () => { if (startDate && endDate) { console.log("自定义日期范围:", startDate, "~", endDate) setShowCustomPicker(false) } } // 处理取消 const handleCancel = () => { setShowCustomPicker(false) setTimeRange("7d") } return ( {/* 欢迎栏 */}

IP代理管理控制台

上次更新: --

客户管理 交易明细 网关列表
{/* 指标卡片 */}
{/* 时间筛选栏 */}
数据周期
{(Object.keys(timeRangeLabels) as TimeRange[]).map(key => ( ))}
{/* 点击自定义时显示 */} {showCustomPicker && (
setStartDate(e.target.value)} /> ~ setEndDate(e.target.value)} />
)}
{/* 图表区域 */}
{/* 每日活跃代理 */}

每日活跃代理

{/* 每日交易额 */}

每日交易额

{/* 每日新增客户 */}

每日新增客户

{/* 每日提取量 */}

每日提取量

{/*套餐统计 */}

套餐统计

总可用IP --
{/* 最近活跃用户 */}

最近活跃用户

) } function StatCard({ title, value, change, trend, icon: Icon, iconColor, iconBg, }: { title: string value: string change: string trend: "up" | "down" icon: React.ComponentType<{ className?: string }> iconColor: string iconBg: string }) { return (

{title}

{value}

{trend === "up" ? ( ) : ( )} {change} 较昨日
) } function ResourceItem({ label, active, total, color, }: { label: string active: string total: string color: string }) { return (
{label} {active} / {total}
) }