var that = this;
uni.getProvider({
service: ‘oauth’,
success: function(res) {
// console.log(res.provider);
//支持微信、qq和微博等
if (~res.provider.indexOf(‘weixin’)) {
uni.login({
provider: ‘weixin’,
success: function(loginRes) {
console.log(’-------获取openid(unionid)-----’);
console.log(JSON.stringify(loginRes));
// 获取用户信息
uni.getUserInfo({
provider: ‘weixin’,
success: function(infoRes) {
that.userInfos=infoRes.userInfo
console.log(that.userInfos)
console.log(JSON.stringify(infoRes.userInfo));
}
});
}
});
}else if (~res.provider.indexOf(‘qq’)) {
uni.login({
provider: ‘qq’,
success: function (loginRes) {
console.log(JSON.stringify(loginRes));
}
});
}
}
});
公众号验证授权
最新推荐文章于 2021-12-06 09:26:43 发布