From eaa83986e35d478bdfef55b49941fc6b4b86d95e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 13 Aug 2021 09:46:23 +0800
Subject: [PATCH] 地图及部分配置修改

---
 pages/login/login-account.vue |    2 
 pages/report/initiate.vue     |   14 +++-
 pages.json                    |    4 
 pages/map/map.vue             |    4 
 pages/dispatch/imgissue.vue   |   14 +++-
 pages/examine/addpeople.vue   |   16 +++--
 template.h5.html              |    6 +
 pages/dispatch/issue.vue      |   14 +++-
 pages/examine/addunit.vue     |   14 +++-
 mapWz/js/vueMain.js           |   37 ++++--------
 store/actions.js              |   53 ++++++++++++++++-
 11 files changed, 116 insertions(+), 62 deletions(-)

diff --git a/mapWz/js/vueMain.js b/mapWz/js/vueMain.js
index ea6babe..0385bd7 100644
--- a/mapWz/js/vueMain.js
+++ b/mapWz/js/vueMain.js
@@ -25,7 +25,7 @@
         resultFeedbackPopupShow: false,
         popupDisplay: "none",
         userId: null,
-
+        geolocation: null
     },
     methods: {
 
@@ -44,7 +44,7 @@
                             resultData.push(item)
                         }
                     })
-                } 
+                }
 
                 this.map = this.beginMap(this.map, resultData); //创建并接受map
                 this.move = new myDomMove('#seedata', '.title', '#map');
@@ -62,7 +62,8 @@
             return null;
         },
         beginMap(map, data) {
-            var that = this, center = [28.708432053474827, 115.85883507433789];
+            var that = this,
+                center = [28.708432053474827, 115.85883507433789];
             // url = `http://s16s652780.51mypc.cn/api/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
             // url = `http://localhost:89/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
             this.nowPosition = center;
@@ -170,6 +171,10 @@
 
             });
             this.nowPosition = center;
+
+
+            this.getLocationData(this.geolocation);
+
             return map; //抛出map
         },
         getDHLine(x, y) {
@@ -316,9 +321,8 @@
         upData() {
             console.log('上传信息成功')
         },
-        getLocationData() {
+        getLocationData(geolocation) {
             var that = this;
-            var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
             var positionNum = 0;
             var options = {
                 timeout: 8000
@@ -331,22 +335,6 @@
                 var addr = position.addr; //详细地址
                 that.lat = position.lat; //
                 that.lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑 
-
-
-                console.log(adCode, position, addr, 15145)
-
-
-                axios.post("http://223.82.109.183:2080/api/liveLocation/saveLiveLocationAndLocus", {
-                    type: 1,
-                    workerId: that.userId,
-                    longitude: position.lng,
-                    latitude: position.lat,
-                    location: addr == '' ? position.province + position.city : addr
-                }).then((res) => {
-
-                    console.log(res, 4848)
-
-                })
 
                 if (that.LXdhStart != null) {
                     that.map.removeLayer(that.LXdhStart);
@@ -384,16 +372,17 @@
     },
     created() {},
     mounted() {
+        this.geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
+
         this.beginCome();
-        this.getLocationData();
 
         var that = this;
 
         setInterval(() => {
 
-            that.getLocationData();
+            that.getLocationData(that.geolocation);
 
-        }, 10000);
+        }, 30000);
     },
     wacth: {}
 })
\ No newline at end of file
diff --git a/pages.json b/pages.json
index 159af86..b03b300 100644
--- a/pages.json
+++ b/pages.json
@@ -436,13 +436,13 @@
 				"pagePath": "pages/groupChat/groupChat",
 				"iconPath": "static/images/tabbar/demo.png",
 				"selectedIconPath": "static/images/tabbar/demo_selected.png",
