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; },