| | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import wxicon from '@/assets/img/wx-icon.png' |
| | | import './index.scss' |
| | | |
| | | const { warning } = Modal |
| | |
| | | item.label = '账号登录' |
| | | _loginWays.push(item) |
| | | } else if (item.type === 'app_scan') { |
| | | item.label = 'APP扫码' |
| | | _loginWays.push(item) |
| | | hasScan = true |
| | | } else if (item.type === 'weixin_scan') { |
| | | item.label = '微信扫码' |
| | | _loginWays.push(item) |
| | | hasScan = true |
| | | } |
| | |
| | | smsId: smsId, |
| | | loginWays: _loginWays, |
| | | activeKey, |
| | | scanId: activeKey === 'app_scan' ? Utils.getuuid() : '', |
| | | scanId: activeKey === 'app_scan' || activeKey === 'weixin_scan' ? Utils.getuuid() : '', |
| | | timeout: false, |
| | | remember, |
| | | hasScan |
| | | }) |
| | | |
| | | if (activeKey === 'app_scan') { |
| | | if (activeKey === 'app_scan' || activeKey === 'weixin_scan') { |
| | | this.splitTime = 0 |
| | | this.timer = setTimeout(() => { |
| | | this.checkResult() |
| | |
| | | } |
| | | } |
| | | |
| | | onChangeTab = (activeKey) => { |
| | | this.setState({activeKey, scanId: activeKey === 'app_scan' ? Utils.getuuid() : ''}) |
| | | onChangeTab = (key) => { |
| | | const { activeKey, loginWays } = this.state |
| | | |
| | | if (this.state.activeKey === 'app_scan') { |
| | | if (key === 'scan') { |
| | | key = loginWays.filter(item => item.type === 'app_scan' || item.type === 'weixin_scan')[0].type |
| | | } |
| | | |
| | | this.setState({activeKey: key, scanId: key === 'app_scan' || key === 'weixin_scan' ? Utils.getuuid() : ''}) |
| | | |
| | | if (activeKey === 'app_scan' || activeKey === 'weixin_scan') { |
| | | this.timer && clearTimeout(this.timer) |
| | | } |
| | | |
| | | if (activeKey === 'app_scan') { |
| | | if (key === 'app_scan' || key === 'weixin_scan') { |
| | | this.splitTime = 0 |
| | | this.setState({timeout: false}) |
| | | this.timer = setTimeout(() => { |
| | |
| | | const { langList } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users } = this.state |
| | | const wayLabels = {app_scan: '扫码登录', uname_pwd: '账号登录', sms_vcode: '短信登录'} |
| | | const wayLabels = {app_scan: 'APP扫码', weixin_scan: '微信扫码', uname_pwd: '账号登录', sms_vcode: '短信登录'} |
| | | |
| | | return ( |
| | | <Form className="login-form" id="login-form" onSubmit={this.handleSubmit}> |
| | | <div className="login-way-title">{wayLabels[activeKey]}</div> |
| | | {hasScan && activeKey !== 'app_scan' ? <div className="scan-icon" onClick={() => this.onChangeTab('app_scan')}><QrcodeOutlined /></div> : null} |
| | | {hasScan && activeKey !== 'app_scan' && activeKey !== 'weixin_scan' ? <div className="scan-icon" onClick={() => this.onChangeTab('scan')}><QrcodeOutlined /></div> : null} |
| | | {activeKey === 'uname_pwd' ? <div className="form-item-wrap"> |
| | | <Form.Item> |
| | | {getFieldDecorator('username', { |
| | |
| | | <a href="http://www.minkesoft.com/forgotPwd" target="_blank" rel="noopener noreferrer" className="forgot">忘记密码?</a> |
| | | </Form.Item> : null} |
| | | </div> : null} |
| | | {activeKey === 'weixin_scan' ? <div className="form-item-wrap"> |
| | | <div className="form-scan-wrap"> |
| | | <div className="qr-wrap"> |
| | | {scanId ? <QrCode card={{qrWidth: 500, color: '#000000'}} value={`https://cloud.mk9h.cn/mob/mknotice.html?originurl=${window.btoa(window.GLOB.baseurl + 'mob/index.html#/wx/' + scanId)}`}/> : null} |
| | | {timeout ? <div className="qrcode-out"> |
| | | <RedoOutlined onClick={this.reCode} /> |
| | | 二维码已失效。 |
| | | </div> : null} |
| | | </div> |
| | | <img src={wxicon} alt=""/>请使用微信扫一扫登录 |
| | | </div> |
| | | </div> : null} |
| | | {activeKey === 'app_scan' ? <div className="form-item-wrap"> |
| | | <div className="form-scan-wrap"> |
| | | <div className="qr-wrap"> |
| | |
| | | 请使用客户端扫一扫登录 |
| | | </div> |
| | | </div> : null} |
| | | <div className={'login-ways ' + (activeKey === 'app_scan' ? 'center' : '')}> |
| | | <div className={'login-ways ' + (activeKey === 'app_scan' || activeKey === 'weixin_scan' ? 'center' : '')}> |
| | | {loginWays.map(item => { |
| | | if (item.type === 'app_scan' || activeKey === item.type) return null |
| | | if (activeKey === item.type) return null |
| | | if (item.type === 'app_scan' && activeKey !== 'weixin_scan') return null |
| | | if (item.type === 'weixin_scan' && activeKey !== 'app_scan') return null |
| | | return (<span key={item.type} onClick={() => this.onChangeTab(item.type)}>{item.label}</span>) |
| | | })} |
| | | </div> |