From fd8aa3546f4f089ff0cea735c921d1b2f76aca31 Mon Sep 17 00:00:00 2001
From: Lou <luzhiping@qqyjz.com>
Date: Wed, 03 Apr 2024 17:34:59 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jczz_app

---
 pages/home/index.vue               |   26 +++++++++----
 subPackage/police/onLine.vue       |   14 ++-----
 api/police/policTrajectoryPoint.js |   49 ++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 18 deletions(-)

diff --git a/api/police/policTrajectoryPoint.js b/api/police/policTrajectoryPoint.js
new file mode 100644
index 0000000..57512c4
--- /dev/null
+++ b/api/police/policTrajectoryPoint.js
@@ -0,0 +1,49 @@
+import http from '@/http/api.js'
+
+export const getList = (current, size, params) => {
+	return http.request({
+		url: '/blade-policTrajectoryPoint/policTrajectoryPoint/list',
+		method: 'get',
+		params: {
+			...params,
+			current,
+			size,
+		}
+	})
+}
+
+export const getDetail = (id) => {
+	return http.request({
+		url: '/blade-policTrajectoryPoint/policTrajectoryPoint/detail',
+		method: 'get',
+		params: {
+			id
+		}
+	})
+}
+
+export const remove = (ids) => {
+	return http.request({
+		url: '/blade-policTrajectoryPoint/policTrajectoryPoint/remove',
+		method: 'post',
+		params: {
+			ids,
+		}
+	})
+}
+
+export const add = (row) => {
+	return http.request({
+		url: '/blade-policTrajectoryPoint/policTrajectoryPoint/submit',
+		method: 'post',
+		data: row
+	})
+}
+
+export const update = (row) => {
+	return http.request({
+		url: '/blade-policTrajectoryPoint/policTrajectoryPoint/submit',
+		method: 'post',
+		data: row
+	})
+}
\ No newline at end of file
diff --git a/pages/home/index.vue b/pages/home/index.vue
index e772ccc..49c9c2a 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -306,6 +306,10 @@
 		getUser,
 		updateUserInfo
 	} from "@/api/user.js"
+
+	import {
+		add as addPolicTrajectoryPoint
+	} from "@/api/police/policTrajectoryPoint.js"
 	import {
 		getPage
 	} from "@/api/article/article";
@@ -1340,13 +1344,11 @@
 										success: (tip) => {
 											if (tip.confirm) {
 												uni.openSetting({
-													success: (
-														data) => {
+													success: (data) => {
 														if (data
 															.authSetting[
 																"scope.userLocationBackground"
-															] ==
-															true
+															] == true
 														) {
 															this
 																.getBackgroundLocation();
@@ -1389,10 +1391,9 @@
 				if (wx.onLocationChange && this.userGPS != false) {
 					wx.onLocationChange((data) => {
 						console.log('onLocationChange***************', data)
-
 						//微信开发工具上面只能触发一次,真机上面是循环获取
-						//设置一个公共时间,原因是时间间隔太短,自己设置时间,然后去操作相应的逻辑
-						if (this.time == 11) {
+						//设置一个公共时间,原因是时间间隔太短,自己设置时间,然后去操作相应的逻辑,速度大于0
+						if (this.time == 10 && data.speed >= 0) {
 							// 调取实时位置
 							this.reportLocation(this.location);
 							this.time = 0;
@@ -1414,7 +1415,16 @@
 				updateUserInfo(param).then(res => {
 					console.log(res)
 				})
-				console.log('********************location****************************************', location)
+				// let params = {
+				// 	userId: uni.getStorageSync("userInfo").user_id,
+				// 	deptId: uni.getStorageSync("userInfo").dept_id,
+				// 	longitude: location.longitude,
+				// 	latitude: location.latitude,
+				// }
+				location.userId = uni.getStorageSync("userInfo").user_id
+				addPolicTrajectoryPoint(location).then(res => {
+					console.log(res)
+				})
 			},
 
 
diff --git a/subPackage/police/onLine.vue b/subPackage/police/onLine.vue
index 0732afa..b7bfbc3 100644
--- a/subPackage/police/onLine.vue
+++ b/subPackage/police/onLine.vue
@@ -79,7 +79,10 @@
 								this.userInfo.status = 1
 							}
 							updateUserInfo(this.userInfo).then(res => {
-								console.log(res)
+								console.log("**********userInfo*************", res)
+								let userInfo = uni.getStorageSync("userInfo")
+								userInfo.status = this.userInfo.status
+								uni.setStorageSync("userInfo", userInfo)
 							})
 						}
 					}
@@ -97,16 +100,7 @@
 					} else {
 						this.onLine = false
 					}
-					// console.log(data)
 				});
-
-				// data.forEach((item, index) => {
-				// 	if (item.roleName == "居民") {
-				// 		item.icon = "/static/icon/user-01.png"
-				// 	}
-				// })
-
-				// this.roleData = data;
 				this.loading = !this.loading
 			},
 

--
Gitblit v1.9.3