From d9d6eb93b6964b3eb3015d959cb70b6c6aeb2e51 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 28 Feb 2022 09:14:27 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/qfqk-android

---
 pages/registerUser/registerUser.vue |  291 +++++++++++++-----------------------
 pages.json                          |    8 +
 pages/registerUser/map-副本.vue       |    3 
 static/img/location.png             |    0 
 pages/registerUser/map.vue          |  132 ++++++++++++++++
 5 files changed, 249 insertions(+), 185 deletions(-)

diff --git a/pages.json b/pages.json
index 8536089..5a8874d 100644
--- a/pages.json
+++ b/pages.json
@@ -26,6 +26,14 @@
 			}
 		},
 		{
+			"path": "pages/registerUser/map",
+			"name": "registerUserMap",
+			"style": {
+				"navigationStyle": "custom", // 隐藏系统导航栏
+				"navigationBarTextStyle": "white" // 状态栏字体为白色,只能为 white-白色,black-黑色 二选一
+			}
+		},
+		{
 			"path": "pages/registerUser/idphoto",
 			"style": {
 				"navigationBarTitleText": "人脸识别",
diff --git "a/pages/registerUser/map-\345\211\257\346\234\254.vue" "b/pages/registerUser/map-\345\211\257\346\234\254.vue"
index 3ac2956..debae26 100644
--- "a/pages/registerUser/map-\345\211\257\346\234\254.vue"
+++ "b/pages/registerUser/map-\345\211\257\346\234\254.vue"
@@ -1,6 +1,7 @@
 <template>
 	<view class="registerUser">
-		<map style="width:100%;height:85vh;" :latitude="latitude" :polyline="polyline" :longitude="longitude"></map>
+		<map style="width:100%;height:85vh;" :latitude="latitude" :polyline="polyline" :longitude="longitude"
+			:markers="markers"></map>
 	</view>
 </template>
 
diff --git a/pages/registerUser/map.vue b/pages/registerUser/map.vue
new file mode 100644
index 0000000..a02591f
--- /dev/null
+++ b/pages/registerUser/map.vue
@@ -0,0 +1,132 @@
+<template>
+	<view class="content">
+		<u-navbar height="44" :is-back="false" title="获取地址" title-color="#fff" :background="{background: '#103289'}">
+			<u-button class="slot-wrap" type="primary" size="mini" @click="returnPage">确定</u-button>
+		</u-navbar>
+		<map id="SignLocationMap"
+			style="position: absolute; left: 0; width: 100%; z-index: 99;"
+			:style="{height: screenHeight + 'px'}"
+			@regionchange="regionChange" :latitude="latitude" :longitude="longitude" :scale="scale">
+
+			<cover-view class="dingwBut">
+				<cover-image class="location-log" src="../../static/img/location.png">
+				</cover-image>
+			</cover-view>
+		</map>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				screenHeight: 0,
+				mapLocationName: '',
+				mapLocationLatitude: '',
+				mapLocationLongitude: '',
+
+				regionID: '',
+
+				latitude: 28.678983439095823,
+				longitude: 115.84414205551147,
+				scale: 15 //缩放级别
+			}
+		},
+		onReady() {
+			var that = this
+		
+			uni.getSystemInfo({
+				success: function(res) {
+					console.log(res, 465)
+					that.screenHeight = res.windowHeight - 44
+				}
+			})
+		},
+		methods: {
+			regionChange() { // 移动地图后重新获取门店
+				var that = this
+				uni.createMapContext('SignLocationMap', this).getCenterLocation({
+					success: res => {
+						that.getLocationInfor(res.longitude, res.latitude)
+					},
+					fail: res => {
+						uni.showModal({
+							content: '获取位置失败',
+							showCancel: false
+						})
+					}
+				})
+			},
+
+			getLocationInfor(longitude, latitude) {
+				var that = this
+				var point = new plus.maps.Point(longitude, latitude);
+				plus.maps.Map.reverseGeocode(
+					point, {},
+					function(event) {
+						var address = event.address; // 转换后的地理位置
+						var point = event.coord; // 转换后的坐标信息
+						var coordType = event.coordType; // 转换后的坐标系类型
+
+
+						that.mapLocationName = address
+						that.mapLocationLongitude = point.longitude
+						that.mapLocationLatitude = point.latitude
+
+					},
+					function(e) {}
+				);
+			},
+			
+			returnPage() {
+				console.log(1)
+				var that = this
+				uni.$emit('getLocation', {
+					mapLocationName: that.mapLocationName,
+					regionID: that.regionID
+				});
+				//关闭当前窗口
+				uni.navigateBack({});
+			}
+
+		},
+		watch: {
+
+
+		}
+	};
+</script>
+</script>
+
+<style lang="scss" scoped>
+	.slot-wrap {
+		position: absolute;
+		top: 0;
+		left: auto;
+		right: 10px;
+		bottom: 0;
+		margin: auto;
+		color: #fff;
+		/* 如果您想让slot内容占满整个导航栏的宽度 */
+		/* flex: 1; */
+		/* 如果您想让slot内容与导航栏左右有空隙 */
+		/* padding: 0 30rpx; */
+	}
+
+	.dingwBut {
+		width: 48px;
+		height: 48px;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		margin: auto;
+		z-index: 9999;
+		transform: translateY(-22px);
+	}
+
+</style>
diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index 270e164..0ba084c 100644
--- a/pages/registerUser/registerUser.vue
+++ b/pages/registerUser/registerUser.vue
@@ -10,26 +10,32 @@
 				<u-select v-model="show" mode="mutil-column-auto" :list="roleList" @confirm="radioGroupChange">
 				</u-select>
 			</u-form-item>
