index.js 1.93 KB
Newer Older
duanledexianxianxian's avatar
duanledexianxianxian committed
1 2 3 4
import React from 'react';
import { connect } from 'dva';
import router from 'umi/router';
import store from '@/utils/store';
duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
5

duanledexianxianxian's avatar
duanledexianxianxian committed
6 7
import { Input, Icon, Button, message } from 'antd';
import config from '@/config';
duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
8

duanledexianxianxian's avatar
duanledexianxianxian committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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({
duanledexianxianxian's avatar
duanledexianxianxian committed
30
      type: 'userLogin/login',
duanledexianxianxian's avatar
duanledexianxianxian committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
      payload: { userName: username, password },
    });
  };

  render() {
    return (
      <div className={styles.root}>
        <div className={styles.container}>
          <div className={styles.box}>
            <div className={styles.title}>KIM3.0 平台业务架构</div>
            <Input
              className={styles.username}
              onChange={this.localOnChangeUserName}
              prefix={<Icon type="user" />}
              placeholder="请输入账号"
            />
            <Input
              className={styles.password}
              onChange={this.localOnChangePassWord}
              type="password"
              prefix={<Icon type="lock" />}
              placeholder="请输入密码"
              onPressEnter={this.login}
            />
            <Button className={styles.submit} type="primary" onClick={this.login}>
              登录
            </Button>
          </div>
          {/* <div className={styles.more}>
            <div className={styles.info} />
            <div className={styles.rights}>
              <span>copyright</span>
              <span>2019 KIM3.0技术中台部出品</span>
            </div>
          </div> */}
        </div>

        <div className={styles.line} />
      </div>
    );
  }
}

export default Login;