import React, { Component } from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { Form, Input, Tabs, Button, Icon, Checkbox, Row, Col, Alert } from 'antd';
import styles from './Login.less';
const FormItem = Form.Item;
const { TabPane } = Tabs;
@connect(state => ({
login: state.login,
}))
@Form.create()
export default class Login extends Component {
state = {
count: 0,
type: 'account',
}
componentWillUnmount() {
clearInterval(this.interval);
}
onSwitch = (type) => {
this.setState({ type });
}
onGetCaptcha = () => {
let count = 59;
this.setState({ count });
this.interval = setInterval(() => {
count -= 1;
this.setState({ count });
if (count === 0) {
clearInterval(this.interval);
}
}, 1000);
}
handleSubmit = (e) => {
e.preventDefault();
this.props.form.validateFields({ force: true },
(err, values) => {
if (!err) {
this.props.dispatch({
type: 'login/login',
payload: {
...values,
type: this.state.type,
},
});
}
}
);
}
renderMessage = (message) => {
return (