From 103fc59982046013b7b652119913134d5cdd7bc7 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Mon, 20 Dec 2021 22:01:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=9C=B0=E5=9D=80=E6=9D=83=E9=99=90=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user-address/user-address.vue | 88 +++++++++++++++-------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/pages/user-address/user-address.vue b/pages/user-address/user-address.vue index 5c2fdef1..35bbad17 100644 --- a/pages/user-address/user-address.vue +++ b/pages/user-address/user-address.vue @@ -310,50 +310,56 @@ }, // 获取系统地址事件 - choose_system_address_event(e) { - if(e == 1) { - uni.chooseAddress({ - success(res) { - var data = { - "name": res.userName || '', - "tel": res.telNumber || '', - "province": res.provinceName || '', - "city": res.cityName || '', - "county": res.countyName || '', - "address": res.detailInfo || '' - }; - - // 加载获取数据 - uni.showLoading({ - title: "处理中..." - }); - uni.request({ - url: app.globalData.get_request_url("outsystemadd", "useraddress"), - method: "POST", - data: data, - dataType: "json", - success: res => { - uni.hideLoading(); - if (res.data.code == 0) { - this.get_data_list(); + choose_system_address_event(e) { + // 百度、头条则需要验证授权 + // #ifdef MP-BAIDU || MP-TOUTIAO + // 去验证授权 + if(e != 1) { + app.globalData.auth_check(this, 'choose_system_address_event', 'scope.address'); + return false; + } + // #endif + + // 获取地址授权信息 + uni.chooseAddress({ + success(res) { + var data = { + "name": res.userName || '', + "tel": res.telNumber || '', + "province": res.provinceName || '', + "city": res.cityName || '', + "county": res.countyName || '', + "address": res.detailInfo || '' + }; + + // 加载获取数据 + uni.showLoading({ + title: "处理中..." + }); + uni.request({ + url: app.globalData.get_request_url("outsystemadd", "useraddress"), + method: "POST", + data: data, + dataType: "json", + success: res => { + uni.hideLoading(); + if (res.data.code == 0) { + this.get_data_list(); + } else { + if (app.globalData.is_login_check(res.data)) { + app.globalData.showToast(res.data.msg); } else { - if (app.globalData.is_login_check(res.data)) { - app.globalData.showToast(res.data.msg); - } else { - app.globalData.showToast('提交失败,请重试!'); - } + app.globalData.showToast('提交失败,请重试!'); } - }, - fail: () => { - uni.hideLoading(); - app.globalData.showToast("服务器请求出错"); } - }); - } - }); - } else { - app.globalData.auth_check(this, 'choose_system_address_event', 'scope.address'); - } + }, + fail: () => { + uni.hideLoading(); + app.globalData.showToast("服务器请求出错"); + } + }); + } + }); }, // 添加地址事件