-			<u-form-item v-show="form.role == '民警'" label=" " prop="warnNum" label-width="200" :required="true">
-				<u-input v-model="form.warnNum" placeholder="请输入警号" />
+			<u-form-item v-show="form.role == '民警'" label="警号" prop="signals" left-icon="edit-pen" label-width="200"
+				:required="true">
+				<u-input v-model="form.signals" placeholder="请输入警号" />
 			</u-form-item>
-			<u-form-item label="工作单位" left-icon="home-fill" label-width="200" :required="false">
+			<u-form-item label="工作单位" left-icon="home-fill" label-width="200" :required="true">
 				<u-radio-group v-model="jobValue">
 					<u-radio v-for="(item, index) in jobList" :key="index" :name="item.name" :disabled="item.disabled">
 						{{item.name}}
 					</u-radio>
 				</u-radio-group>
 			</u-form-item>
-			<u-form-item v-show="jobValue == '有'" label=" " prop="obj" label-width="200" :required="false">
-				<u-input v-model="form.obj" placeholder="请输入工作单位" />
+
+			<u-form-item v-show="jobValue == '有'" label="单位名称" prop="jobUnit" label-width="200" left-icon="home"
+				:required="true">
+				<u-input v-model="form.jobUnit" placeholder="请输入单位名称" />
 			</u-form-item>
-			<u-form-item 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-select v-model="regionShow" mode="mutil-column-auto" :list="regionList" @confirm="regionSelect">
-				</u-select>
+
+			<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-form-item>
-			<u-form-item label="居住地" prop="address" left-icon="map" label-width="200" :required="false">
-				<u-input v-model="form.address" placeholder="居住地" />
+
+			<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-form-item>
 			<u-form-item label="性别" label-width="200" left-icon="man">
 				<u-radio-group v-model="form.sex">
@@ -38,7 +44,7 @@
 					</u-radio>
 				</u-radio-group>
 			</u-form-item>
-			<u-form-item label="是否人脸登录" label-width="240" left-icon="server-man">
+			<!-- <u-form-item label="是否人脸登录" label-width="240" left-icon="server-man">
 				<u-radio-group v-model="radioValue">
 					<u-radio v-for="(item, index) in radioList" :key="index" :name="item.name"
 						:disabled="item.disabled">
@@ -46,7 +52,7 @@
 					</u-radio>
 				</u-radio-group>
 				(功能研发中)
-			</u-form-item>
+			</u-form-item> -->
 		</u-form>
 
 		<view class="agree">
@@ -57,23 +63,9 @@
 				<text class="a" @click="agreement(1)">隐私政策</text>
 			</u-checkbox>
 		</view>
