Browse Source

add relay_id

stanley-king 4 years ago
parent
commit
afc4fc72d4
6 changed files with 17 additions and 15 deletions
  1. 1 1
      app.json
  2. 2 2
      config.js
  3. 3 5
      pages/components/auth/auth.js
  4. 4 5
      pages/index/index.js
  5. 4 1
      pages/login/login.js
  6. 3 1
      utils/WxAuthor.js

+ 1 - 1
app.json

@@ -1,7 +1,7 @@
 {
 	"pages": [
-		"pages/postage/postage",
 		"pages/index/index",
+		"pages/postage/postage",				
 		"pages/postageDetail/postageDetail",
 		"pages/postageManage/postageManage",
 		"pages/myhome/myhome",

+ 2 - 2
config.js

@@ -1,7 +1,7 @@
 // let api = "https://passport.lrlz.com/mobile/index.php";
 // let api = "http://www.xyzshops.cn/mobile/index.php";
-// let api = "http://192.168.1.200/mobile/index.php";
-let api = "https://www.xyzshops.cn/mobile/index.php";
+let api = "http://192.168.1.200/mobile/index.php";
+// let api = "https://www.xyzshops.cn/mobile/index.php";
 
 function getReq(app,data, callback, method)
 {

+ 3 - 5
pages/components/auth/auth.js

@@ -26,9 +26,6 @@ Component({
    */
   methods: {
     userPhoneHandler: function(e) { 
-      // console.log(e.detail.errMsg) 
-      // console.log(e.detail.iv) 
-      // console.log(e.detail.encryptedData) 
       this.phone_encryptedData = e.detail.encryptedData
       this.phone_iv = e.detail.iv
       this.wxauthen(this.userInfoE)
@@ -49,7 +46,7 @@ Component({
         userInfo = Object.assign({}, app.globalData.userId, app.globalData.userInfo);
       }
       else {
-        let { encryptedData, iv, signature } = e.detail
+        let { encryptedData, iv, signature } = eInfo.detail
         userInfo = Object.assign({}, { encryptedData }, { signature }, { iv }, userInfo)
       }
       
@@ -58,7 +55,8 @@ Component({
         user_info: userInfo,
         phone_info: phoneInfo,
         act: "login",
-        op: "wxauthen"
+        op: "wxauthen",
+        relay_id: app.globalData.relay_id
       }
 
       let self = this;

+ 4 - 5
pages/index/index.js

@@ -42,9 +42,8 @@ Page({
 
   onLoad: function (options) {
     console.log('index onLoad:',options)
-    if (!options.relay_id) {
-      app.globalData.relay_id = options.relay_id
-    }
+    app.globalData.relay_id = options.relay_id
+        
     // this.req_tabs();
     this.getDatas(0)
   },
@@ -144,11 +143,11 @@ Page({
   },
   onShareAppMessage: function () {
     console.log('index onShareAppMessage')
-    let relay_id = 100
+    let userid = app.globalData.member_id
     
     return {
       title: `${app.globalData.channel}小程序`,
-      path: "/pages/index/index?relay_id=${relay_id}"
+      path: `/pages/index/index?relay_id=${userid}`
     }
   },
   onReachBottom: function () {

+ 4 - 1
pages/login/login.js

@@ -78,11 +78,14 @@ Page({
       let params = {
           user_info: userInfo,
           act: "login",
-          op: "wxauthen"
+          op: "wxauthen",
+          relay_id: app.globalData.relay_id
+
       }
       getReq(app,params, function (res) {
         if (res.code == 200) {
           app.globalData.backLogin = true;
+          app.member_id = res.datas.member_id
           wx.navigateBack();
         }
         else {

+ 3 - 1
utils/WxAuthor.js

@@ -69,15 +69,17 @@ export default class WxAuthor {
     })
   }
   wxauthen(userInfo) {
+    let relay_id = this.target.globalData.relay_id
     let params = {
       user_info: userInfo,
       act: "login",
       op: "wxauthen",
-      relay_id: 100
+      relay_id: relay_id
     }
 
     getReq(this.target,params, res => {
       if (res.code == 200) {
+        this.target.globalData.member_id = res.datas.member_id
         let url = this.getUrl()
         wx.reLaunch({
           url