forked from nsjcy/frontEnd/nsjcy

liyj
2020-02-11 e60e253cb3ce0597ded89b56a414c731e28c4ff1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
/**
 * 徐祥健<xuxj@hugeinfo.com.cn>
 * 2018年7月16日 19:43
 *
 */
 
 
import React from 'react';
 
import { message } from 'antd';
 
 
import LoginView from '../view/LoginView';
 
import Fetch from '../fetch';
 
export default class Login extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: null
    };
  }
 
  componentDidMount() {
    document.title = '南沙区人民检察院阳光检务后台管理登录';
  }
  //登录
  onClick = (userName, password) => {
    if (!userName) {
      message.warning('用户名不能为空!');
      return;
    }
    if (!password) {
      message.warning('密码不能为空!');
      return;
    }else{
      password = btoa(password);
    }
    Fetch.userLogin({ userName, password }).then(res => {
      if (res.code === 0) {
        location.href = res.data;
      } else {
        message.error(res.msg, 2)
      }
    })
  }
  render() {
    return (
      <div className="login-body">
        <LoginView onClick={this.onClick} />
      </div>
    );
  }
 
}