| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Icon, Input, Button, Checkbox, Select, Modal, Tabs, message } from 'antd' |
| | | import { Form, Icon, Input, Button, Checkbox, Select, Modal, message } from 'antd' |
| | | import md5 from 'md5' |
| | | import moment from 'moment' |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const { warning } = Modal |
| | | const { TabPane } = Tabs |
| | | let LoginVerCodeTimer = null |
| | | |
| | | class LoginTabForm extends Component { |
| | |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 'MSN_sms_send_code', |
| | | let _param = { |
| | | func: 'mes_sms_send_code_sso', |
| | | send_type: 'login', |
| | | mob: _phone, |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | ID: smsId |
| | | } |
| | | _param.LText = 'minke' |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _param.secretkey = md5(`${_param.LText}mingke${_param.timestamp}`) |
| | | |
| | | _param.userid = sessionStorage.getItem('visitorUserID') || '' |
| | | _param.LoginUID = sessionStorage.getItem('visitorLoginUID') || '' |
| | | |
| | | param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`) |
| | | param.secretkey = md5(`${param.LText}mingke${param.timestamp}`) |
| | | Api.getSystemConfig(_param).then(res => { |
| | | if (!res.status || !res.n_id) { |
| | | message.warning(res.message || '验证码获取失败!') |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | verdisabled: true, |
| | | delay: 60 |
| | | }) |
| | | LoginVerCodeTimer = setTimeout(this.resetVerCodeDelay, 1000) |
| | | let param = { |
| | | func: 'MSN_sms_send_code', |
| | | send_type: 'login', |
| | | mob: _phone, |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | ID: smsId, |
| | | n_id: res.n_id |
| | | } |
| | | |
| | | param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`) |
| | | param.secretkey = md5(`${param.LText}mingke${param.timestamp}`) |
| | | |
| | | Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | | |
| | | } else { |
| | | param.rduri = 'http://sso.mk9h.cn/webapi/dostars' |
| | | param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk' |
| | | param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk' |
| | | |
| | | this.setState({ |
| | | verdisabled: true, |
| | | delay: 60 |
| | | }) |
| | | LoginVerCodeTimer = setTimeout(this.resetVerCodeDelay, 1000) |
| | | |
| | | Api.getLocalConfig(param).then(res => { |
| | | if (res.status) { |
| | | |
| | | } else { |
| | | if (LoginVerCodeTimer) { |
| | | clearTimeout(LoginVerCodeTimer) |
| | | } |
| | | this.setState({ |
| | | verdisabled: false, |
| | | delay: null |
| | | }) |
| | | message.warning(res.message) |
| | | } |
| | | }, () => { |
| | | if (LoginVerCodeTimer) { |
| | | clearTimeout(LoginVerCodeTimer) |
| | | } |
| | |
| | | verdisabled: false, |
| | | delay: null |
| | | }) |
| | | message.warning(res.message) |
| | | } |
| | | }, () => { |
| | | if (LoginVerCodeTimer) { |
| | | clearTimeout(LoginVerCodeTimer) |
| | | } |
| | | this.setState({ |
| | | verdisabled: false, |
| | | delay: null |
| | | }) |
| | | }) |
| | | } |
| | |
| | | const { activeKey, verdisabled, delay, loginWays, remember } = this.state |
| | | |
| | | return ( |
| | | <Form className={`login-form login-form-${loginWays.length}`} id="login-form" onSubmit={this.handleSubmit}> |
| | | <Tabs type="card" activeKey={activeKey} onChange={this.onChangeTab}> |
| | | {loginWays.map(item => (<TabPane tab={item.label} key={item.type}></TabPane>))} |
| | | </Tabs> |
| | | <Form className="login-form" id="login-form" onSubmit={this.handleSubmit}> |
| | | <div className={'login-way-wrap ' + (loginWays.length === 1 ? 'simple' : '')}> |
| | | {loginWays.map(item => ( |
| | | <div className={'login-way' + (activeKey === item.type ? ' active' : '')} onClick={() => this.onChangeTab(item.type)} key={item.type}>{item.label}</div> |
| | | ))} |
| | | </div> |
| | | <div className="form-item-wrap"> |
| | | {activeKey === 'uname_pwd' ? <Form.Item> |
| | | {getFieldDecorator('username', { |
| | |
| | | /> |
| | | )} |
| | | </Form.Item> : null} |
| | | {activeKey === 'sms_vcode' ? <Form.Item> |
| | | {activeKey === 'sms_vcode' ? <Form.Item className="vercode"> |
| | | {getFieldDecorator('vercode', { |
| | | initialValue: '', |
| | | rules: [ |
| | |
| | | {this.props.dict['login.submit']} |
| | | </Button> |
| | | </Form.Item> : null} |
| | | {options.sysType === 'cloud' ? <Form.Item className="register-line"> |
| | | {options.sysType === 'cloud' && options.cdomain.indexOf('mk9h') > -1 ? <Form.Item className="register-line"> |
| | | <a href="http://minkesoft.com/#/signup" target="_blank" rel="noopener noreferrer" className="register">注册</a> |
| | | <a href="http://minkesoft.com/#/forgotPwd" target="_blank" rel="noopener noreferrer" className="forgot">忘记密码?</a> |
| | | </Form.Item> : null} |