| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { InputItem, Icon, Checkbox, Button, Picker, Toast } from 'antd-mobile' |
| | | import { InputItem, Checkbox, Button, Picker, Toast } from 'antd-mobile' |
| | | import { createForm } from 'rc-form' |
| | | |
| | | import Api from '@/api' |
| | | // import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const CheckboxItem = Checkbox.CheckboxItem |
| | |
| | | {value: 'en-US', label: 'English'} |
| | | ], |
| | | lang: {value: 'zh-CN', label: '简体中文'}, |
| | | loading: false, |
| | | rember: true |
| | | } |
| | | |
| | |
| | | lang = cell |
| | | } |
| | | }) |
| | | Toast.success('切换成功', 3) |
| | | |
| | | this.setState({ |
| | | lang: lang |
| | |
| | | } |
| | | |
| | | execLogin = () => { |
| | | const { getFieldProps } = this.props.form |
| | | let userName = getFieldProps('userName') |
| | | let password = getFieldProps('password') |
| | | const { config } = this.props |
| | | // const { getFieldProps } = this.props.form |
| | | // const { loading } = this.state |
| | | |
| | | if (!userName.value) { |
| | | this.UserName.focus() |
| | | } else if (!password.value) { |
| | | this.Password.focus() |
| | | } else { |
| | | Api.getusermsg(userName.value, password.value).then((res) => { |
| | | if (res.status) { |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | } else { |
| | | Toast.fail(res.message, 3) |
| | | } |
| | | }) |
| | | } |
| | | // if (loading) return |
| | | |
| | | // let userName = getFieldProps('userName') |
| | | // let password = getFieldProps('password') |
| | | |
| | | // if (!userName.value) { |
| | | // this.UserName.focus() |
| | | // } else if (!password.value) { |
| | | // this.Password.focus() |
| | | // } else { |
| | | // this.setState({loading: true}) |
| | | // Api.getusermsg(userName.value, password.value).then((res) => { |
| | | // if (res.status) { |
| | | // sessionStorage.setItem('UserID', res.UserID) |
| | | // sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | // this.setState({loading: false}) |
| | | // } else { |
| | | // this.setState({loading: false}) |
| | | // Toast.fail(res.message, 3) |
| | | // } |
| | | // }) |
| | | this.props.history.replace({pathname: `/loading/${config.NextMenuID}`}) |
| | | // } |
| | | } |
| | | |
| | | execEnter = (e) => { |
| | |
| | | render () { |
| | | const { config } = this.props |
| | | const { getFieldProps } = this.props.form |
| | | const { rember, langs, lang } = this.state |
| | | const { rember, langs, lang, loading } = this.state |
| | | |
| | | return ( |
| | | <div className="mob-login-1" style={config.box.style}> |
| | |
| | | ref={el => this.UserName = el} |
| | | onKeyPress={this.execEnter} |
| | | > |
| | | <Icon type="check-circle-o" /> |
| | | <i className="minke-user" /> |
| | | </InputItem> |
| | | <InputItem |
| | | placeholder="Password" |
| | |
| | | ref={el => this.Password = el} |
| | | onKeyPress={this.execEnter} |
| | | > |
| | | <Icon type="check-circle" /> |
| | | <i className="minke-lock" /> |
| | | </InputItem> |
| | | <div className="other-setting"> |
| | | <CheckboxItem checked={rember} onChange={this.onChange}> |
| | |
| | | type="primary" |
| | | className="login" |
| | | style={config.login.style} |
| | | loading={loading} |
| | | onClick={this.execLogin} |
| | | > |
| | | {config.login.content} |