From c6625397688ab33e4a6d513cc352bb963e5335d0 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Mon, 22 Apr 2024 10:43:23 +0800 Subject: [PATCH] =?UTF-8?q?flat:=20=E6=9A=82=E5=AD=98=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E5=A4=84=E7=90=8670%=EF=BC=8Ckey=E8=BE=BE?= =?UTF-8?q?=E4=B8=8A=E9=99=90=E6=9C=AA=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/map.js | 25 ++++++++++++------- pages/project/newProject.vue | 2 +- pages/project/project.vue | 2 +- pages/projectInfo/projectInfo.vue | 30 +++++++++++++++++------ pages/projectInfo/userrecruitInfo.vue | 24 ++++++++++++------ pages/projectInfo/userrecruitWorkInfo.vue | 12 ++++----- pages/projectInfo/workInfo.vue | 12 ++++----- untils/addressToLocation.js | 27 ++++++++++++++++++++ 8 files changed, 96 insertions(+), 38 deletions(-) create mode 100644 untils/addressToLocation.js diff --git a/api/map.js b/api/map.js index 182cc06..25db316 100644 --- a/api/map.js +++ b/api/map.js @@ -23,15 +23,22 @@ export const getcoder = (location, key, get_poi) => { reject(err) }) }) - // return request({ - // url: 'https://apis.map.qq.com/ws/geocoder/v1', - // method: 'get', - // params: { - // location, - // key, - // get_poi - // } - // }) +} + +// 地名解析 +export const getAddresscoder = (params) => { + return new Promise((resolve, reject) => { + const paramsData = { + ...params, + output: 'jsonp' + } + jsonp('https://apis.map.qq.com/ws/geocoder/v1', paramsData, 30000) + .then((response) => { + return response + }).catch(err => { + reject(err) + }) + }) } /*关键词输入提示*/ diff --git a/pages/project/newProject.vue b/pages/project/newProject.vue index b6d44de..5eaf5db 100644 --- a/pages/project/newProject.vue +++ b/pages/project/newProject.vue @@ -238,7 +238,7 @@ latitude: res.latitude, longitude: res.longitude } - that.getAddrByPoint(res); + // that.getAddrByPoint(res); that.getNearList(that.currentPoint) }, complete: function(e) {} diff --git a/pages/project/project.vue b/pages/project/project.vue index f5be90b..2348aff 100644 --- a/pages/project/project.vue +++ b/pages/project/project.vue @@ -254,7 +254,7 @@ latitude: res.latitude, longitude: res.longitude } - that.getAddrByPoint(res); + // that.getAddrByPoint(res); that.getNearList(that.currentPoint) }, complete: function(e) {} diff --git a/pages/projectInfo/projectInfo.vue b/pages/projectInfo/projectInfo.vue index df4eb3f..b484f55 100644 --- a/pages/projectInfo/projectInfo.vue +++ b/pages/projectInfo/projectInfo.vue @@ -209,6 +209,12 @@ import uniMask from '@/components/uni-mask/mask.vue' import uniPopup from '@/components/uni-popup/uni-popup.vue' import validCode from '@/components/p-valid-code/p-valid-code.vue' + import { + AddressToLocation + } from '@/untils/addressToLocation.js' + import { + add + } from 'lodash'; export default { data() { return { @@ -220,8 +226,8 @@ maskShow: false, nextBtn: false, loading: false, - latitude: 39.909, //中心点 - longitude: 116.39742, + latitude: 31.126855, //中心点 + longitude: 104.397894, covers: [{ //marker标记位置 id: 0, latitude: 0, @@ -301,10 +307,19 @@ missionDetail(self.missionNo).then(res => { self.info = res.data.data; self.status = res.data.data.detailStatus; - self.latitude = self.info.lat; - self.longitude = self.info.lon; - self.covers[0].latitude = self.info.lat; - self.covers[0].longitude = self.info.lon; + AddressToLocation({ + smart_address: res.data.data.address + }).then((result) => { + console.log('result', result) + self.latitude = result.location.lat; + self.longitude = result.location.lon; + self.covers[0].latitude = result.location.lat; + self.covers[0].longitude = result.location.lon; + }) + // self.latitude = self.info.lat; + // self.longitude = self.info.lon; + // self.covers[0].latitude = self.info.lat; + // self.covers[0].longitude = self.info.lon; self.showDetail = true; self.getCollectStatus(); if (self.type === 1) { @@ -414,7 +429,8 @@ } }, cityNamed() { - if (this.info && typeof this.info.cityId !== 'undefined' && this.info.cityId !== -1 && this.area.dic) { + if (this.info && typeof this.info.cityId !== 'undefined' && this.info.cityId !== -1 && this.area + .dic) { return this.area.dic[this.info.cityId].label } else { return '无' diff --git a/pages/projectInfo/userrecruitInfo.vue b/pages/projectInfo/userrecruitInfo.vue index 597e4ce..7b6bf67 100644 --- a/pages/projectInfo/userrecruitInfo.vue +++ b/pages/projectInfo/userrecruitInfo.vue @@ -2,7 +2,7 @@ - {{info.missionTitle || '暂无'}} + {{info.jobName || '暂无'}}