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:
co-authored by
Claude Opus 4.5
parent
a5a005db0c
commit
37ac749071
@@ -1,6 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
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'
|
||||
@@ -179,6 +180,7 @@ export default function AgencyReportsPage() {
|
||||
const [exportFormat, setExportFormat] = useState<'csv' | 'excel' | 'pdf'>('excel')
|
||||
const [isExporting, setIsExporting] = useState(false)
|
||||
const [exportSuccess, setExportSuccess] = useState(false)
|
||||
const toast = useToast()
|
||||
|
||||
const currentData = mockDataByRange[dateRange]
|
||||
|
||||
@@ -199,9 +201,9 @@ export default function AgencyReportsPage() {
|
||||
downloadFile(csvContent, `${fileName}.csv`, 'text/csv')
|
||||
} else if (exportFormat === 'excel') {
|
||||
// 实际项目中会使用 xlsx 库
|
||||
alert(`Excel 文件「${fileName}.xlsx」已开始下载`)
|
||||
toast.info(`Excel 文件「${fileName}.xlsx」已开始下载`)
|
||||
} else {
|
||||
alert(`PDF 文件「${fileName}.pdf」已开始下载`)
|
||||
toast.info(`PDF 文件「${fileName}.pdf」已开始下载`)
|
||||
}
|
||||
|
||||
setIsExporting(false)
|
||||
|
||||
Reference in New Issue
Block a user