import { Apis } from '@/gen/Apis'; import { FieldTimeOutlined, LockOutlined, UserOutlined, } from '@ant-design/icons'; import { LoginFormPage, ProConfigProvider, ProFormText, } from '@ant-design/pro-components'; import { theme } from 'antd'; import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { stateActions } from '..'; import gcLogo from './gclogo.png'; import logingBg from './loginBgImg.jpg'; export function MyLoginPage() { const navigate = useNavigate(); const [getCaptcha, setCaptcha] = useState({}); const { token } = theme.useToken(); const methods = { getCaptcha: () => { Apis.Common.Auth.Captcha().then(async (res) => { setCaptcha(res?.data); console.log(res, 'res'); }); }, }; useEffect(() => { methods?.getCaptcha(); }, []); return (
title={
| 智慧物业管理系统
} backgroundImageUrl={logingBg} subTitle=" " submitter={{ searchConfig: { submitText: '登录' } }} onFinish={async (values: any) => { Apis.Common.Auth.Login({ ...values, ...{ captcha_key: getCaptcha?.key }, }) .then(async (res) => { await stateActions.setLogin(res); navigate('/'); }) .catch((err: any) => { methods?.getCaptcha(); console.log(err, 'rr'); }); }} > <> , }} placeholder={'请输入手机号码'} rules={[ { required: true, message: '请输入手机号码!', }, ]} /> , }} placeholder={'请输入密码'} rules={[ { required: true, message: '请输入密码!', }, ]} />
, }} placeholder={'验证码'} rules={[ { required: true, message: '请输入验证码!', }, ]} />
{ methods?.getCaptcha(); }} >
{/*
记住账号 忘记密码
*/}
); }