| 22301014 | bc4616f | 2025-06-03 16:59:44 +0800 | [diff] [blame] | 1 | |
| 2 | import { LockOutlined, MailOutlined } from '@ant-design/icons'; |
| 3 | import { Button, Checkbox, Form, Input, Flex } from 'antd'; |
| 4 | import { NavLink } from 'react-router'; |
| 5 | function Login() { |
| 6 | const onFinish = (values: unknown) => { |
| 7 | console.log('Received values of form: ', values); |
| 8 | }; |
| 9 | |
| 10 | return ( |
| 11 | <Form |
| 12 | name="login" |
| 13 | initialValues={{ remember: true }} |
| 14 | style={{ maxWidth: 360 }} |
| 15 | onFinish={onFinish} |
| 16 | > |
| 17 | <h2>登录</h2> |
| 18 | <Form.Item |
| 19 | name="email" |
| 20 | rules={[{ required: true, message: '请输入你的账号(注册邮箱)!' }, { type: 'email', message: '请输入正确的邮箱' }]} |
| 21 | > |
| 22 | <Input prefix={<MailOutlined />} placeholder="账号(注册邮箱)" /> |
| 23 | </Form.Item> |
| 24 | <Form.Item |
| 25 | name="password" |
| 26 | rules={[{ required: true, message: '请输入你的密码!' }]} |
| 27 | > |
| 28 | <Input prefix={<LockOutlined />} type="password" placeholder="密码" /> |
| 29 | </Form.Item> |
| 30 | <Form.Item> |
| 31 | <Flex justify="space-between" align="center"> |
| 32 | <Form.Item name="remember" valuePropName="checked" noStyle> |
| 33 | <Checkbox>自动登录</Checkbox> |
| 34 | </Form.Item> |
| 35 | <NavLink to='/forget'> 忘记密码 </NavLink> |
| 36 | |
| 37 | </Flex> |
| 38 | </Form.Item> |
| 39 | |
| 40 | <Form.Item> |
| 41 | <Button block type="primary" htmlType="submit"> |
| 42 | 登录 |
| 43 | </Button> |
| 44 | 或 <NavLink to='/register'>注册</NavLink> |
| 45 | </Form.Item> |
| 46 | </Form> |
| 47 | ); |
| 48 | }; |
| 49 | |
| 50 | export default Login; |