今天发现微信废弃了授权API:’scope.userInfo’
授权允许-> wx.
getSetting
,进入success() 后 res.authSetting={}
我不得不说其实腾讯真心垃圾,做的东西全是坑
这个问题主要是因为微信最近刚好废弃了授权API;
没办法,我只能改,想想只能在首页的时候加一个BUTTON授权了
<button open-type="getUserInfo" bindgetuserinfo="getUserInfo">授权</button>
然后首页的JS再添加getUserInfo方法进行授权,然后就OK了。
getUserInfo:
function(){
var that =
this
wx.getSetting({
success(res) {
if (!res.authSetting[
'scope.userInfo']) {
wx.authorize({
scope:
'scope.userInfo',
success() {
that.UserLogin();
}
})
}
else{
that.UserLogin();
}
}
})
},
that.UserLogin()登录方法大家可以加自己的业务,这里就不写了;