From 7ae8fae255456f723b1993044265592c11ef7a36 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 28 七月 2022 19:27:08 +0800 Subject: [PATCH] 2022-07-28 --- src/pc/components/login/normal-login/loginform.jsx | 72 ++++++++++++++++++++++------------- 1 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/pc/components/login/normal-login/loginform.jsx b/src/pc/components/login/normal-login/loginform.jsx index 0ca5d72..9d1d8fa 100644 --- a/src/pc/components/login/normal-login/loginform.jsx +++ b/src/pc/components/login/normal-login/loginform.jsx @@ -12,8 +12,7 @@ class LoginTabForm extends Component { static propTpyes = { - loginWays: PropTypes.array, - wrap: PropTypes.array, + wrap: PropTypes.object } state = { @@ -23,26 +22,36 @@ } UNSAFE_componentWillMount () { - const { loginWays, wrap } = this.props + const { 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 + + let loginWays = [] + wrap.loginWays.forEach(way => { + if (way === 'sms_vcode') { + loginWays.push({ + type: 'sms_vcode', + label: '鐭俊鐧诲綍', + tempId: wrap.tempId + }) + } else if (way === 'uname_pwd') { + loginWays.push({ + type: 'uname_pwd', + label: '璐﹀彿鐧诲綍', + shortcut: wrap.shortcut + }) + } else if (way === 'app_scan') { + scanWay = { + type: 'app_scan', + label: '鎵爜鐧诲綍' } - _loginWays.push(item) + loginWays.push(scanWay) } }) this.setState({ - loginWays: _loginWays, - activeWay: _loginWays[0], + loginWays: loginWays, + activeWay: loginWays[0], scanWay }) } @@ -51,24 +60,33 @@ const { wrap } = this.props if (!is(fromJS(wrap), fromJS(nextProps.wrap))) { - let _loginWays = [] 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 + let loginWays = [] + nextProps.wrap.loginWays.forEach(way => { + if (way === 'sms_vcode') { + loginWays.push({ + type: 'sms_vcode', + label: '鐭俊鐧诲綍', + tempId: wrap.tempId + }) + } else if (way === 'uname_pwd') { + loginWays.push({ + type: 'uname_pwd', + label: '璐﹀彿鐧诲綍', + shortcut: wrap.shortcut + }) + } else if (way === 'app_scan') { + scanWay = { + type: 'app_scan', + label: '鎵爜鐧诲綍' } - _loginWays.push(item) + loginWays.push(scanWay) } }) this.setState({ - loginWays: _loginWays, - activeWay: _loginWays[0], + loginWays: loginWays, + activeWay: loginWays[0], scanWay }) } -- Gitblit v1.8.0