app微信登陆 获取code等信息
在条件编译下可以直接使用plus方法
// #ifdef APP-PLUS
plus.oauth.getServices(function(servies) {
var auths = servies;
var s = auths[1];
if (!s.authResult) {
s.authorize(function(e) {
console.log('获取code!' + JSON.stringify(e));
uni.showModal({
title: '用户信息',
content: e.code,
});
}, function(e) {
console.log('登陆认证失败!');
uni.showModal({
title: '认证失败1',
content: JSON.stringify(e),
});
}, {
scope: 'snsapi_userinfo',
state: '123'
});
} else {
console.log('已经登陆认证');
}
}, function(e) {
console.log("获取服务列表失败:" + JSON.stringify(e));
})
// #endif