'use client' import { useState } from 'react' import { Plus, Shield, AlertTriangle, Ban, Building2 } from 'lucide-react' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card' import { Button } from '@/components/ui/Button' import { Input } from '@/components/ui/Input' import { Modal } from '@/components/ui/Modal' import { Select } from '@/components/ui/Select' import { ErrorTag, WarningTag, SuccessTag } from '@/components/ui/Tag' // 模拟规则数据 const mockRules = { forbiddenWords: [ { id: '1', word: '最好', category: '极限词', severity: 'high' }, { id: '2', word: '第一', category: '极限词', severity: 'high' }, { id: '3', word: '最佳', category: '极限词', severity: 'high' }, { id: '4', word: '100%有效', category: '虚假宣称', severity: 'high' }, { id: '5', word: '立即见效', category: '虚假宣称', severity: 'medium' }, { id: '6', word: '永久', category: '极限词', severity: 'medium' }, ], competitors: [ { id: '1', name: '竞品A', logoUrl: '' }, { id: '2', name: '竞品B', logoUrl: '' }, { id: '3', name: '竞品C', logoUrl: '' }, ], whitelist: [ { id: '1', term: '品牌专属术语1', reason: '品牌授权使用' }, { id: '2', term: '特定产品名', reason: '官方产品名称' }, ], } const categoryOptions = [ { value: 'absolute_term', label: '极限词' }, { value: 'false_claim', label: '虚假宣称' }, { value: 'platform_rule', label: '平台规则' }, { value: 'custom', label: '自定义' }, ] const severityOptions = [ { value: 'high', label: '高风险' }, { value: 'medium', label: '中风险' }, { value: 'low', label: '低风险' }, ] function SeverityTag({ severity }: { severity: string }) { if (severity === 'high') return 高风险 if (severity === 'medium') return 中风险 return 低风险 } export default function RulesPage() { const [activeTab, setActiveTab] = useState<'forbidden' | 'competitors' | 'whitelist'>('forbidden') const [showAddModal, setShowAddModal] = useState(false) const [newWord, setNewWord] = useState('') const [newCategory, setNewCategory] = useState('absolute_term') const [newSeverity, setNewSeverity] = useState('high') const handleAddWord = () => { if (!newWord.trim()) return // TODO: 调用 API 添加 setShowAddModal(false) setNewWord('') } return (

规则配置

{/* 标签页 */}
{/* 违禁词列表 */} {activeTab === 'forbidden' && ( 违禁词列表
{mockRules.forbiddenWords.map((word) => ( ))}
词汇 分类 风险等级 操作
{word.word} {word.category}
)} {/* 竞品列表 */} {activeTab === 'competitors' && ( 竞品列表

系统将在视频中检测以下竞品的 Logo 或品牌名称

{mockRules.competitors.map((competitor) => (
{competitor.name}
))}
)} {/* 白名单 */} {activeTab === 'whitelist' && ( 白名单

白名单中的词汇即使命中违禁词也不会触发告警

{mockRules.whitelist.map((item) => ( ))}
词汇 原因 操作
{item.term} {item.reason}
)} {/* 添加违禁词弹窗 */} setShowAddModal(false)} title="添加违禁词" size="sm" >
setNewWord(e.target.value)} /> setNewSeverity(e.target.value)} />
) }