fix: 修复前端代码质量问题

- 创建 Toast 通知组件,替换所有 alert() 调用
- 修复 useReview hook 内存泄漏(setInterval 清理)
- 移除所有 console.error 和 console.log 语句
- 为复制操作失败添加用户友好的 toast 提示

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-02-09 12:48:22 +08:00
co-authored by Claude Opus 4.5
parent a5a005db0c
commit 37ac749071
33 changed files with 519 additions and 91 deletions
+8 -6
View File
@@ -2,6 +2,7 @@
import { useState } from 'react'
import { useRouter, useParams } from 'next/navigation'
import { useToast } from '@/components/ui/Toast'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card'
import { Button } from '@/components/ui/Button'
import { Modal } from '@/components/ui/Modal'
@@ -127,6 +128,7 @@ const platformRules = {
export default function BriefConfigPage() {
const router = useRouter()
const params = useParams()
const toast = useToast()
// 品牌方 Brief(只读)
const [brandBrief] = useState(mockBrandBrief)
@@ -151,7 +153,7 @@ export default function BriefConfigPage() {
// 下载文件
const handleDownload = (file: BriefFile) => {
alert(`下载文件: ${file.name}`)
toast.info(`下载文件: ${file.name}`)
}
// 预览文件
@@ -164,7 +166,7 @@ export default function BriefConfigPage() {
setIsExporting(true)
await new Promise(resolve => setTimeout(resolve, 1500))
setIsExporting(false)
alert('平台规则文档已导出!')
toast.success('平台规则文档已导出!')
}
// AI 解析
@@ -172,7 +174,7 @@ export default function BriefConfigPage() {
setIsAIParsing(true)
await new Promise(resolve => setTimeout(resolve, 2000))
setIsAIParsing(false)
alert('AI 解析完成!')
toast.success('AI 解析完成!')
}
// 保存配置
@@ -180,7 +182,7 @@ export default function BriefConfigPage() {
setIsSaving(true)
await new Promise(resolve => setTimeout(resolve, 1000))
setIsSaving(false)
alert('配置已保存!')
toast.success('配置已保存!')
}
// 卖点操作
@@ -243,7 +245,7 @@ export default function BriefConfigPage() {
agencyFiles: [...prev.agencyFiles, newFile]
}))
setIsUploading(false)
alert('文档上传成功!')
toast.success('文档上传成功!')
}
const removeAgencyFile = (id: string) => {
@@ -258,7 +260,7 @@ export default function BriefConfigPage() {
}
const handleDownloadAgencyFile = (file: AgencyFile) => {
alert(`下载文件: ${file.name}`)
toast.info(`下载文件: ${file.name}`)
}
return (