"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Card } from "@/components/ui/card" import { ArrowLeft } from "lucide-react" import { useRouter } from "next/navigation" import { StepIndicator } from "../components/step-indicator" import { TrafficPoolSelection } from "../components/traffic-pool-selection" import { StrategySelection } from "../components/strategy-selection" import { ExecutionSetup } from "../components/execution-setup" import { ConfirmStrategy } from "../components/confirm-strategy" export default function NewStrategyPage() { const router = useRouter() const [currentStep, setCurrentStep] = useState(1) const [formData, setFormData] = useState({ name: "", deviceIds: [] as string[], deviceNames: [] as string[], trafficPoolIds: [] as string[], trafficPoolNames: [] as string[], trafficPoolSize: 0, strategyType: "", strategyName: "", strategyConfig: {} as Record, executionConfig: { scheduleType: "immediate", // "immediate", "scheduled" scheduledTime: "", notifyOnComplete: true, importTags: true, sendToWechat: false, wechatId: "", }, }) const handleNext = () => { setCurrentStep((prev) => prev + 1) } const handleBack = () => { if (currentStep === 1) { router.back() } else { setCurrentStep((prev) => prev - 1) } } const handleSubmit = async () => { // 模拟提交 console.log("提交策略优化:", formData) // 模拟加载 await new Promise((resolve) => setTimeout(resolve, 1500)) // 跳转到列表页 router.push("/workspace/ai-strategy") } const updateFormData = (data: Partial) => { setFormData((prev) => ({ ...prev, ...data })) } return (
{/* 头部 */}

新建优化策略

{/* 步骤指示器 */}
{/* 主内容区域 */}
{currentStep === 1 && ( )} {currentStep === 2 && ( )} {currentStep === 3 && ( )} {currentStep === 4 && ( )}
) }