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/pc/components/login/normal-login/loginform.jsx |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/pc/components/login/normal-login/loginform.jsx b/src/pc/components/login/normal-login/loginform.jsx
index 19ede79..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,6 +44,7 @@
     this.setState({
       loginWays: _loginWays,
       activeWay: _loginWays[0],
+      scanWay
     })
   }
 
@@ -43,8 +53,16 @@
 
     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
+          }
           _loginWays.push(item)
         }
       })
@@ -52,6 +70,7 @@
       this.setState({
         loginWays: _loginWays,
         activeWay: _loginWays[0],
+        scanWay
       })
     }
   }
@@ -81,15 +100,12 @@
   }
 
   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>
+        <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
@@ -143,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