| | |
| | | loginWays: [], |
| | | smsId: '', |
| | | verdisabled: false, |
| | | hasScan: false, |
| | | timeout: false |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | let smsId = '' |
| | | let hasScan = false |
| | | let _loginWays = [] |
| | | loginWays.forEach(item => { |
| | | if (item.type === 'sms_vcode') { |
| | | item.label = '短信登录' |
| | | smsId = item.smsId |
| | | _loginWays.push(item) |
| | | } else if (item.type === 'uname_pwd') { |
| | | item.label = '账号登录' |
| | | _loginWays.push(item) |
| | | } else if (item.type === 'app_scan') { |
| | | _loginWays.push(item) |
| | | hasScan = true |
| | | } |
| | | }) |
| | | |
| | |
| | | activeKey, |
| | | scanId: activeKey === 'app_scan' ? Utils.getuuid() : '', |
| | | timeout: false, |
| | | remember |
| | | remember, |
| | | hasScan |
| | | }) |
| | | |
| | | if (activeKey === 'app_scan') { |
| | |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout } = this.state |
| | | const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan } = this.state |
| | | const wayLabels = {app_scan: '扫码登录', uname_pwd: '账号登录', sms_vcode: '短信登录'} |
| | | |
| | | return ( |
| | | <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="login-way-title">用户登录</div> */} |
| | | <div className="login-way-title">{wayLabels[activeKey]}</div> |
| | | {hasScan && activeKey !== 'app_scan' ? <div className="scan-icon" onClick={() => this.onChangeTab('app_scan')}><Icon type="qrcode" /></div> : null} |
| | | {activeKey === 'uname_pwd' ? <div className="form-item-wrap"> |
| | | <Form.Item> |
| | | {getFieldDecorator('username', { |
| | |
| | | 请使用客户端扫一扫登录 |
| | | </div> |
| | | </div> : null} |
| | | <div className={'login-ways ' + (activeKey === 'app_scan' ? 'center' : '')}> |
| | | {loginWays.map(item => { |
| | | if (item.type === 'app_scan' || activeKey === item.type) return null |
| | | return (<span key={item.type} onClick={() => this.onChangeTab(item.type)}>{item.label}</span>) |
| | | })} |
| | | </div> |
| | | </Form> |
| | | ) |
| | | } |