From e003a8ee8843aa60b0b7135f413b2b99857acff9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 30 十二月 2020 18:49:43 +0800 Subject: [PATCH] 2020-12-30 --- src/components/login/login-1/index.jsx | 56 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/components/login/login-1/index.jsx b/src/components/login/login-1/index.jsx index 9d13e54..70a545a 100644 --- a/src/components/login/login-1/index.jsx +++ b/src/components/login/login-1/index.jsx @@ -1,10 +1,10 @@ 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 @@ -27,6 +27,7 @@ {value: 'en-US', label: 'English'} ], lang: {value: 'zh-CN', label: '绠�浣撲腑鏂�'}, + loading: false, rember: true } @@ -56,6 +57,7 @@ lang = cell } }) + Toast.success('鍒囨崲鎴愬姛', 3) this.setState({ lang: lang @@ -63,24 +65,33 @@ } 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) => { @@ -92,7 +103,7 @@ 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}> @@ -112,7 +123,7 @@ ref={el => this.UserName = el} onKeyPress={this.execEnter} > - <Icon type="check-circle-o" /> + <i className="minke-user" /> </InputItem> <InputItem placeholder="Password" @@ -124,7 +135,7 @@ 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}> @@ -139,6 +150,7 @@ type="primary" className="login" style={config.login.style} + loading={loading} onClick={this.execLogin} > {config.login.content} -- Gitblit v1.8.0