import { Button, Checkbox, Form, Input, message, Typography } from "antd"; import { useEffect, useState, useCallback } from "react"; import { fetchCaptcha, login, type CaptchaResponse } from "../api/auth"; import { getCurrentUser, getSystemParamValue } from "../api"; import { UserOutlined, LockOutlined, SafetyOutlined, ReloadOutlined, ShopOutlined } from "@ant-design/icons"; import "./Login.css"; const { Title, Text, Link } = Typography; export default function Login() { const [captcha, setCaptcha] = useState(null); const [captchaEnabled, setCaptchaEnabled] = useState(true); const [loading, setLoading] = useState(false); const [form] = Form.useForm(); const loadCaptcha = useCallback(async () => { if (!captchaEnabled) { return; } try { const data = await fetchCaptcha(); setCaptcha(data); } catch (e) { message.error("加载验证码失败"); } }, [captchaEnabled]); useEffect(() => { const init = async () => { try { const value = await getSystemParamValue("security.captcha.enabled", "true"); const enabled = value !== "false"; setCaptchaEnabled(enabled); if (enabled) { loadCaptcha(); } } catch (e) { setCaptchaEnabled(true); loadCaptcha(); } }; init(); }, [loadCaptcha]); const onFinish = async (values: any) => { setLoading(true); try { const data = await login({ username: values.username, password: values.password, tenantCode: values.tenantCode, captchaId: captchaEnabled ? captcha?.captchaId : undefined, captchaCode: captchaEnabled ? values.captchaCode : undefined }); localStorage.setItem("accessToken", data.accessToken); localStorage.setItem("refreshToken", data.refreshToken); localStorage.setItem("username", values.username); try { const profile = await getCurrentUser(); sessionStorage.setItem("userProfile", JSON.stringify(profile)); } catch (e) { sessionStorage.removeItem("userProfile"); } message.success("登录成功"); window.location.href = "/"; } catch (e: any) { message.error(e.message || "登录失败"); if (captchaEnabled) { loadCaptcha(); } } finally { setLoading(false); } }; return (
MeetingAI Logo MeetingAI

智能会议
实时语音处理
系统

全流程自动化会议记录,声纹识别与智能摘要
提升团队协作效率的新一代解决方案。

企业级安全
账号登录 欢迎回来,请登录您的账号
} placeholder="租户编码 (平台管理可留空)" aria-label="租户编码" /> } placeholder="用户名" autoComplete="username" spellCheck={false} aria-label="用户名" /> {captchaEnabled && (
} placeholder="验证码" maxLength={6} aria-label="验证码" />
)}
记住我 忘记密码?
演示账号:admin / 密码:123456
); }