From 2c1b2e0eeab84e1bc41f35d365641e638824abe9 Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Thu, 30 Apr 2026 18:01:04 +0800 Subject: [PATCH] 1 --- pages/index/index.vue | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 42a5a0f..bb5bd0e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -628,7 +628,7 @@ } that.searchForm.workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '' // 获取用户当前位置 - this.getUserLocation(); + // this.getUserLocation(); this.getUserOrders(); // 建立WebSocket连接或定时请求获取配送员位置 this.getDeliveryLocation(); @@ -700,6 +700,7 @@ let that = this this.tui.request("/mall/delivery/accept", "POST",data, false, true).then((res) => { that.loadStatus = 'nomore'; + that.getUserLocation(); if (res.code == 200) { if(!uni.getStorageSync('worker') && res.result != null){ uni.setStorageSync('worker',res.result) @@ -918,22 +919,31 @@ }, // 获取用户位置 getUserLocation() { + let that = this; uni.getLocation({ type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件 success: (res) => { console.log('位置', res) this.latitude = res.latitude; this.longitude = res.longitude; - // 将用户位置添加到标记点 - this.markers.push({ - id: 0, - latitude: res.latitude, - longitude: res.longitude, - title: '我的位置', - iconPath: '/static/images/tabbar/fabu1.png', // 用户位置图标 - width: 30, - height: 30 - }); + + that.tui.request("/worker/admin/edit", "POST", { + workerId:uni.getStorageSync('worker').workerId, + region:JSON.parse(uni.getStorageSync('area')).id, + geolocation:this.latitude + ',' + this.longitude + }, false, false).then((res) => { + + }).catch((res) => {}) + // // 将用户位置添加到标记点 + // this.markers.push({ + // id: 0, + // latitude: res.latitude, + // longitude: res.longitude, + // title: '我的位置', + // iconPath: '/static/images/tabbar/fabu1.png', // 用户位置图标 + // width: 30, + // height: 30 + // }); }, fail: (err) => { console.log('获取位置失败', err);