'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { Video, Search, SlidersHorizontal, ChevronDown, Upload, Bot, Users, Building2, Check, X, Loader2 } from 'lucide-react' import { ResponsiveLayout } from '@/components/layout/ResponsiveLayout' import { cn } from '@/lib/utils' // 任务阶段状态类型 type StageStatus = 'pending' | 'current' | 'done' | 'error' // 任务数据类型 type Task = { id: string title: string description: string // 脚本阶段 scriptStage: { submit: StageStatus ai: StageStatus agency: StageStatus brand: StageStatus } // 视频阶段 videoStage: { submit: StageStatus ai: StageStatus agency: StageStatus brand: StageStatus } // 按钮配置 buttonText: string buttonType: 'upload' | 'view' | 'fix' // 阶段颜色 scriptColor: 'blue' | 'indigo' | 'coral' | 'green' videoColor: 'tertiary' | 'blue' | 'indigo' | 'coral' | 'green' } // 15个任务数据,覆盖所有状态 const mockTasks: Task[] = [ { id: 'task-001', title: 'XX品牌618推广', description: '产品种草视频 · 时长要求 60-90秒 · 截止: 2026-02-10', scriptStage: { submit: 'current', ai: 'pending', agency: 'pending', brand: 'pending' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '上传脚本', buttonType: 'upload', scriptColor: 'blue', videoColor: 'tertiary', }, { id: 'task-002', title: 'YY美妆新品', description: '口播测评 · 已上传视频 · 提交于: 今天 14:30', scriptStage: { submit: 'done', ai: 'current', agency: 'pending', brand: 'pending' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'indigo', videoColor: 'tertiary', }, { id: 'task-003', title: 'ZZ饮品夏日', description: '探店Vlog · 发现2处问题 · 需修改后重新提交', scriptStage: { submit: 'done', ai: 'error', agency: 'pending', brand: 'pending' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看修改', buttonType: 'fix', scriptColor: 'coral', videoColor: 'tertiary', }, { id: 'task-004', title: 'AA数码新品发布', description: '开箱测评 · 审核通过 · 可发布', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'green', videoColor: 'green', }, { id: 'task-005', title: 'BB运动饮料', description: '运动场景 · 脚本AI审核中 · 等待结果', scriptStage: { submit: 'done', ai: 'current', agency: 'pending', brand: 'pending' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'indigo', videoColor: 'tertiary', }, { id: 'task-006', title: 'CC服装春季款', description: '穿搭展示 · 脚本待代理商审核', scriptStage: { submit: 'done', ai: 'done', agency: 'current', brand: 'pending' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'indigo', videoColor: 'tertiary', }, { id: 'task-007', title: 'DD家电测评', description: '开箱视频 · 脚本待品牌终审', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'current' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'indigo', videoColor: 'tertiary', }, { id: 'task-008', title: 'EE食品试吃', description: '美食测评 · 脚本通过 · 待上传视频', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'current', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '上传视频', buttonType: 'upload', scriptColor: 'green', videoColor: 'blue', }, { id: 'task-009', title: 'FF护肤品', description: '使用教程 · 视频AI审核中', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'done', ai: 'current', agency: 'pending', brand: 'pending' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'green', videoColor: 'indigo', }, { id: 'task-010', title: 'GG智能手表', description: '功能展示 · 脚本代理商不通过', scriptStage: { submit: 'done', ai: 'done', agency: 'error', brand: 'pending' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看修改', buttonType: 'fix', scriptColor: 'coral', videoColor: 'tertiary', }, { id: 'task-011', title: 'HH美妆代言', description: '品牌代言 · 脚本品牌不通过', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'error' }, videoStage: { submit: 'pending', ai: 'pending', agency: 'pending', brand: 'pending' }, buttonText: '查看修改', buttonType: 'fix', scriptColor: 'coral', videoColor: 'tertiary', }, { id: 'task-012', title: 'II数码配件', description: '配件展示 · 视频代理商审核中', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'done', ai: 'done', agency: 'current', brand: 'pending' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'green', videoColor: 'indigo', }, { id: 'task-013', title: 'JJ旅行vlog', description: '旅行记录 · 视频代理商不通过', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'done', ai: 'done', agency: 'error', brand: 'pending' }, buttonText: '查看修改', buttonType: 'fix', scriptColor: 'green', videoColor: 'coral', }, { id: 'task-014', title: 'KK宠物用品', description: '宠物日常 · 视频品牌终审中', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'current' }, buttonText: '查看详情', buttonType: 'view', scriptColor: 'green', videoColor: 'indigo', }, { id: 'task-015', title: 'LL厨房电器', description: '使用演示 · 视频品牌不通过', scriptStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'done' }, videoStage: { submit: 'done', ai: 'done', agency: 'done', brand: 'error' }, buttonText: '查看修改', buttonType: 'fix', scriptColor: 'green', videoColor: 'coral', }, ] // 步骤图标组件 function StepIcon({ status, icon }: { status: StageStatus; icon: 'upload' | 'bot' | 'users' | 'building' }) { const IconComponent = { upload: Upload, bot: Bot, users: Users, building: Building2, }[icon] const getStyle = () => { switch (status) { case 'done': return 'bg-accent-green' case 'current': return 'bg-accent-indigo' case 'error': return 'bg-accent-coral' default: return 'bg-bg-elevated border-[1.5px] border-border-subtle' } } const getIconColor = () => { if (status === 'done' || status === 'current' || status === 'error') return 'text-white' return 'text-text-tertiary' } return (
{status === 'done' && } {status === 'current' && } {status === 'error' && } {status === 'pending' && }
) } // 进度条组件 function ProgressBar({ stage, color }: { stage: { submit: StageStatus; ai: StageStatus; agency: StageStatus; brand: StageStatus } color: string }) { const steps = [ { key: 'submit', label: '提交', icon: 'upload' as const, status: stage.submit }, { key: 'ai', label: 'AI审核', icon: 'bot' as const, status: stage.ai }, { key: 'agency', label: '代理商', icon: 'users' as const, status: stage.agency }, { key: 'brand', label: '品牌', icon: 'building' as const, status: stage.brand }, ] const getLineColor = (fromStatus: StageStatus) => { if (fromStatus === 'done') return 'bg-accent-green' return 'bg-border-subtle' } const getLabelColor = (status: StageStatus) => { if (status === 'done') return 'text-text-secondary' if (status === 'current') return 'text-accent-indigo font-semibold' if (status === 'error') return 'text-accent-coral font-semibold' return 'text-text-tertiary' } return (
{steps.map((step, index) => (
{step.label}
{index < steps.length - 1 && (
)}
))}
) } // 任务卡片组件 function TaskCard({ task, onClick }: { task: Task; onClick: () => void }) { const getStageColor = (color: string) => { switch (color) { case 'blue': return 'text-accent-blue' case 'indigo': return 'text-accent-indigo' case 'coral': return 'text-accent-coral' case 'green': return 'text-accent-green' default: return 'text-text-tertiary' } } const getButtonStyle = () => { switch (task.buttonType) { case 'upload': return 'bg-accent-green text-white' case 'fix': return 'bg-accent-coral text-white' default: return 'bg-transparent border-[1.5px] border-accent-indigo text-accent-indigo' } } return (
{/* 任务主行 */}
{/* 左侧:缩略图 + 信息 */}
{task.title} {task.description}
{/* 右侧:操作按钮 */}
{/* 进度条容器 */}
{/* 脚本阶段 */}
脚本
{/* 视频阶段 */}
视频
) } // 任务状态筛选选项 type TaskFilter = 'all' | 'pending' | 'reviewing' | 'rejected' | 'completed' const filterOptions: { value: TaskFilter; label: string }[] = [ { value: 'all', label: '全部状态' }, { value: 'pending', label: '待提交' }, { value: 'reviewing', label: '审核中' }, { value: 'rejected', label: '已驳回' }, { value: 'completed', label: '已完成' }, ] // 根据任务状态获取筛选分类 const getTaskFilterCategory = (task: Task): TaskFilter => { // 如果视频阶段全部完成,则为已完成 if (task.videoStage.brand === 'done') return 'completed' // 如果有任何阶段为 error,则为已驳回 if ( task.scriptStage.ai === 'error' || task.scriptStage.agency === 'error' || task.scriptStage.brand === 'error' || task.videoStage.ai === 'error' || task.videoStage.agency === 'error' || task.videoStage.brand === 'error' ) return 'rejected' // 如果脚本阶段待提交或视频阶段待提交(且脚本已完成) if (task.scriptStage.submit === 'current' || (task.scriptStage.brand === 'done' && task.videoStage.submit === 'current')) return 'pending' // 其他情况为审核中 return 'reviewing' } export default function CreatorTasksPage() { const router = useRouter() const [searchQuery, setSearchQuery] = useState('') const [filter, setFilter] = useState('all') const [showFilterDropdown, setShowFilterDropdown] = useState(false) const [tasks] = useState(mockTasks) const handleTaskClick = (taskId: string) => { router.push(`/creator/task/${taskId}`) } // 过滤任务 const filteredTasks = tasks.filter(task => { // 搜索过滤 const matchesSearch = searchQuery === '' || task.title.toLowerCase().includes(searchQuery.toLowerCase()) || task.description.toLowerCase().includes(searchQuery.toLowerCase()) // 状态过滤 const matchesFilter = filter === 'all' || getTaskFilterCategory(task) === filter return matchesSearch && matchesFilter }) const currentFilterLabel = filterOptions.find(opt => opt.value === filter)?.label || '全部状态' return (
{/* 顶部栏 */}

我的任务

{filter === 'all' ? `共 ${tasks.length} 个任务` : `${currentFilterLabel} ${filteredTasks.length} 个`}

setSearchQuery(e.target.value)} className="bg-transparent text-sm text-text-primary placeholder-text-tertiary focus:outline-none w-32" />
{showFilterDropdown && ( <>
setShowFilterDropdown(false)} />
{filterOptions.map((option) => ( ))}
)}
{/* 任务列表 - 可滚动 */}
{filteredTasks.length === 0 ? (

没有找到匹配的任务

尝试调整搜索条件或筛选状态

) : ( filteredTasks.map((task) => ( handleTaskClick(task.id)} /> )) )}
) }