From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/pc/components/login/normal-login/loginform.jsx |   87 ++++++++++++++++++++++++++++---------------
 1 files changed, 57 insertions(+), 30 deletions(-)

diff --git a/src/pc/components/login/normal-login/loginform.jsx b/src/pc/components/login/normal-login/loginform.jsx
index 0ca5d72..51a1189 100644
--- a/src/pc/components/login/normal-login/loginform.jsx
+++ b/src/pc/components/login/normal-login/loginform.jsx
@@ -12,8 +12,8 @@
 
 class LoginTabForm extends Component {
   static propTpyes = {
-    loginWays: PropTypes.array,
-    wrap: PropTypes.array,
+    wrap: PropTypes.object,
+    changeway: PropTypes.func
   }
 
   state = {
@@ -23,26 +23,41 @@
   }
 
   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,
+          sort: 2
+        })
+      } else if (way === 'uname_pwd') {
+        loginWays.push({
+          type: 'uname_pwd',
+          label: '璐﹀彿鐧诲綍',
+          shortcut: wrap.shortcut,
+          sort: 1
+        })
+      } else if (way === 'app_scan') {
+        scanWay = {
+          type: 'app_scan',
+          label: '鎵爜鐧诲綍',
+          sort: 3
         }
-        _loginWays.push(item)
+        loginWays.push(scanWay)
       }
     })
 
+    loginWays.sort((a, b) => a.sort - b.sort)
+
     this.setState({
-      loginWays: _loginWays,
-      activeWay: _loginWays[0],
+      loginWays: loginWays,
+      activeWay: loginWays[0],
       scanWay
     })
   }
@@ -51,24 +66,37 @@
     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,
+            sort: 2
+          })
+        } else if (way === 'uname_pwd') {
+          loginWays.push({
+            type: 'uname_pwd',
+            label: '璐﹀彿鐧诲綍',
+            shortcut: wrap.shortcut,
+            sort: 1
+          })
+        } else if (way === 'app_scan') {
+          scanWay = {
+            type: 'app_scan',
+            label: '鎵爜鐧诲綍',
+            sort: 3
           }
-          _loginWays.push(item)
+          loginWays.push(scanWay)
         }
       })
+      loginWays.sort((a, b) => a.sort - b.sort)
 
       this.setState({
-        loginWays: _loginWays,
-        activeWay: _loginWays[0],
+        loginWays: loginWays,
+        activeWay: loginWays[0],
         scanWay
       })
     }
@@ -108,6 +136,7 @@
   }
 
   render() {
+    const { wrap } = this.props
     const { activeWay, loginWays, scanWay } = this.state
 
     return (
@@ -167,9 +196,7 @@
           </div>
           璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰�
         </div> : null}
-        {/* {wrap.protocol === 'true' ? <div className={'protocol-wrap '}>
-          <Checkbox>{wrap.tip}</Checkbox>{wrap.groups.map((item, i) => (<span className="protocol" key={i}>銆妠item.label}銆�</span>))}
-        </div> : null} */}
+        {wrap.classify !== 'login' ? <span className="mk-jump-way" onClick={() => this.props.changeway()}>娌℃湁璐﹀彿锛屽幓娉ㄥ唽锛�</span> : null}
         <div className={'login-ways ' + (activeWay.type === 'app_scan' ? 'center' : '')}>
           {loginWays.map(item => {
             if (item.type === 'app_scan' || activeWay.type === item.type) return null

--
Gitblit v1.8.0