import { useState } from 'react' import { KeyRound, Settings as SettingsIcon } from 'lucide-react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { authApi } from '@/srv/api' export default function Settings() { const [oldPassword, setOldPassword] = useState('') const [newPassword, setNewPassword] = useState('') const [confirmPassword, setConfirmPassword] = useState('') const [changing, setChanging] = useState(false) const handleChangePassword = async (e: React.FormEvent) => { e.preventDefault() if (newPassword !== confirmPassword) { alert('两次输入的密码不一致') return } setChanging(true) try { await authApi.changePassword(oldPassword, newPassword) alert('密码修改成功') setOldPassword('') setNewPassword('') setConfirmPassword('') } catch (err: unknown) { const message = err instanceof Error ? err.message : '密码修改失败' alert(message) } finally { setChanging(false) } } return (
修改登录密码与查看系统信息