From da25434b85fc5b4321c429bf95e719d00ec395bb Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 11 Jan 2024 16:21:16 +0800
Subject: [PATCH] 定位优化

---
 pages/actionChange/newPage/index.vue |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/pages/actionChange/newPage/index.vue b/pages/actionChange/newPage/index.vue
index bd696c2..26a9a96 100644
--- a/pages/actionChange/newPage/index.vue
+++ b/pages/actionChange/newPage/index.vue
@@ -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