From 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Thu, 04 Jul 2024 14:51:28 +0800 Subject: [PATCH] fix: 高德密钥修改 --- pages/actionChange/newPage/index.vue | 37 +++++++++++++++++++++---------------- 1 files changed, 21 insertions(+), 16 deletions(-) diff --git a/pages/actionChange/newPage/index.vue b/pages/actionChange/newPage/index.vue index bd696c2..1f53fb0 100644 --- a/pages/actionChange/newPage/index.vue +++ b/pages/actionChange/newPage/index.vue @@ -183,7 +183,7 @@ unitList: [], polluteList: [], fileBaseList: [], - key: '04a1196c84f5d193c7d91c66150908be', + key: '00801eb7a8b1d415c94860ccbb765610', amapPlugin: null, } }, @@ -235,7 +235,7 @@ success: res => { console.log('������������', res) this.addressInfor = res - this.form.pollutePosition = res.address + this.form.pollutePosition = `${res.name } ��� ${res.address}` }, fail: function(err) { console.log('������������', err) @@ -244,17 +244,21 @@ }, handerLocation() { let that = this - uni.getLocation({ - type: 'gcj02', - isHighAccuracy: true, //��������������������� - success: function(res) { - console.log('111', res) - that.handerChooseLocation(res.latitude, res.longitude) - }, - fail(error) { - console.log('������', error) - } - }) + if (this.addressInfor.latitude === '') { + uni.getLocation({ + type: 'gcj02', + isHighAccuracy: true, //��������������������� + success: function(res) { + console.log('111', res) + that.handerChooseLocation(res.latitude, res.longitude) + }, + fail(error) { + console.log('������', error) + } + }) + } else { + that.handerChooseLocation(this.addressInfor.latitude, this.addressInfor.longitude) + } }, handleOpenSetting() { let that = this @@ -343,7 +347,7 @@ this.$refs.uForm.validate().then(res => { this.sumbitForm.problemDescribe = this.form.problemDescribe this.sumbitForm.pollutePosition = this.form.pollutePosition - this.sumbitForm.address = this.addressInfor.address + this.sumbitForm.address = this.addressInfor.name this.sumbitForm.latitude = this.addressInfor.latitude this.sumbitForm.longitude = this.addressInfor.longitude this.sumbitForm.name = this.addressInfor.name @@ -405,11 +409,12 @@ type: 'gcj02', location: '' + res.longitude + ',' + res.latitude + '', success: function(e) { - that.addressInfor.address = e[0].regeocodeData.name + console.log(e) + that.addressInfor.address = `${ e[0].desc } ��� ${e[0].name}` that.addressInfor.latitude = e[0].latitude that.addressInfor.longitude = e[0].longitude that.addressInfor.name = e[0].desc - that.form.pollutePosition = e[0].regeocodeData.formatted_address + that.form.pollutePosition = `${ e[0].desc } ��� ${e[0].name}` }, fail: res => { console.log(JSON.stringify(res)) -- Gitblit v1.8.0