修复首次获取Cookie

This commit is contained in:
whyour
2021-03-18 19:58:52 +08:00
parent b1f6d1ce14
commit d238850b35
5 changed files with 159 additions and 73 deletions
+39 -27
View File
@@ -1,9 +1,10 @@
import React, { Fragment, useEffect } from 'react';
import { Button, Row, Input, Form, notification } from 'antd';
import config from '@/utils/config';
import { history } from 'umi';
import { history, Link } from 'umi';
import styles from './index.less';
import { request } from '@/utils/http';
import logo from '@/assets/logo.png';
const FormItem = Form.Item;
@@ -39,34 +40,45 @@ const Login = () => {
}, []);
return (
<Fragment>
<div className={styles.form}>
<div className={styles.logo}>
<span>{config.siteName}</span>
<div className={styles.container}>
<div className={styles.content}>
<div className={styles.top}>
<div className={styles.header}>
<Link to="/">
<img alt="logo" className={styles.logo} src={logo} />
<span className={styles.title}>{config.siteName}</span>
</Link>
</div>
</div>
<div className={styles.main}>
<Form onFinish={handleOk}>
<FormItem
name="username"
rules={[{ required: true, message: '请输入用户名' }]}
hasFeedback
>
<Input placeholder="用户名" autoFocus />
</FormItem>
<FormItem
name="password"
rules={[{ required: true, message: '请输入密码' }]}
hasFeedback
>
<Input type="password" placeholder="密码" />
</FormItem>
<Row>
<Button
type="primary"
htmlType="submit"
style={{ width: '100%' }}
>
</Button>
</Row>
</Form>
</div>
<Form onFinish={handleOk}>
<FormItem
name="username"
rules={[{ required: true, message: '请输入用户名' }]}
hasFeedback
>
<Input placeholder="用户名" autoFocus />
</FormItem>
<FormItem
name="password"
rules={[{ required: true, message: '请输入密码' }]}
hasFeedback
>
<Input type="password" placeholder="密码" />
</FormItem>
<Row>
<Button type="primary" htmlType="submit">
Sign in
</Button>
</Row>
</Form>
</div>
</Fragment>
</div>
);
};