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] 地图及部分配置修改
---
store/actions.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 48 insertions(+), 5 deletions(-)
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) => {
--
Gitblit v1.9.3