import React from 'react'; import { connect } from 'dva'; import router from 'umi/router'; import store from '@/utils/store'; import { Input, Icon, Button, message } from 'antd'; import config from '@/config'; import styles from './index.less'; @connect() class Login extends React.Component { state = { username: '', password: '', }; localOnChangeUserName = e => { this.setState({ username: e.target.value }); }; localOnChangePassWord = e => { this.setState({ password: e.target.value }); }; login = () => { const { username, password } = this.state; const { dispatch } = this.props; dispatch({ type: 'userLogin/login', payload: { userName: username, password }, }).then(({ code, data }) => { if (code === 'sys.success') { const { token, userId } = data; // message.success("登录成功"); store.set('token', token); store.set('userId', userId); router.push(config.home || '/profile/message'); } }); }; render() { return (
KIM3.0 平台业务架构
} placeholder="请输入账号" /> } placeholder="请输入密码" onPressEnter={this.login} />
{/*
copyright 2019 KIM3.0技术中台部出品
*/}
); } } export default Login;