diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index be98af7..d25321c 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -1,31 +1,41 @@ -import { Form, Input, Button } from 'antd'; -import http from '@/utils/req'; +import { Form, Input, Button, Popover } from 'antd'; +import React from 'react'; +import req from '@/utils/req'; +import CodeImg from '@/assets/code.png'; import { history } from 'umi'; import styles from './index.less'; -import React from 'react'; -import { ValidateErrorEntity, Store } from 'rc-field-form/lib/interface'; -import { RouteComponentProps } from 'react-router-dom'; + +interface FormValues { + n: string; + co: string; +} + const layout = { labelCol: { span: 6 }, wrapperCol: { span: 16 }, }; + const tailLayout = { wrapperCol: { offset: 6, span: 16 }, }; -const Login = (props: RouteComponentProps) => { - const onFinish = (values: Store) => { - http - .post('/login', { ...values }) - .then(res => { - localStorage.setItem('token', res.token); - localStorage.setItem('user', values.username); - history.push('/'); - }); - }; +const content = ( + <> +
+ 趣谈前端-徐小夕 +
+

扫描上方二维码,关注【趣谈前端】公众号,回复"登录码" 即可获取

+ +); - const onFinishFailed = (errorInfo: ValidateErrorEntity) => { - console.log('Failed:', errorInfo); +const Login = () => { + const onFinish = (values: FormValues) => { + const { n, co } = values; + req.post('/vip/check', { n, co }).then((res: any) => { + localStorage.setItem('nickname', res.n); + localStorage.setItem('h5', JSON.stringify(res.h5)); + history.push('/'); + }); }; return ( @@ -36,38 +46,30 @@ const Login = (props: RouteComponentProps) => { className={styles.formWrap} initialValues={{ remember: true }} onFinish={onFinish} - onFinishFailed={onFinishFailed} >
- Doring开放平台 + Dooring开放平台 登录
- + - + +
+ + + +
+ - - - );