forked from nsjcy/frontEnd/nsjcy

liuwh
2020-04-01 de0151aaae18282e885e5ae2d84653d1131a65a4
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
57
58
59
60
/**
 * 徐祥健<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 => {
      console.log(res)
      // debugger;
      if (res.code === 0) {
        // location.href = res.data;
        // location.href ='http://localhost:8080/index.html#/'
        location.href ='http://nsjcy.hugeinfo.com.cn/nsjc-charge/pc/index.html#/'
      } else {
        message.error(res.msg, 2)
      }
    })
  }
  render() {
    return (
      <div className="login-body">
        <LoginView onClick={this.onClick} />
      </div>
    );
  }
 
}