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
+10 -8
View File
@@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card'
import { Button } from '@/components/ui/Button'
import { Modal } from '@/components/ui/Modal'
import { useToast } from '@/components/ui/Toast'
import {
Bell,
Shield,
@@ -32,6 +33,7 @@ import {
export default function BrandSettingsPage() {
const router = useRouter()
const toast = useToast()
const [notifications, setNotifications] = useState({
email: true,
push: true,
@@ -95,7 +97,7 @@ export default function BrandSettingsPage() {
]
const handleSave = () => {
alert('设置已保存')
toast.success('设置已保存')
}
const handleLogout = () => {
@@ -105,10 +107,10 @@ export default function BrandSettingsPage() {
const handleChangePassword = () => {
if (passwordForm.new !== passwordForm.confirm) {
alert('两次输入的密码不一致')
toast.error('两次输入的密码不一致')
return
}
alert('密码修改成功')
toast.success('密码修改成功')
setShowPasswordModal(false)
setPasswordForm({ current: '', new: '', confirm: '' })
}
@@ -116,18 +118,18 @@ export default function BrandSettingsPage() {
const handleEnable2FA = () => {
setTwoFAEnabled(true)
setShow2FAModal(false)
alert('双因素认证已启用')
toast.success('双因素认证已启用')
}
const handleChangeEmail = () => {
alert(`邮箱已更新为 ${newEmail}`)
toast.success(`邮箱已更新为 ${newEmail}`)
setShowEmailModal(false)
setNewEmail('')
setEmailCode('')
}
const handleChangePhone = () => {
alert(`手机号已更新为 ${newPhone}`)
toast.success(`手机号已更新为 ${newPhone}`)
setShowPhoneModal(false)
setNewPhone('')
setPhoneCode('')
@@ -139,11 +141,11 @@ export default function BrandSettingsPage() {
await new Promise(resolve => setTimeout(resolve, 2000))
setIsExporting(false)
setShowExportModal(false)
alert('导出任务已创建,完成后将通知您下载')
toast.info('导出任务已创建,完成后将通知您下载')
}
const handleRemoveDevice = (deviceId: string) => {
alert('已移除该设备的登录状态')
toast.success('已移除该设备的登录状态')
}
return (