'use client' import { useState } from 'react' 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, Download, Key, Mail, Smartphone, Globe, Moon, Sun, Check, LogOut, Monitor, Trash2, AlertCircle, Clock, FileText, BarChart3, Users, CheckCircle, Eye, EyeOff, Phone } from 'lucide-react' export default function BrandSettingsPage() { const router = useRouter() const toast = useToast() const [notifications, setNotifications] = useState({ email: true, push: true, reviewComplete: true, newSubmission: true, riskAlert: true, }) const [theme, setTheme] = useState<'light' | 'dark' | 'system'>('dark') // 退出登录弹窗 const [showLogoutModal, setShowLogoutModal] = useState(false) // 修改密码弹窗 const [showPasswordModal, setShowPasswordModal] = useState(false) const [passwordForm, setPasswordForm] = useState({ current: '', new: '', confirm: '' }) const [showPasswords, setShowPasswords] = useState({ current: false, new: false, confirm: false }) // 双因素认证弹窗 const [show2FAModal, setShow2FAModal] = useState(false) const [twoFAEnabled, setTwoFAEnabled] = useState(false) // 修改邮箱弹窗 const [showEmailModal, setShowEmailModal] = useState(false) const [newEmail, setNewEmail] = useState('') const [emailCode, setEmailCode] = useState('') // 修改手机弹窗 const [showPhoneModal, setShowPhoneModal] = useState(false) const [newPhone, setNewPhone] = useState('') const [phoneCode, setPhoneCode] = useState('') // 数据导出弹窗 const [showExportModal, setShowExportModal] = useState(false) const [exportType, setExportType] = useState('') const [exportRange, setExportRange] = useState('month') const [isExporting, setIsExporting] = useState(false) // 登录设备管理 const [showDevicesModal, setShowDevicesModal] = useState(false) // 模拟登录设备数据 const loginDevices = [ { id: 'd-1', name: 'Chrome - MacOS', location: '上海', lastActive: '当前设备', isCurrent: true }, { id: 'd-2', name: 'Safari - iPhone', location: '上海', lastActive: '2小时前', isCurrent: false }, { id: 'd-3', name: 'Chrome - Windows', location: '北京', lastActive: '3天前', isCurrent: false }, ] // 模拟导出历史 const exportHistory = [ { id: 'e-1', type: '审核记录', range: '2026年1月', status: 'completed', createdAt: '2026-02-01 10:30', size: '2.3MB' }, { id: 'e-2', type: '统计报告', range: '2025年Q4', status: 'completed', createdAt: '2026-01-15 14:20', size: '1.1MB' }, ] const handleSave = () => { toast.success('设置已保存') } const handleLogout = () => { // 模拟退出登录 router.push('/login') } const handleChangePassword = () => { if (passwordForm.new !== passwordForm.confirm) { toast.error('两次输入的密码不一致') return } toast.success('密码修改成功') setShowPasswordModal(false) setPasswordForm({ current: '', new: '', confirm: '' }) } const handleEnable2FA = () => { setTwoFAEnabled(true) setShow2FAModal(false) toast.success('双因素认证已启用') } const handleChangeEmail = () => { toast.success(`邮箱已更新为 ${newEmail}`) setShowEmailModal(false) setNewEmail('') setEmailCode('') } const handleChangePhone = () => { toast.success(`手机号已更新为 ${newPhone}`) setShowPhoneModal(false) setNewPhone('') setPhoneCode('') } const handleExport = async () => { setIsExporting(true) // 模拟导出过程 await new Promise(resolve => setTimeout(resolve, 2000)) setIsExporting(false) setShowExportModal(false) toast.info('导出任务已创建,完成后将通知您下载') } const handleRemoveDevice = (deviceId: string) => { toast.success('已移除该设备的登录状态') } return (
{/* 页面标题 */}

系统设置

管理账户和系统偏好设置

{/* 通知设置 */} 通知设置

邮件通知

接收重要事件的邮件提醒

推送通知

浏览器推送通知

通知类型

{/* 外观设置 */} 外观设置

选择界面主题

{/* 账户安全 */} 账户安全

修改密码

定期更换密码以保护账户安全

双因素认证

{twoFAEnabled ? '已启用,登录时需要手机验证码' : '启用后需要手机验证码登录'}

{twoFAEnabled ? ( 已启用 ) : ( )}

绑定邮箱

brand@example.com

绑定手机

138****8888

登录设备管理

查看和管理已登录的设备

{/* 数据导出 */} 数据导出

导出您的审核数据和报告

{/* 导出历史 */}

导出历史

{exportHistory.length > 0 ? (
{exportHistory.map(item => (

{item.type} - {item.range}

{item.createdAt} · {item.size}

))}
) : (

暂无导出记录

)}
{/* 保存按钮 */}
{/* 退出登录确认弹窗 */} setShowLogoutModal(false)} title="确认退出登录" >

确定要退出登录吗?

退出后需要重新登录才能访问系统

{/* 修改密码弹窗 */} { setShowPasswordModal(false); setPasswordForm({ current: '', new: '', confirm: '' }); }} title="修改密码" >
setPasswordForm({ ...passwordForm, current: e.target.value })} className="w-full px-4 py-2.5 pr-10 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
setPasswordForm({ ...passwordForm, new: e.target.value })} className="w-full px-4 py-2.5 pr-10 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />

密码需要8位以上,包含字母和数字

setPasswordForm({ ...passwordForm, confirm: e.target.value })} className="w-full px-4 py-2.5 pr-10 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
{/* 双因素认证弹窗 */} setShow2FAModal(false)} title="启用双因素认证" >

启用双因素认证后,登录时除了密码还需要输入手机验证码,可以有效保护账户安全。

绑定手机号

138****8888

安全提示

启用后,每次登录都需要输入发送到手机的验证码

{/* 修改邮箱弹窗 */} { setShowEmailModal(false); setNewEmail(''); setEmailCode(''); }} title="修改绑定邮箱" >

当前邮箱

brand@example.com

setNewEmail(e.target.value)} placeholder="请输入新邮箱" className="w-full px-4 py-2.5 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
setEmailCode(e.target.value)} placeholder="请输入验证码" className="flex-1 px-4 py-2.5 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
{/* 修改手机弹窗 */} { setShowPhoneModal(false); setNewPhone(''); setPhoneCode(''); }} title="修改绑定手机" >

当前手机号

138****8888

setNewPhone(e.target.value)} placeholder="请输入新手机号" className="w-full px-4 py-2.5 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
setPhoneCode(e.target.value)} placeholder="请输入验证码" className="flex-1 px-4 py-2.5 border border-border-subtle rounded-xl bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
{/* 登录设备管理弹窗 */} setShowDevicesModal(false)} title="登录设备管理" size="lg" >

以下是您账号已登录的设备,您可以移除不需要的设备。

{loginDevices.map(device => (

{device.name}

{device.isCurrent && ( 当前 )}

{device.location} · {device.lastActive}

{!device.isCurrent && ( )}
))}
{/* 数据导出弹窗 */} { setShowExportModal(false); setExportType(''); }} title="导出数据" >

导出类型

{exportType === 'review' && '审核记录'} {exportType === 'stats' && '统计报告'} {exportType === 'agency' && '代理商数据'} {exportType === 'all' && '全部数据'}

{[ { value: 'week', label: '最近一周' }, { value: 'month', label: '最近一月' }, { value: 'quarter', label: '最近三月' }, { value: 'year', label: '最近一年' }, ].map(option => ( ))}
Excel (.xlsx) CSV PDF
) }