-				"text": "好友"
+				"text": "聊天"
 			},
 			{
 				"pagePath": "pages/manage/manage",
 				"iconPath": "static/images/tabbar/manage.png",
 				"selectedIconPath": "static/images/tabbar/manage_selected.png",
-				"text": "管理"
+				"text": "工作台"
 			},
 			{
 				"pagePath": "pages/user/center",
diff --git a/pages/dispatch/imgissue.vue b/pages/dispatch/imgissue.vue
index 780a22b..9a40658 100644
--- a/pages/dispatch/imgissue.vue
+++ b/pages/dispatch/imgissue.vue
@@ -98,14 +98,18 @@
 
 			},
 			recipientConfirm(e) {
-				if (e.length > 1) {
-					this.form.recipient = e[1].value
-					this.form.recipientText = e[1].label
-				} else {
+				
+				if (e.length == 1) {
 					this.form.recipient = e[0].value
 					this.form.recipientText = e[0].label
+				} else if (e.length == 2) {
+					this.form.recipient = e[1].value
+					this.form.recipientText = e[1].label
+				} else if (e.length == 3) {
+					this.form.recipient = e[2].value
+					this.form.recipientText = e[2].label
 				}
-
+				
 			},
 			initiateClick() {
 				var imgurl = '';
diff --git a/pages/dispatch/issue.vue b/pages/dispatch/issue.vue
index 6af67ef..2fa0e90 100644
--- a/pages/dispatch/issue.vue
+++ b/pages/dispatch/issue.vue
@@ -90,14 +90,18 @@
 
 			},
 			recipientConfirm(e) {
-				if (e.length > 1) {
-					this.form.recipient = e[1].value
-					this.form.recipientText = e[1].label
-				} else {
+				
+				if (e.length == 1) {
 					this.form.recipient = e[0].value
 					this.form.recipientText = e[0].label
+				} else if (e.length == 2) {
+					this.form.recipient = e[1].value
+					this.form.recipientText = e[1].label
+				} else if (e.length == 3) {
+					this.form.recipient = e[2].value
+					this.form.recipientText = e[2].label
 				}
-
+				
 			},
 			initiateClick() {
 				this.$refs.uForm.validate(valid => {
diff --git a/pages/examine/addpeople.vue b/pages/examine/addpeople.vue
index 0ca39d8..5725dd3 100644
--- a/pages/examine/addpeople.vue
+++ b/pages/examine/addpeople.vue
@@ -126,15 +126,17 @@
 
 			peopleConfirm(e) {
 				
-				if (e.length > 1) {
-					this.form.people = e[1].value
-					this.form.peopleText = e[1].label
-					
-					this.form.unitText = e[0].label
-					
-				} else {
+				if (e.length == 1) {
 					this.form.people = e[0].value
 					this.form.peopleText = e[0].label
+				} else if (e.length == 2) {
+					this.form.people = e[1].value
+					this.form.peopleText = e[1].label
+					this.form.unitText = e[0].label
+				} else if (e.length == 3) {
+					this.form.people = e[2].value
+					this.form.peopleText = e[2].label
+					this.form.unitText = e[1].label
 				}
 
 			},
diff --git a/pages/examine/addunit.vue b/pages/examine/addunit.vue
index 4b1273a..6419a71 100644
--- a/pages/examine/addunit.vue
+++ b/pages/examine/addunit.vue
@@ -51,7 +51,7 @@
 	export default {
 		components: {
 			seeImgs
-		},	
+		},
 		data() {
 			return {
 
@@ -125,12 +125,16 @@
 			},
 
 			unitConfirm(e) {
-				if (e.length > 1) {
-					this.form.unit = e[1].value
-					this.form.unitText = e[1].label
-				} else {
+				
+				if (e.length == 1) {
 					this.form.unit = e[0].value
 					this.form.unitText = e[0].label
+				} else if (e.length == 2) {
+					this.form.unit = e[1].value
+					this.form.unitText = e[1].label
+				} else if (e.length == 3) {
+					this.form.unit = e[2].value
+					this.form.unitText = e[2].label
 				}
 
 			},
diff --git a/pages/login/login-account.vue b/pages/login/login-account.vue
index 276e7ad..033e5b7 100644
--- a/pages/login/login-account.vue
+++ b/pages/login/login-account.vue
@@ -90,7 +90,7 @@
 			},
 			judgeMsg() {
 				this.msg = this.names == '' ? (this.passwords == '' ? '账号密码不能为空' : '账号不能为空') : (this.passwords == '' ?
-					'密码不能为空' : this.passwords.length <= 5 ? '密码最少6位' :
+					'密码不能为空' : this.passwords.length <= 4 ? '密码最少6位' :
 					'格式正确');
 				if (this.msg == "格式正确") {
 					this.icons = 'success';
diff --git a/pages/map/map.vue b/pages/map/map.vue
index 51d5a86..b185dfd 100644
--- a/pages/map/map.vue
+++ b/pages/map/map.vue
@@ -16,8 +16,8 @@
 		mounted() {},
 		onLoad: function(options) {
 			
-			this.urls = "http://web.byisf.com/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
-			// this.urls = "http://127.0.0.1:5500/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
+			// this.urls = "http://web.byisf.com/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
+			this.urls = "http://127.0.0.1:5500/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
 			
 		},
 	}
diff --git a/pages/report/initiate.vue b/pages/report/initiate.vue
index 6d136db..ca7e4c7 100644
--- a/pages/report/initiate.vue
+++ b/pages/report/initiate.vue
@@ -175,14 +175,18 @@
 				this.form.typeText = e[0].label
 			},
 			recipientConfirm(e) {
-				if (e.length > 1) {
-					this.form.recipient = e[1].value
-					this.form.recipientText = e[1].label
-				} else {
+				
+				if (e.length == 1) {
 					this.form.recipient = e[0].value
 					this.form.recipientText = e[0].label
+				} else if (e.length == 2) {
+					this.form.recipient = e[1].value
+					this.form.recipientText = e[1].label
+				} else if (e.length == 3) {
+					this.form.recipient = e[2].value
+					this.form.recipientText = e[2].label
 				}
-
+				
 			},
 			initiateClick() {
 				this.$refs.uForm.validate(valid => {
diff --git a/store/actions.js b/store/actions.js
index 99d89d0..6f50a66 100644
--- a/store/actions.js
+++ b/store/actions.js
@@ -1,5 +1,41 @@
 import md5 from 'js-md5'
 import axios from 'axios'
+
+const geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
+
+const getLocationData = (userId) => {
+	var positionNum = 0;
+	var options = {
+		timeout: 8000
+	};
+
+	function showPosition(position) {
+		var adCode = position.adCode; //邮政编码
+		var nation = position.nation; //中国
+		var city = position.city; //城市
+		var addr = position.addr; //详细地址
+
+		axios.post("http://223.82.109.183:2080/api/liveLocation/saveLiveLocationAndLocus", {
+			type: 1,
+			workerId: userId,
+			longitude: position.lng,
+			latitude: position.lat,
+			location: addr == '' ? position.province + position.city : position.province + position.city +
+				addr
+		}).then((res) => {
+
+		})
+
+	};
+
+	function showErr() {
+		//TODO 如果出错了调用此方法 
+	};
+
+	geolocation.getLocation(showPosition, showErr, options);
+
+};
+
 const actions = {
 	loging(store, data) {
 		var user = [{
@@ -63,12 +99,19 @@
 					data.accounts = data.name;
 					data.pass = data.pass;
 					// data.userPhon = res.user_id;
-			
+
+
+					setInterval(function() {
+							getLocationData(res.data.user_id);
+						},
+						30000)
+
 					uni.request({
-						url: "http://223.82.109.183:2080/api/blade-system/dept/detail?id=" + res.data.dept_id,
+						url: "http://223.82.109.183:2080/api/blade-system/dept/detail?id=" + res
+							.data.dept_id,
 						method: "get",
 						data: {
-					
+
 						},
 						success: (result) => {
 							data.deptName = result.data.data.deptName
@@ -77,8 +120,8 @@
 							uni.$u.func.login(res.data)
 						}
 					});
-					
-					
+
+
 				}
 			},
 			fail: (res) => {
diff --git a/template.h5.html b/template.h5.html
index 383b1b5..a2ba1f1 100644
--- a/template.h5.html
+++ b/template.h5.html
@@ -4,7 +4,8 @@
 		<meta charset="utf-8">
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">
-		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+		<meta name="viewport"
+			content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 		<title>
 			<%= htmlWebpackPlugin.options.title %>
 		</title>
@@ -13,6 +14,9 @@
 				document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
 			})
 		</script>
+		<!-- 百度地图api -->
+		<script type="text/javascript" src="https://mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js">
+		</script>
 		<link rel="stylesheet" href="<%= BASE_URL %>static/index.css" />
 	</head>
 	<body>

--
Gitblit v1.9.3