From 4f5aa895a566c60d5338e4267bf87fa0442a93dd Mon Sep 17 00:00:00 2001 From: wpf <2187978347@qq.com> Date: Wed, 20 Sep 2023 23:12:24 +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 | 5 ++-- subpkg/property/vehicle.vue | 51 ++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/manifest.json b/manifest.json index a59d1ac..fcff127 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,6 @@ { "name" : "里海社区", + // "appid" : "__UNI__3A527D1", "appid" : "__UNI__B5B1EDD", "description" : "", "versionName" : "1.1.3", @@ -74,10 +75,10 @@ // "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1", "appkey_ios" : "82af93ec51139c712c4118d84ba684ee", "appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87" - // "appkey_ios" : "4f8f55618010007147aab96fc72bb408", - // "appkey_android" : "4f8f55618010007147aab96fc72bb408" } }, + // "appkey_ios" : "4f8f55618010007147aab96fc72bb408", + // "appkey_android" : "4f8f55618010007147aab96fc72bb408" "geolocation" : { "amap" : { "__platform__" : [ "ios", "android" ], diff --git a/subpkg/property/vehicle.vue b/subpkg/property/vehicle.vue index 9bde262..10d1098 100644 --- a/subpkg/property/vehicle.vue +++ b/subpkg/property/vehicle.vue @@ -168,6 +168,27 @@ // 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.getLocation({ type: 'gcj02', geocode: true, @@ -177,6 +198,7 @@ that.markers[1].longitude = res.longitude; that.getDriverLine(); // uni.hideLoading(); + console.log(res); uni.showModal({ title: '成功', content: JSON.stringify(res) @@ -186,10 +208,10 @@ // uni.hideLoading(); Toast('获取位置失败'); console.log(e); - // uni.showModal({ - // title: '失败', - // content: JSON.stringify(e) - // }) + uni.showModal({ + title: '失败', + content: JSON.stringify(e) + }) try { plus.geolocation.getCurrentPosition(function(position) { console.log('经度:' + position.coords.longitude); @@ -208,26 +230,7 @@ title: 'plus失败', content: JSON.parse(error) }) - 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) - }) - } - }) - }); + }); } catch (e) { uni.showModal({