getPhoneNumber(e) {
if (e.detail.errMsg === "getPhoneNumber:ok") {
// 或者单独存储某个值
wx.setStorageSync('state', 1);
let _this = this;
this.getPhoneNumber(e, () => {
});
this.getLocation();
} else {
console.log('用户拒绝授权');
}
},
/**
* 获取用户手机号
*/
getPhoneNumber(e, callback) {
let App = this;
wx.showLoading({
title: "正在登录",
mask: true
});
// 执行微信登录
wx.login({
success(res) {
// 获取code
console.log(res.code)
// 通过登录接口传给后端
}
});
},
微信小程序手机号授权登陆功能
最新推荐文章于 2024-07-10 19:16:05 发布