import React, { useState } from 'react'; import { motion } from 'motion/react'; import { Lock, User } from 'lucide-react'; import { api } from '../lib/api'; interface LoginProps { onLogin: () => void; } export default function Login({ onLogin }: LoginProps) { const [username, setUsername] = useState('admin'); const [password, setPassword] = useState('123456'); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { await api.login(username, password); onLogin(); } catch (err) { setError(err instanceof Error ? err.message : '登录失败'); } finally { setLoading(false); } }; return (
模型逆向系统