From 94ec58eb687402fb221becd132f5b95338ddb9be Mon Sep 17 00:00:00 2001
From: shijiuyan <shijiuyan>
Date: Sat, 14 Mar 2020 11:13:52 +0800
Subject: [PATCH] 1

---
 src/wx/pages/leaderRegister/leaderRegister.js         | 47 ++++++++++++++++++++++++++++++-----------------
 src/wx/pages/socialUserRegister/socialUserRegister.js | 73 +++++++++++++++++++++++++++++++++++++++++++------------------------------
 2 files changed, 73 insertions(+), 47 deletions(-)

diff --git a/src/wx/pages/leaderRegister/leaderRegister.js b/src/wx/pages/leaderRegister/leaderRegister.js
index 170f2c8..d10c8be 100644
--- a/src/wx/pages/leaderRegister/leaderRegister.js
+++ b/src/wx/pages/leaderRegister/leaderRegister.js
@@ -85,25 +85,38 @@ Page({
           this.userInfoReadyCallback(res)
         }
         wx.request({
-          url: 'https://www.koala-online.cn/compass/if/ajax_leader_user_register.php',
+          url: app.url + 'ajax_get_unionid.php',
           data: {
-            unionId: config.unionId,
-            openId: config.openId,
-            headerImg: app.globalData.userInfo.avatarUrl,
-            qrId: this.data.qrId,
-          },
-          header: { 'content-type': 'application/json' },
-          method: 'GET',
-          dataType: 'json',
-          success: function (res) {
-            //跳转到年龄选择
-            wx.navigateTo({
-              url: '../ageChange/ageChange',
-            });
+            openid: config.openId,
+            iv: res.iv,
+            encryptedData: res.encryptedData
+
           },
-          fail: function (res) { },
-          complete: function (res) { },
-        })
+          success(resp) {
+            if (resp.data.status == 'OK') {
+              wx.request({
+                url: 'https://www.koala-online.cn/compass/if/ajax_leader_user_register.php',
+                data: {
+                  unionId: resp.data.result.unionId,
+                  openId: config.openId,
+                  headerImg: app.globalData.userInfo.avatarUrl,
+                  qrId: this.data.qrId,
+                },
+                header: { 'content-type': 'application/json' },
+                method: 'GET',
+                dataType: 'json',
+                success: function (res) {
+                  //跳转到年龄选择
+                  wx.navigateTo({
+                    url: '../ageChange/ageChange',
+                  });
+                },
+                fail: function (res) { },
+                complete: function (res) { },
+              })
+            }
+          }
+          });
       }
     })
 
diff --git a/src/wx/pages/socialUserRegister/socialUserRegister.js b/src/wx/pages/socialUserRegister/socialUserRegister.js
index 541f837..be73719 100644
--- a/src/wx/pages/socialUserRegister/socialUserRegister.js
+++ b/src/wx/pages/socialUserRegister/socialUserRegister.js
@@ -198,38 +198,51 @@ Page({
             return
           } 
           wx.request({
-            url: app.url + 'ajax_social_user_register1.php',
+            url: app.url + 'ajax_get_unionid.php',
             data: {
-              unionId: config.unionId,
-              openId: config.openId,
-              name: that.data.name,
-              mobile: that.data.mobile,
-              legalPerson: that.data.legalPerson,
-              organizationContact: that.data.organizationContact,
-              headerImg: app.globalData.userInfo.avatarUrl,
-              longitude: location.longitude,
-              latitude: location.latitude
-            },
-            header: { 'content-type': 'application/json' },
-            method: 'GET',
-            dataType: 'json',
-            success: function (res) {
-              wx.showToast({
-                title: res.data.result.message,
-                icon: 'success',
-                duration: 2000
-              });
-              //注册成功以后,弹出机构认证对话框
-              that.setData({
-                showRule: true,
-                uploadPic: 1
-              })
-            },
-            fail: function (res) {
-              console.log(res, '失败')
+              openid: config.openId,
+              iv: res.iv,
+              encryptedData: res.encryptedData
+
             },
-            complete: function (res) { },
-          })
+            success(resp) {
+              if (resp.data.status == 'OK') {
+                wx.request({
+                  url: app.url + 'ajax_social_user_register1.php',
+                  data: {
+                    unionId: resp.data.result.unionId,
+                    openId: config.openId,
+                    name: that.data.name,
+                    mobile: that.data.mobile,
+                    legalPerson: that.data.legalPerson,
+                    organizationContact: that.data.organizationContact,
+                    headerImg: app.globalData.userInfo.avatarUrl,
+                    longitude: location.longitude,
+                    latitude: location.latitude
+                  },
+                  header: { 'content-type': 'application/json' },
+                  method: 'GET',
+                  dataType: 'json',
+                  success: function (res) {
+                    wx.showToast({
+                      title: res.data.result.message,
+                      icon: 'success',
+                      duration: 2000
+                    });
+                    //注册成功以后,弹出机构认证对话框
+                    that.setData({
+                      showRule: true,
+                      uploadPic: 1
+                    })
+                  },
+                  fail: function (res) {
+                    console.log(res, '失败')
+                  },
+                  complete: function (res) { },
+                })
+              }
+            }
+          });
 
         }
 
--
libgit2 0.27.0