小程序和公众号openID绑定
通过小程序登录获取小程序openID <button hidden="{{is_login}}" class='bottom' type='primary' open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="bindGetUserInfo" style='width:100px'> 登录</button> bindGetUserInfo: function (e) { if (e.detail.userInfo) { //用户按了允许授权按钮 var that = this; //插入登录的用户的相关信息到数据库 var openid = getApp().globalData.openid; var session = getApp().globalData.session getApp().globalData.userInfo = e.detail.userInfo; //通过wx.login获取code 想要获取用户信息,必须登录 wx.login({ success: function(res){ if(res.code){ var code = res.code; // 获取 encryptedData iv wx.getUserInfo({ withCredentials: true,