|
|
@ -138,6 +138,10 @@ Page({ |
|
|
success: res => { |
|
|
success: res => { |
|
|
// 可以将 res 发送给后台解码出 unionId
|
|
|
// 可以将 res 发送给后台解码出 unionId
|
|
|
app.globalData.userInfo = res.userInfo |
|
|
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 之后才返回
|
|
|
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
// 所以此处加入 callback 以防止这种情况
|
|
|
// 所以此处加入 callback 以防止这种情况
|
|
|
@ -172,8 +176,7 @@ Page({ |
|
|
that.ohShitfadeOut(); |
|
|
that.ohShitfadeOut(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
|
|
|
|
that.commitUserInfo(that.globalData.openid, res.encryptedData, res.iv); |
|
|
|
|
|
|
|
|
|
|
|
app.globalData.sessionId = data.response.sessionId; |
|
|
app.globalData.sessionId = data.response.sessionId; |
|
|
wx.setStorageSync('sessionId', data.response.sessionId); |
|
|
wx.setStorageSync('sessionId', data.response.sessionId); |
|
|
console.log('sessionId : ' + data.response.sessionId); |
|
|
console.log('sessionId : ' + data.response.sessionId); |
|
|
|