import { useState } from 'react' import { login } from '../lib/api' import { useNavigate } from 'react-router' import { Compass, Sparkles, Bell, User, Lock, ArrowRight } from 'lucide-react' import { PrimaryButton } from '../components/ui-ext/AiButton' import { BEE_IMG } from '../lib/assets' /** 仅服务端密码验证成功后进入工作台;失败保留表单并显示统一错误。 */ export function LoginPage({ onLogin }: { onLogin: () => void }) { const navigate = useNavigate() const [account, setAccount] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [busy, setBusy] = useState(false) const submit = async () => { if (busy) return if (!account.trim()) { setError('请输入账号'); return } if (!password.trim()) { setError('请输入密码'); return } setBusy(true) try { await login(account.trim(), password) onLogin() navigate('/', { replace: true }) } catch (error) { setError(error instanceof Error ? error.message : '登录失败') } finally { setBusy(false) } } return (
{/* 背景装饰:柔和光斑 */}
{/* 左侧品牌区 */}
如昼商机助手
水行业招投标商机平台
如昼小蜜蜂
  • AI 整理招标信息,报名节奏一眼看清
  • 结合公司档案打分,先看哪条直接给结论
  • 检索方案一键复用,重点商机不再错过
{/* 右侧登录表单 */}

欢迎回来

登录后继续查看今日商机

{ setAccount(e.target.value); setError('') }} onKeyDown={e => { if (e.key === 'Enter') submit() }} placeholder="请输入手机号或邮箱" autoComplete="username" className="w-full rounded-ctrl border border-line-soft bg-white py-2.5 pl-9 pr-3 text-sm text-ink-900 outline-none transition-shadow placeholder:text-ink-400 focus:border-brand-500/60 focus:ring-2 focus:ring-brand-500/10" />
{ setPassword(e.target.value); setError('') }} onKeyDown={e => { if (e.key === 'Enter') submit() }} placeholder="请输入密码" autoComplete="current-password" className="w-full rounded-ctrl border border-line-soft bg-white py-2.5 pl-9 pr-3 text-sm text-ink-900 outline-none transition-shadow placeholder:text-ink-400 focus:border-brand-500/60 focus:ring-2 focus:ring-brand-500/10" />
{error &&
{error}
} void submit()} disabled={busy} loading={busy} className="w-full !py-2.5 text-sm"> 登 录
) }