-		<div class="login-map-bc" v-if="mapShow">
-			<div @click="mapShow = false">
-
-			</div>
-			<div class="login-map-content">
-				<u-icon class="login-map-close" name="close" @click="mapShow = false"></u-icon>
-
-				<view style="width: 100%; height: 100%; position: absolute; ">
-					<web-view :src="loginMapUrl"></web-view>
-				</view>
-			</div>
-		</div>
 
 		<u-button class="submit" @click="zc">
 			注册</u-button>
-
-		<!-- <u-button class="submit" @click="submit">提交</u-button> -->
 	</view>
 </template>
 
@@ -117,8 +109,6 @@
 						disabled: false
 					}
 				],
-				regionName: '',
-				loginMapUrl: "",
 				radioList: [{
 						name: '是',
 						disabled: false
@@ -129,28 +119,7 @@
 					}
 				],
 				radioValue: '否',
-				mapShow: false,
-				latitude: 28.68, //纬度
-				longitude: 115.85, //经度
-				scale: 12, //缩放级别
-				polyline: [
-					// 	{ //指定一系列坐标点,从数组第一项连线至最后一项
-					// 	points: [{
-					// 			latitude: 34.79977,
-					// 			longitude: 113.66072
-					// 		},
-					// 		{
-					// 			latitude: 34.795541,
-					// 			longitude: 113.681646
-					// 		},
-					// 	],
-					// 	color: "#0000AA", //线的颜色
-					// 	width: 1, //线的宽度
-					// 	//     dottedLine:true,//是否虚线
-					// 	arrowLine: true, //带箭头的线 开发者工具暂不支持该属性
-					// },
-				],
-				marker: [],
+
 				show: false,
 				showxq: false,
 				listbm: [],
@@ -219,13 +188,13 @@
 					carId: '',
 					phone: '',
 					sex: '男',
-					obj: '',
-					objId: '',
 					xq: '',
-					xqobjId: '',
+					jurisdiction: '',
 					jsid: '',
 					address: '',
-					warnNum: '',
+					jobUnit: '',
+					signals: '',
+					workjurisdiction: ''
 				},
 				rules: {
 					user: [{
@@ -274,9 +243,9 @@
 						// 可以单个或者同时写两个触发验证方式 
 						trigger: ['change', 'blur'],
 					}],
-					obj: [{
-						required: false,
-						message: '请输入工作单位',
+					jobUnit: [{
+						required: true,
+						message: '请输入单位名称',
 						// 可以单个或者同时写两个触发验证方式 
 						trigger: ['change', 'blur'],
 					}],
@@ -292,7 +261,7 @@
 						// 可以单个或者同时写两个触发验证方式 
 						trigger: ['change', 'blur'],
 					}],
-					warnNum: [{
+					signals: [{
 						required: true,
 						message: '请输入警号',
 						// 可以单个或者同时写两个触发验证方式 
@@ -348,56 +317,6 @@
 						value: "1495714378025480193"
 					}
 				],
-				regionList: [{
-						label: '东湖区',
-						value: '1415619841521414145'
-					},
-					{
-						label: '西湖区',
-						value: '1415619917295710209'
-					},
-					{
-						label: '青云谱区',
-						value: '1415619986417840129'
-					},
-					{
-						label: '湾里区',
-						value: '1415620058526314497'
-					},
-					{
-						label: '青山湖区',
-						value: '1415620118307729409'
-					},
-					{
-						label: '新建区',
-						value: '1415620188289691649'
-					},
-					{
-						label: '南昌县',
-						value: '1415620235718881282'
-					},
-					{
-						label: '安义县',
-						value: '1415620288487419906'
-					},
-					{
-						label: '进贤县',
-						value: '1415620344112279553'
-					},
-					{
-						label: '经济技术开发区区',
-						value: '1415620404103409666'
-					},
-					{
-						label: '红谷滩区',
-						value: '1415620472965492738'
-					},
-					{
-						label: '高新技术开发区',
-						value: '1415620707473223681'
-					}
-				],
-				regionShow: false
 			};
 		},
 		methods: {
@@ -407,13 +326,36 @@
 				});
 			},
 			regionClick() {
-				this.regionShow = true;
-			},
-			regionSelect(e) {
-				this.form.xq = e[0].label
-				this.form.xqobjId = e[0].value
+				let that = this;
 
-				this.regionShow = false;
+				//监听事件
+				uni.$on('getLocation', (res) => {
+					that.form.xq = res.mapLocationName
+					this.form.workjurisdiction = res.regionID
+					//清除监听,不清除会消耗资源
+					uni.$off('getLocation');
+
+				})
+
+				uni.navigateTo({
+					url: '/pages/registerUser/map'
+				});
+			},
+			placeClick() {
+				let that = this;
+
+				//监听事件
+				uni.$on('getLocation', (res) => {
+					that.form.address = res.mapLocationName
+					this.form.jurisdiction = res.regionID
+					//清除监听,不清除会消耗资源
+					uni.$off('getLocation');
+
+				})
+
+				uni.navigateTo({
+					url: '/pages/registerUser/map'
+				});
 			},
 			zc() {
 				if (this.userConsent == false) {
@@ -422,7 +364,7 @@
 						icon: 'none',
 						duration: 2000
 					});
