更新记录
1.0.0(2020-06-12)
1.0
平台兼容性
plus-login
封装APP的登录接口,利用PLUS的api实现,所以只支持APP
引入JS SDK
import plusLogin from '@/common/app-plus/plus-login.js';// 具体路径应该写你自己的
使用JSSDK
//#ifdef APP-PLUS
async apple(){
const logout = await plusLogin.logout('apple'); // 退出
const userinfo = await plusLogin.login('apple', {}).catch(err => {
uni.showToast({
title: err.message || '您的设备不支持Apple登录',
icon: 'none'
});
return false;
});
console.log(userinfo)
}
async weixin(){
const logout = await plusLogin.logout('weixin'); // 退出
const userinfo = await plusLogin.login('weixin', {}).catch(err => {
uni.showToast({
title: err.message || '您的设备不支持weixin登录',
icon: 'none'
});
return false;
});
console.log(userinfo)
}
async authorize_weixin(){
// 微信也可以利用 authorize 获取到code 然后从服务器换取用户信息
const res = await plusLogin.authorize('weixin').catch(err => {
uni.showToast({
title: err.message || '获取授权信息失败',
icon: 'none'
});
});
var code = res.code
console.log(code);
}
//#endif