From 95ccc1acc6d8ede1c839493e7aecc9c97fd34c8c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 24 九月 2021 15:55:39 +0800 Subject: [PATCH] 2021-09-24 --- src/views/login/loginform.jsx | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 43cfa46..8e56f32 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -40,6 +40,7 @@ loginWays: [], smsId: '', verdisabled: false, + hasScan: false, timeout: false } @@ -56,15 +57,19 @@ } 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 } }) @@ -76,7 +81,8 @@ activeKey, scanId: activeKey === 'app_scan' ? Utils.getuuid() : '', timeout: false, - remember + remember, + hasScan }) if (activeKey === 'app_scan') { @@ -356,16 +362,13 @@ 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', { @@ -489,6 +492,12 @@ 璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰� </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> ) } -- Gitblit v1.8.0