在安卓端可以,ios里的企业微信里打开小程序就不行,不弹出授权手机号那一步,
getPhoneNumber: function (e) {
if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
uni.showToast({
title: "拒绝成功",
icon: "none",
duration: 3000,
});
return;
}
let _this = this;
console.log(e.detail.errMsg);
console.log(e.detail.iv);
console.log(e.detail.encryptedData);
console.log(this.resCode + "--------------------");
let params = _this.$makeparamsHttp.makeparams(
"/wechatcard/wechatcard/getopenid",
JSON.stringify({
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
code: _this.resCode,
})
);
您好,企业微信小程序接口目前是不支持获取手机号的,如果是自建小程序,获取到用户userid后可以通过读取成员接口进行获取,如果是第三方小程序是不支持获取的
谁告诉你的wx.login可以授权手机号?
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
https://developers.weixin.qq.com/community/develop/doc/0004a6d9cb48686d31b97b64756c00?highLine=getPhoneNumber%25E5%2586%258D%25E4%25BC%2581%25E4%25B8%259A%25E5%25BE%25AE%25E4%25BF%25A1%25E4%25B8%25AD%25E4%25B8%258D%25E4%25BC%259A%25E5%25BC%25B9%25E5%2587%25BA%25E6%258E%2588%25E6%259D%2583
确实在ios中getPhoneNumber无法获取,只有安卓可以。然后有个人说企业微信获取手机号不是这个方式,你可以私信他