From f46786f11c5c08ead7501a82e5a71430ad69b782 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期日, 27 四月 2025 17:39:24 +0800 Subject: [PATCH] 修复线索问题定位错误问题 --- pages/cluetask/question/index.js | 48 ++++++++++++++++++++++++++++++------------------ 1 files changed, 30 insertions(+), 18 deletions(-) diff --git a/pages/cluetask/question/index.js b/pages/cluetask/question/index.js index 48a8915..ea9cd41 100644 --- a/pages/cluetask/question/index.js +++ b/pages/cluetask/question/index.js @@ -1,6 +1,7 @@ import { cluePicUrl } from '../../../config/index'; import { questionForm } from '../clue-item.js'; import { toLabel, toValue } from '../../../common/dataTowns'; +import mapUtils from '../../../utils/map-utils'; import { uploadQuestion, updateQuestion } from '../../../services/clue/fetchClue'; @@ -173,14 +174,25 @@ // 浠庡湴鍥鹃�夋嫨瀹氫綅 chooseLocation() { const { locations } = this.data; + let lng, lat; + if (typeof locations.longitude === 'number' && typeof locations.latitude === 'number') { + const coor = mapUtils.wgs84togcj02(locations.longitude, locations.latitude); + lng = coor[0]; + lat = coor[1]; + } wx.chooseLocation({ - longitude: locations.longitude, - latitude: locations.latitude, + longitude: lng, + latitude: lat, success: res => { + const [lngGps, latGps] = mapUtils.gcj02towgs84(res.longitude, res.latitude); this.setData({ locations: { - ...res, - coorTxt: `${res.longitude},${res.latitude}`, + name: res.name, + address: res.address, + // 浣跨敤 gcj02 鍥芥祴灞�鍧愭爣绯� + longitude: lngGps, + latitude: latGps, + coorTxt: `${lngGps},${latGps}`, }, }); }, @@ -189,20 +201,20 @@ // 娣诲姞鍥剧墖 handleAddImg(e) { - wx.chooseAddress({ - - }) - wx.getLocation({ - type:'wgs84', - success:res=>{ - this.setData({ - locations: { - ...res, - coorTxt: `${res.longitude},${res.latitude}`, - }, - }); - } - }) + // wx.chooseAddress({ + + // }) + // wx.getLocation({ + // type:'wgs84', + // success:res=>{ + // this.setData({ + // locations: { + // ...res, + // coorTxt: `${res.longitude},${res.latitude}`, + // }, + // }); + // } + // }) const { fileList } = this.data; const { files } = e.detail; this.setData({ -- Gitblit v1.9.3