授权:
<button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
<button open-type="openSetting" getopensetting="getopensetting">授权首页</button>
bindGetUserInfo(e) {
console.log(e.detail.userInfo == null);
if (e.detail.userInfo != null) {
app.globalData.userInfo = e.detail.userInfo;
} else {
//没有授权处理
}
},
登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})