From 0af472703f8ffc5b548b6ed2f337f72b844b888e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 28 Feb 2022 16:03:24 +0800
Subject: [PATCH] 地图位置获取重新修改

---
 pages/registerUser/registerUser.vue |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index 0ba084c..3fed9b6 100644
--- a/pages/registerUser/registerUser.vue
+++ b/pages/registerUser/registerUser.vue
@@ -29,14 +29,21 @@
 
 			<u-form-item v-show="jobValue == '有'" label="工作地点" prop="xq" left-icon="map-fill" label-width="200"
 				:required="true">
-				<u-input v-model="form.xq" type="select" placeholder="请选择工作地点" :border="true"
-					@click="regionClick()" />
+				<u-field :disabled="true" style="width: 100%;" label-width="0" v-model="form.xq" type="textarea"
+					placeholder="请选择工作地点" :fixed="true">
+					<u-icon @click="regionClick" name="map-fill" slot="right" size="44" label="定位" label-pos="bottom"
+						label-color="#103289" color="#103289"></u-icon>
+				</u-field>
 			</u-form-item>
 
 			<u-form-item label="居住地" prop="address" left-icon="map" label-width="200" :required="true">
-				<u-input v-model="form.address" type="select" placeholder="请选择居住地" :border="true"
-					@click="placeClick()" />
+				<u-field :disabled="true" style="width: 100%;" label-width="0" v-model="form.address" type="textarea"
+					placeholder="请选择居住地" :fixed="true">
+					<u-icon @click="placeClick" name="map-fill" slot="right" size="44" label="定位" label-pos="bottom"
+						label-color="#103289" color="#103289"></u-icon>
+				</u-field>
 			</u-form-item>
+
 			<u-form-item label="性别" label-width="200" left-icon="man">
 				<u-radio-group v-model="form.sex">
 					<u-radio v-for="(item, index) in sex" :key="index" :name="item.name" :disabled="item.disabled">
@@ -98,6 +105,13 @@
 			};
 
 			return {
+				// 工作地点经纬度
+				jobLng: '',
+				jobLat: '',
+				// 居住地经纬度
+				liveLng: '',
+				liveLat: '',
+
 				userConsent: false,
 				jobValue: '无',
 				jobList: [{
@@ -226,7 +240,6 @@
 						trigger: ['change', 'blur'],
 					}, {
 						validator: (rule, value, callback) => {
-							console.log(this.form.pass, value)
 							if (this.form.pass == value) {
 								return true
 							} else {
@@ -331,14 +344,15 @@
 				//监听事件
 				uni.$on('getLocation', (res) => {
 					that.form.xq = res.mapLocationName
-					this.form.workjurisdiction = res.regionID
+					that.form.workjurisdiction = res.regionID
+					that.jobLng = res.mapLocationLongitude
+					that.jobLat = res.mapLocationLatitude
 					//清除监听,不清除会消耗资源
 					uni.$off('getLocation');
-
 				})
 
 				uni.navigateTo({
-					url: '/pages/registerUser/map'
+					url: '/pages/registerUser/map?lng=' + that.jobLng + '&lat=' + that.jobLat,
 				});
 			},
 			placeClick() {
@@ -347,14 +361,16 @@
 				//监听事件
 				uni.$on('getLocation', (res) => {
 					that.form.address = res.mapLocationName
-					this.form.jurisdiction = res.regionID
+					that.form.jurisdiction = res.regionID
+					that.liveLng = res.mapLocationLongitude
+					that.liveLat = res.mapLocationLatitude
 					//清除监听,不清除会消耗资源
 					uni.$off('getLocation');
-
 				})
 
 				uni.navigateTo({
-					url: '/pages/registerUser/map'
+					// url: '/pages/registerUser/map'
+					url: '/pages/registerUser/map?lng=' + that.liveLng + '&lat=' + that.liveLat
 				});
 			},
 			zc() {
@@ -435,7 +451,6 @@
 					method: 'POST',
 					data: data,
 					success: (result) => {
-						console.log(result, 456)
 						uni.showToast({
 							title: '注册成功,请等待审核',
 							icon: 'none',
@@ -468,7 +483,6 @@
 		},
 		watch: {
 			faceState() {
-				// console.log(this.faceState);
 				if (this.faceState == -1) {
 					this.facebc = '#ff7f29';
 					this.faceco = '#fff';

--
Gitblit v1.9.3