From d74cdf02ee4e472c8124fb49956bc857d37fbb2e Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Mon, 16 May 2022 14:41:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/activity/index.vue | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pages/activity/index.vue b/pages/activity/index.vue index b157252..5fd69f2 100644 --- a/pages/activity/index.vue +++ b/pages/activity/index.vue @@ -46,7 +46,7 @@ - 距离:11.3km + 距离:{{isUnde(item.distance)}}km @@ -63,22 +63,36 @@ data() { return { showInfo: true, - list: [], + list: [], + latitude:"", + longitude:"", } }, onLoad() { - this.loadActivity() + var that = this; + wx.getLocation({ + success(res) { + console.log(res) + that.latitude=res.latitude; + that.longitude=res.longitude; + that.loadActivity() + } + }) }, methods: { openInfo(obj) { uni.navigateTo({ - url: "info?id="+obj.id+"&latitude="+obj.latitude+"&longitude="+obj.longitude + url: "info?id="+obj.id }) }, loadActivity(){ var that = this; this.util.request({ api: '/api/mobile/activity/index', + data:{ + latitude:that.latitude, + longitude:that.longitude, + }, utilSuccess: function(res) { that.list = res.data; },