|
|
@@ -78,7 +78,47 @@ export default {
|
|
|
console.log('连接失败');
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+ getPhoneNumber(e){
|
|
|
+
|
|
|
+ if (e.detail.errMsg == 'getPhoneNumber:ok') { //允许授权执行跳转
|
|
|
+ console.log(e.detail);
|
|
|
+ getApp().phoneRequest(e.detail.iv, e.detail.encryptedData, getApp().globalData.session_key);
|
|
|
+ return true;
|
|
|
+ } else { //
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ phoneRequest(myIv,myEncryptedData,sKey){
|
|
|
+ let url = getApp().globalData.shareUrl + '/phone';
|
|
|
+ //let url = "https://192.168.0.106:1024/dev-api/wap/business/weixin/phone";
|
|
|
+
|
|
|
+ uni.request({
|
|
|
+ url:url,
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/x-www-form-urlencoded'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ iv:myIv,
|
|
|
+ sessionKey:sKey,
|
|
|
+ encryptedData:myEncryptedData,
|
|
|
+ openid:getApp().globalData.open_id
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.code === 200){
|
|
|
+ getApp().globalData.user_phone = res.data.data;
|
|
|
+ if (res.data.data != ""){
|
|
|
+ getApp().globalData.globalAuth = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|