品牌方功能: - 项目看板: 添加截止日期编辑功能 - 项目详情: 添加代理商管理、截止日期编辑、最近任务显示代理商 - 项目创建: 代理商选择支持搜索(名称/ID/公司名) - 代理商管理: 通过ID邀请、添加备注/分配项目/移除操作 - Brief配置: 新增项目级Brief和规则配置页面 - 系统设置: 完善账户安全(密码/2FA/邮箱/手机/设备管理)、数据导出、退出登录 代理商功能: - 个人中心: 新增代理商ID展示、公司信息(企业验证)、个人信息编辑 - 账户设置: 密码修改、手机/邮箱绑定、两步验证 - 通知设置: 分类型和渠道的通知开关 - 审核历史: 搜索筛选和统计展示 - 帮助反馈: FAQ分类搜索和客服联系 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
330 lines
12 KiB
TypeScript
330 lines
12 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import Link from 'next/link'
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card'
|
|
import { Button } from '@/components/ui/Button'
|
|
import { Input } from '@/components/ui/Input'
|
|
import { SuccessTag, PendingTag, WarningTag } from '@/components/ui/Tag'
|
|
import { Modal } from '@/components/ui/Modal'
|
|
import {
|
|
Search,
|
|
Plus,
|
|
Filter,
|
|
FileText,
|
|
Video,
|
|
ChevronRight,
|
|
Calendar,
|
|
Users,
|
|
Pencil
|
|
} from 'lucide-react'
|
|
|
|
// 项目类型定义
|
|
interface Project {
|
|
id: string
|
|
name: string
|
|
status: string
|
|
deadline: string
|
|
scriptCount: { total: number; passed: number; pending: number; rejected: number }
|
|
videoCount: { total: number; passed: number; pending: number; rejected: number }
|
|
agencyCount: number
|
|
creatorCount: number
|
|
}
|
|
|
|
// 模拟项目数据
|
|
const initialProjects: Project[] = [
|
|
{
|
|
id: 'proj-001',
|
|
name: 'XX品牌618推广',
|
|
status: 'active',
|
|
deadline: '2026-06-18',
|
|
scriptCount: { total: 20, passed: 15, pending: 3, rejected: 2 },
|
|
videoCount: { total: 20, passed: 12, pending: 5, rejected: 3 },
|
|
agencyCount: 3,
|
|
creatorCount: 15,
|
|
},
|
|
{
|
|
id: 'proj-002',
|
|
name: '新品口红系列',
|
|
status: 'active',
|
|
deadline: '2026-03-15',
|
|
scriptCount: { total: 12, passed: 10, pending: 1, rejected: 1 },
|
|
videoCount: { total: 12, passed: 8, pending: 3, rejected: 1 },
|
|
agencyCount: 2,
|
|
creatorCount: 8,
|
|
},
|
|
{
|
|
id: 'proj-003',
|
|
name: '护肤品秋季活动',
|
|
status: 'completed',
|
|
deadline: '2025-11-30',
|
|
scriptCount: { total: 15, passed: 15, pending: 0, rejected: 0 },
|
|
videoCount: { total: 15, passed: 15, pending: 0, rejected: 0 },
|
|
agencyCount: 2,
|
|
creatorCount: 10,
|
|
},
|
|
]
|
|
|
|
function StatusTag({ status }: { status: string }) {
|
|
if (status === 'active') return <SuccessTag>进行中</SuccessTag>
|
|
if (status === 'completed') return <PendingTag>已完成</PendingTag>
|
|
return <WarningTag>暂停</WarningTag>
|
|
}
|
|
|
|
function ProjectCard({ project, onEditDeadline }: { project: Project; onEditDeadline: (project: Project) => void }) {
|
|
const scriptProgress = Math.round((project.scriptCount.passed / project.scriptCount.total) * 100)
|
|
const videoProgress = Math.round((project.videoCount.passed / project.videoCount.total) * 100)
|
|
|
|
return (
|
|
<Link href={`/brand/projects/${project.id}`}>
|
|
<Card className="hover:border-accent-indigo/50 transition-colors cursor-pointer h-full">
|
|
<CardContent className="p-6 space-y-4">
|
|
{/* 项目头部 */}
|
|
<div className="flex items-start justify-between">
|
|
<div>
|
|
<h3 className="text-lg font-semibold text-text-primary">{project.name}</h3>
|
|
<div className="flex items-center gap-2 mt-1 text-sm text-text-secondary">
|
|
<Calendar size={14} />
|
|
<span>截止 {project.deadline}</span>
|
|
<button
|
|
type="button"
|
|
onClick={(e) => {
|
|
e.preventDefault()
|
|
e.stopPropagation()
|
|
onEditDeadline(project)
|
|
}}
|
|
className="p-1 rounded hover:bg-bg-page transition-colors"
|
|
title="修改截止日期"
|
|
>
|
|
<Pencil size={12} className="text-text-tertiary hover:text-accent-indigo" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<StatusTag status={project.status} />
|
|
</div>
|
|
|
|
{/* 脚本进度 */}
|
|
<div>
|
|
<div className="flex items-center justify-between text-sm mb-2">
|
|
<span className="flex items-center gap-2 text-text-secondary">
|
|
<FileText size={14} />
|
|
脚本审核
|
|
</span>
|
|
<span className="text-text-primary font-medium">
|
|
{project.scriptCount.passed}/{project.scriptCount.total}
|
|
</span>
|
|
</div>
|
|
<div className="h-2 bg-bg-elevated rounded-full overflow-hidden">
|
|
<div
|
|
className="h-full bg-accent-green transition-all"
|
|
style={{ width: `${scriptProgress}%` }}
|
|
/>
|
|
</div>
|
|
<div className="flex gap-4 mt-1 text-xs text-text-tertiary">
|
|
<span>通过 {project.scriptCount.passed}</span>
|
|
<span>待审 {project.scriptCount.pending}</span>
|
|
<span>驳回 {project.scriptCount.rejected}</span>
|
|
</div>
|
|
</div>
|
|
|
|
{/* 视频进度 */}
|
|
<div>
|
|
<div className="flex items-center justify-between text-sm mb-2">
|
|
<span className="flex items-center gap-2 text-text-secondary">
|
|
<Video size={14} />
|
|
视频审核
|
|
</span>
|
|
<span className="text-text-primary font-medium">
|
|
{project.videoCount.passed}/{project.videoCount.total}
|
|
</span>
|
|
</div>
|
|
<div className="h-2 bg-bg-elevated rounded-full overflow-hidden">
|
|
<div
|
|
className="h-full bg-accent-indigo transition-all"
|
|
style={{ width: `${videoProgress}%` }}
|
|
/>
|
|
</div>
|
|
<div className="flex gap-4 mt-1 text-xs text-text-tertiary">
|
|
<span>通过 {project.videoCount.passed}</span>
|
|
<span>待审 {project.videoCount.pending}</span>
|
|
<span>驳回 {project.videoCount.rejected}</span>
|
|
</div>
|
|
</div>
|
|
|
|
{/* 参与方统计 */}
|
|
<div className="flex items-center justify-between pt-4 border-t border-border-subtle">
|
|
<div className="flex items-center gap-4 text-sm text-text-secondary">
|
|
<span className="flex items-center gap-1">
|
|
<Users size={14} />
|
|
{project.agencyCount} 代理商
|
|
</span>
|
|
<span>{project.creatorCount} 达人</span>
|
|
</div>
|
|
<ChevronRight size={16} className="text-text-tertiary" />
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</Link>
|
|
)
|
|
}
|
|
|
|
export default function BrandProjectsPage() {
|
|
const [searchQuery, setSearchQuery] = useState('')
|
|
const [statusFilter, setStatusFilter] = useState<string>('all')
|
|
const [projects, setProjects] = useState<Project[]>(initialProjects)
|
|
|
|
// 编辑截止日期相关状态
|
|
const [showDeadlineModal, setShowDeadlineModal] = useState(false)
|
|
const [editingProject, setEditingProject] = useState<Project | null>(null)
|
|
const [newDeadline, setNewDeadline] = useState('')
|
|
|
|
// 打开编辑截止日期弹窗
|
|
const handleEditDeadline = (project: Project) => {
|
|
setEditingProject(project)
|
|
setNewDeadline(project.deadline)
|
|
setShowDeadlineModal(true)
|
|
}
|
|
|
|
// 保存截止日期
|
|
const handleSaveDeadline = () => {
|
|
if (!editingProject || !newDeadline) return
|
|
|
|
setProjects(prev => prev.map(p =>
|
|
p.id === editingProject.id ? { ...p, deadline: newDeadline } : p
|
|
))
|
|
setShowDeadlineModal(false)
|
|
setEditingProject(null)
|
|
setNewDeadline('')
|
|
}
|
|
|
|
const filteredProjects = projects.filter(project => {
|
|
const matchesSearch = project.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
const matchesStatus = statusFilter === 'all' || project.status === statusFilter
|
|
return matchesSearch && matchesStatus
|
|
})
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
{/* 页面标题和操作 */}
|
|
<div className="flex items-center justify-between">
|
|
<div>
|
|
<h1 className="text-2xl font-bold text-text-primary">项目看板</h1>
|
|
<p className="text-sm text-text-secondary mt-1">管理所有营销项目的审核进度</p>
|
|
</div>
|
|
<Link href="/brand/projects/create">
|
|
<Button>
|
|
<Plus size={16} />
|
|
创建项目
|
|
</Button>
|
|
</Link>
|
|
</div>
|
|
|
|
{/* 搜索和筛选 */}
|
|
<div className="flex items-center gap-4">
|
|
<div className="relative flex-1 max-w-md">
|
|
<Search size={18} className="absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary" />
|
|
<input
|
|
type="text"
|
|
placeholder="搜索项目名称..."
|
|
value={searchQuery}
|
|
onChange={(e) => setSearchQuery(e.target.value)}
|
|
className="w-full pl-10 pr-4 py-2 border border-border-subtle rounded-lg bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo"
|
|
/>
|
|
</div>
|
|
<div className="flex items-center gap-2">
|
|
<Filter size={16} className="text-text-tertiary" />
|
|
<select
|
|
value={statusFilter}
|
|
onChange={(e) => setStatusFilter(e.target.value)}
|
|
className="px-3 py-2 border border-border-subtle rounded-lg bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo"
|
|
>
|
|
<option value="all">全部状态</option>
|
|
<option value="active">进行中</option>
|
|
<option value="completed">已完成</option>
|
|
<option value="paused">已暂停</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
{/* 项目卡片网格 */}
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
{filteredProjects.map((project) => (
|
|
<ProjectCard key={project.id} project={project} onEditDeadline={handleEditDeadline} />
|
|
))}
|
|
</div>
|
|
|
|
{filteredProjects.length === 0 && (
|
|
<div className="text-center py-16">
|
|
<div className="text-text-tertiary mb-4">
|
|
<FileText size={48} className="mx-auto opacity-50" />
|
|
</div>
|
|
<p className="text-text-secondary">暂无匹配的项目</p>
|
|
<Link href="/brand/projects/create">
|
|
<Button variant="secondary" className="mt-4">
|
|
<Plus size={16} />
|
|
创建新项目
|
|
</Button>
|
|
</Link>
|
|
</div>
|
|
)}
|
|
|
|
{/* 编辑截止日期弹窗 */}
|
|
<Modal
|
|
isOpen={showDeadlineModal}
|
|
onClose={() => {
|
|
setShowDeadlineModal(false)
|
|
setEditingProject(null)
|
|
setNewDeadline('')
|
|
}}
|
|
title="修改截止日期"
|
|
>
|
|
<div className="space-y-4">
|
|
{editingProject && (
|
|
<div className="p-3 rounded-lg bg-bg-elevated">
|
|
<p className="text-sm text-text-secondary">项目名称</p>
|
|
<p className="font-medium text-text-primary">{editingProject.name}</p>
|
|
</div>
|
|
)}
|
|
|
|
<div>
|
|
<label className="block text-sm font-medium text-text-primary mb-2">
|
|
新截止日期
|
|
</label>
|
|
<div className="relative">
|
|
<Calendar size={18} className="absolute left-4 top-1/2 -translate-y-1/2 text-text-tertiary" />
|
|
<input
|
|
type="date"
|
|
value={newDeadline}
|
|
onChange={(e) => setNewDeadline(e.target.value)}
|
|
className="w-full pl-12 pr-4 py-3 border border-border-subtle rounded-lg bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex gap-3 pt-2">
|
|
<Button
|
|
variant="secondary"
|
|
className="flex-1"
|
|
onClick={() => {
|
|
setShowDeadlineModal(false)
|
|
setEditingProject(null)
|
|
setNewDeadline('')
|
|
}}
|
|
>
|
|
取消
|
|
</Button>
|
|
<Button
|
|
variant="primary"
|
|
className="flex-1"
|
|
onClick={handleSaveDeadline}
|
|
disabled={!newDeadline}
|
|
>
|
|
保存
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
</div>
|
|
)
|
|
}
|