From 8a6ce370f1aa1c061b76fa3e9d2d4d1df53ca4c5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 21 五月 2024 16:38:09 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/views/login/loginform.jsx | 46 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 057d84b..33fca8a 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -9,6 +9,7 @@ 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 @@ -71,6 +72,11 @@ 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 } @@ -102,13 +108,13 @@ 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() @@ -236,14 +242,20 @@ } } - 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(() => { @@ -429,12 +441,12 @@ 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', { @@ -559,6 +571,18 @@ <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"> @@ -571,9 +595,11 @@ 璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰� </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> -- Gitblit v1.8.0