-					
+
 					return
 				}
 				var that = this;
@@ -444,40 +386,8 @@
 							return
 
 						}
-						var d = that.form;
-						var url = that.$store.state.piAPI + '/zc/inster',
-							data = {
-								// deptid: ,
-								password: d.pass,
-								password2: d.passTwo,
-								phone: d.phone,
-								sex: d.sex == '男' ? 1 : 2,
-								sname: d.name,
-								username: d.user,
-								deptid: d.objId,
-								parentId: d.jsid,
-								jurisdiction: d.xqobjId,
-								cardid: d.carId,
-								address: d.address,
-								workunit: d.obj
-							}
-						uni.request({
-							url: url,
-							method: 'POST',
-							data: data,
-							success: (res) => {
-								uni.showToast({
-									title: '注册成功,请等待审核',
-									icon: 'none',
-									duration: 2000
-								});
-								setTimeout(function() {
-									uni.navigateTo({
-										url: '/pages/loging/loging'
-									})
-								}, 2000);
-							}
-						});
+
+						that.registerEvent()
 
 						// that.$refs.uForm.validate(valid => {
 						// 	if (valid) {
@@ -494,6 +404,53 @@
 				});
 
 			},
+
+			registerEvent() {
+				var d = this.form;
+				var url = this.$store.state.piAPI + '/zc/inster',
+					data = {
+						// deptid: ,
+						password: d.pass,
+						password2: d.passTwo,
+						phone: d.phone,
+						sex: d.sex == '男' ? 1 : 2,
+						sname: d.name,
+						username: d.user,
+						parentId: d.jsid,
+						cardid: d.carId,
+						// 居住地址
+						address: d.address,
+						// 单位名称
+						jobUnit: d.jobUnit,
+						// 居住辖区
+						jurisdiction: d.jurisdiction,
+						// 工作地址
+						workaddress: d.xq,
+						// 工作辖区
+						workjurisdiction: d.workjurisdiction,
+						signals: d.signals
+					}
+				uni.request({
+					url: url,
+					method: 'POST',
+					data: data,
+					success: (result) => {
+						console.log(result, 456)
+						uni.showToast({
+							title: '注册成功,请等待审核',
+							icon: 'none',
+							duration: 2000
+						});
+						setTimeout(function() {
+							uni.navigateTo({
+								url: '/pages/loging/loging'
+							})
+						}, 2000);
+					}
+				});
+
+			},
+
 			depl() {
 				this.show = true;
 			},
@@ -533,40 +490,6 @@
 </script>
 
 <style lang="scss" scoped>
-	.login-map-bc {
-		position: fixed;
-		top: 0;
-		left: 0;
-		width: 100%;
-		height: 100%;
-		z-index: 111;
-		background: rgba(0, 0, 0, .3);
-	}
-
-	.login-map-content {
-		position: fixed;
-		bottom: 0;
-		left: 0;
-		width: 100%;
-		height: 100%;
-		z-index: 222;
-		border-radius: 15px 15px 0 0;
-		overflow: hidden;
-
-		iframe {
-			border: none;
-		}
-	}
-
-	.login-map-close {
-		position: absolute;
-		top: 10px;
-		right: 10px;
-		width: 20px;
-		height: 20px;
-		z-index: 11;
-	}
-
 	.warp {
 		display: flex;
 		align-items: center;
diff --git a/static/img/location.png b/static/img/location.png
new file mode 100644
index 0000000..3017082
--- /dev/null
+++ b/static/img/location.png
Binary files differ

--
Gitblit v1.9.3