"use client" import { useState } from "react" import { useRouter } from "next/navigation" import { ChevronLeft, Users, Target, Settings, ArrowRight, ArrowLeft, Smartphone } from "lucide-react" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import { Switch } from "@/components/ui/switch" import { Badge } from "@/components/ui/badge" import { TrafficPoolSelector } from "@/app/components/traffic-pool-selector" import { Checkbox } from "@/components/ui/checkbox" export default function NewTrafficDistributionPage() { const router = useRouter() const [currentStep, setCurrentStep] = useState(1) const [formData, setFormData] = useState({ name: "", description: "", priority: "high", autoDistribute: true, createAsPackage: false, packagePrice: 0, allDevices: false, newDevices: false, targetDevices: [] as string[], showDeviceSelector: false, selectedPool: "", isPoolSelectorOpen: false, selectedUsers: [], }) const updateFormData = (field: string, value: any) => { setFormData((prev) => { if (field.includes(".")) { const [parent, child] = field.split(".") return { ...prev, [parent]: { ...prev[parent as keyof typeof prev], [child]: value, }, } } return { ...prev, [field]: value } }) } const handleNext = () => { setCurrentStep((prev) => prev + 1) } const handleBack = () => { if (currentStep > 1) { setCurrentStep((prev) => prev - 1) } else { router.back() } } const handleSubmit = () => { // 这里处理表单提交逻辑 console.log("提交表单数据:", formData) router.push("/workspace/traffic-distribution") } const isStep1Valid = formData.name && formData.source const isStep2Valid = formData.targetGroups.length > 0 || formData.targetDevices.length > 0 const isStep3Valid = true // 规则设置可以有默认值 return (
启用后,系统将自动按规则分发流量;关闭则需手动触发分发
启用后,可创建为可售卖流量包并设置价格
选择特定的设备进行流量分发