wangfukang 2 months ago
parent
commit
157a52fa49
  1. 9
      components/worker/delivery.vue
  2. 3
      manifest.json
  3. 6
      pages/worker/index.vue

9
components/worker/delivery.vue

@ -844,6 +844,12 @@
// 获取用户位置 // 获取用户位置
getUserLocation(item) { getUserLocation(item) {
if (!this.ensureLogin()) return if (!this.ensureLogin()) return
if (!item || !item.workerId) return
// #ifdef APP-PLUS
if (typeof plus == 'undefined' || !plus.geolocation) {
return
}
// #endif
let that = this; let that = this;
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
@ -856,7 +862,8 @@
geolocation: that.latitude + ',' + that.longitude geolocation: that.latitude + ',' + that.longitude
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {}) }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {})
} },
fail: () => {}
}); });
}, },
onReachPage() { onReachPage() {

3
manifest.json

@ -23,7 +23,8 @@
"modules" : { "modules" : {
"Camera" : {}, "Camera" : {},
"Bluetooth" : {}, "Bluetooth" : {},
"Push" : {} "Push" : {},
"Geolocation" : {}
}, },
/* 应用发布信息 */ /* 应用发布信息 */
"distribute" : { "distribute" : {

6
pages/worker/index.vue

@ -1146,6 +1146,12 @@
}, },
// 获取用户位置 // 获取用户位置
getUserLocation(id) { getUserLocation(id) {
if (!id) return
// #ifdef APP-PLUS
if (typeof plus == 'undefined' || !plus.geolocation) {
return
}
// #endif
let that = this; let that = this;
uni.getLocation({ uni.getLocation({
type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件 type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件

Loading…
Cancel
Save