From 8aa746a65e6879b3c4dab81199c4f4a5334e5c35 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Thu, 21 Sep 2023 12:03:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 4 ++-- subpkg/property/vehicle.vue | 44 ++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/manifest.json b/manifest.json index fcff127..74fc960 100644 --- a/manifest.json +++ b/manifest.json @@ -74,7 +74,7 @@ // "appkey_ios" : "0799f37420c0784f1e6cba230a68bdb1", // "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1", "appkey_ios" : "82af93ec51139c712c4118d84ba684ee", - "appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87" + "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1" } }, // "appkey_ios" : "4f8f55618010007147aab96fc72bb408", @@ -83,7 +83,7 @@ "amap" : { "__platform__" : [ "ios", "android" ], "appkey_ios" : "82af93ec51139c712c4118d84ba684ee", - "appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87" + "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1" } } }, diff --git a/subpkg/property/vehicle.vue b/subpkg/property/vehicle.vue index 10d1098..8e38a69 100644 --- a/subpkg/property/vehicle.vue +++ b/subpkg/property/vehicle.vue @@ -165,30 +165,24 @@ // 位置 locationFn() { let that = this; - // uni.showLoading({ - // title: '获取位置中' - // }) - uni.sendHostEvent('getLocation', '获取位置', (ret) => { - uni.$on('uniMP_getLocation', (res) => { - try { - that.markers[1].latitude = res.latitude; - that.markers[1].longitude = res.longitude; - that.getDriverLine(); - uni.hideLoading(); - uni.showModal({ - title: 'uniMP成功', - content: JSON.parse(res) - }) - } catch (e) { - Toast('获取位置失败'); - uni.showModal({ - title: 'uniMP失败', - content: JSON.parse(e) - }) - } - }) - }); - return ; + uni.showLoading({ + title: '获取位置中' + }) + uni.sendHostEvent('getLocation', '获取位置', (ret) => { + uni.$on('uniMP_getLocation', (res) => { + try { + if(!res.latitude)new Error(); + that.markers[1].latitude = res.latitude; + that.markers[1].longitude = res.longitude; + that.getDriverLine(); + uni.hideLoading(); + } catch (e) { + uni.hideLoading(); + Toast('获取位置失败'); + } + }) + }); + return ; uni.getLocation({ type: 'gcj02', geocode: true, @@ -198,7 +192,7 @@ that.markers[1].longitude = res.longitude; that.getDriverLine(); // uni.hideLoading(); - console.log(res); + console.log(res); uni.showModal({ title: '成功', content: JSON.stringify(res)