From 1da6506bf58270bacc2a4345002c6b082835580e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 21 十月 2021 23:17:08 +0800 Subject: [PATCH] 2021-10-21 --- src/pc/components/login/normal-login/loginform.jsx | 47 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/pc/components/login/normal-login/loginform.jsx b/src/pc/components/login/normal-login/loginform.jsx index 0bce326..536b883 100644 --- a/src/pc/components/login/normal-login/loginform.jsx +++ b/src/pc/components/login/normal-login/loginform.jsx @@ -20,14 +20,23 @@ state = { activeWay: null, loginWays: [], + scanWay: null } UNSAFE_componentWillMount () { const { loginWays, wrap } = this.props let _loginWays = [] + let scanWay = null loginWays.forEach(item => { if (!wrap.loginWays || wrap.loginWays.includes(item.type)) { + if (item.type === 'sms_vcode') { + item.label = '鐭俊鐧诲綍' + } else if (item.type === 'uname_pwd') { + item.label = '璐﹀彿鐧诲綍' + } else if (item.type === 'app_scan') { + scanWay = item + } _loginWays.push(item) } }) @@ -35,16 +44,25 @@ this.setState({ loginWays: _loginWays, activeWay: _loginWays[0], + scanWay }) } UNSAFE_componentWillReceiveProps (nextProps) { - const { loginWays, wrap } = this.props + const { wrap } = this.props if (!is(fromJS(wrap), fromJS(nextProps.wrap))) { let _loginWays = [] - loginWays.forEach(item => { + let scanWay = null + nextProps.loginWays.forEach(item => { if (!nextProps.wrap.loginWays || nextProps.wrap.loginWays.includes(item.type)) { + if (item.type === 'sms_vcode') { + item.label = '鐭俊鐧诲綍' + } else if (item.type === 'uname_pwd') { + item.label = '璐﹀彿鐧诲綍' + } else if (item.type === 'app_scan') { + scanWay = item + } _loginWays.push(item) } }) @@ -52,6 +70,7 @@ this.setState({ loginWays: _loginWays, activeWay: _loginWays[0], + scanWay }) } } @@ -81,16 +100,13 @@ } render() { - const { activeWay, loginWays } = this.state + const { activeWay, loginWays, scanWay } = this.state return ( <Form className="login-edit-form"> - <div className={'login-way-wrap ' + (loginWays.length === 1 ? 'simple' : '')}> - {loginWays.map(item => ( - <div className={'login-way' + (activeWay.type === item.type ? ' active' : '')} onClick={() => this.onChangeTab(item)} key={item.type}>{item.label}</div> - ))} - </div> - {activeWay.type === 'uname_pwd' ? <div className="form-item-wrap"> + <div className="login-way-title">{activeWay.label}</div> + {scanWay && activeWay.type !== 'app_scan' ? <div className="scan-icon" onClick={() => this.onChangeTab(scanWay)}><Icon type="qrcode" /></div> : null} + {activeWay.type === 'uname_pwd' ? <div className={'form-item-wrap ' + (activeWay.shortcut === 'none' ? 'no-short' : '')}> <Form.Item> <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} @@ -101,9 +117,12 @@ <Form.Item> <Input.Password placeholder="瀵嗙爜" prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} /> </Form.Item> - <Form.Item className="minline"> + {!activeWay.shortcut || activeWay.shortcut === 'remember' ? <Form.Item className="minline"> <Checkbox>璁颁綇瀵嗙爜</Checkbox> - </Form.Item> + </Form.Item> : null} + {activeWay.shortcut === 'autologon' ? <Form.Item className="minline"> + <Checkbox>鑷姩鐧诲綍</Checkbox> + </Form.Item> : null} <Form.Item className="btn-login"> <Button type="primary" onDoubleClick={() => this.changeMenu()} className="login-form-button"> 鐧诲綍 @@ -140,6 +159,12 @@ </div> 璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰� </div> : null} + <div className={'login-ways ' + (activeWay.type === 'app_scan' ? 'center' : '')}> + {loginWays.map(item => { + if (item.type === 'app_scan' || activeWay.type === item.type) return null + return (<span key={item.type} onClick={() => this.onChangeTab(item)}>{item.label}</span>) + })} + </div> </Form> ) } -- Gitblit v1.8.0