使用getphonenumber获取手机号问题?
getPhoneNumber(e) { console.log( "1111" ) if (e.detail.errMsg == "getPhoneNumber:fail user deny" ) { wx.showModal({ title: "提示" , showCancel: false , content: "未授权" , success: function (res) {} }); } else { wx.showModal({ title: "提示" , showCancel: false , content: "同意授权" , success: function (res) { // 用户登录 wx.login({ success: res => { console.log( "code转换" , res.code); //用code传给服务器调换session_key wx.request({ url: "http://127.0.0.1:3030/wechat/login" , //接口地址 data: { code: res.code }, success: res => { wx.setStorageSync( "openid" , res.data.openid); wx.setStorageSync( "session_key" , res.data.session_key); console.log(res); wx.request({ url: "http://127.0.0.1:3030/wechat/wxbizdatacrypt" , data: { encryptedData: e.detail.encryptedData, iv: e.detail.iv, session_key: wx.getStorageSync( "session_key" ) }, success: res => { console.log(res); } }); } }); } }); } }); } }, |
一直报:Component “pages/sign/sign” does not have a method “getPhoneNumber” to handle event “getphonenumber”.