From 8816ec91b2504224445fef2d40072aee2899e3e1 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Thu, 14 Jun 2018 11:47:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95bug=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=88=97=E8=A1=A8=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.wxml | 4 ++-- pages/login/login.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index e8e229f..5c33d43 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -26,8 +26,8 @@ - - + + {{item.limitNum}}人团 diff --git a/pages/login/login.js b/pages/login/login.js index e2137a6..c4e50d1 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -138,6 +138,10 @@ Page({ success: res => { // 可以将 res 发送给后台解码出 unionId app.globalData.userInfo = res.userInfo + // 发送 res.code 到后台换取 openId, sessionKey, unionId + if (that.globalData.openid != undefined && that.globalData.openid !=""){ + that.commitUserInfo(that.globalData.openid, res.encryptedData, res.iv); + }; // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 所以此处加入 callback 以防止这种情况 @@ -172,8 +176,7 @@ Page({ that.ohShitfadeOut(); return; } - // 发送 res.code 到后台换取 openId, sessionKey, unionId - that.commitUserInfo(that.globalData.openid, res.encryptedData, res.iv); + app.globalData.sessionId = data.response.sessionId; wx.setStorageSync('sessionId', data.response.sessionId); console.log('sessionId : ' + data.response.sessionId);