onGetPhoneNumber(e) {
console.log(e , 'e e e e');
if(e.detail.errMsg == "getPhoneNumber:ok"){
const encryptedData = e.detail.encryptedData;
const iv = e.detail.iv;
console.log(encryptedData , 'encryptedData encryptedData encryptedData');
console.log(iv , 'iv iv iv');
wx.setStorageSync('phone', {encryptedData:encryptedData,iv:iv})
this.bindViewTap();
}else {
wx.showToast({
icon:'error',
title: '获取手机号失败',
})
}
},
<button class="empowerBtn" open-type="getPhoneNumber" type="primary"
bindgetphonenumber="onGetPhoneNumber">授权登录</button>
- {type: "getphonenumber", timeStamp: 224281, target: {…}, currentTarget: {…}, mark: {…}, …}
- currentTarget: {id: "", offsetLeft: 45, offsetTop: 547, dataset: {…}}
- detail: {errMsg: "getPhoneNumber:fail no permission"}
- mark: {}
- mut: false
- target: {id: "", offsetLeft: 45, offsetTop: 547, dataset: {…}}
- timeStamp: 224281
- type: "getphonenumber"
- _userTap: true
- __proto__: Object
测试号 没权限不能用 (已认证的企业号才能用)。。这个东西 用一次还要花3分钱。