From 4efeb31d5b4921d7e851c256009486ad86bc70e2 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Tue, 21 Jun 2022 09:14:57 +0800
Subject: [PATCH] 地址替换
---
store/actions.js | 97 +++++++++++++++++++++++++++---------------------
1 files changed, 55 insertions(+), 42 deletions(-)
diff --git a/store/actions.js b/store/actions.js
index 6f50a66..f413578 100644
--- a/store/actions.js
+++ b/store/actions.js
@@ -1,41 +1,5 @@
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 = [{
@@ -52,7 +16,7 @@
},
],
pasw = md5(data.pass),
- // url = 'http://223.82.109.183:2080/api/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
+ // url = this.$store.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
url = store.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
' &password=' + pasw + '&grant_type=password&scope=all&type=account';
// url ='http://192.168.0.109:82/blade-auth/oauth/token';
@@ -80,8 +44,8 @@
method: "post",
// // dataType: 'JSON',
success: (res) => {
+
if (res.statusCode == 200) {
- console.log(res)
if (res.data.error_code == "400") {
uni.showToast({
title: '密码错误,请重试',
@@ -101,13 +65,62 @@
// data.userPhon = res.user_id;
+
+
+ // 实时定位获取得方法
+
+ uni.getLocation({
+ type: 'gcj02',
+ geocode: true,
+ success: function(wzres) {
+ uni.request({
+ url: "http://61.131.136.25:2080/api/liveLocation/saveLiveLocationAndLocus",
+ method: "post",
+ data: {
+ type: 1,
+ workerId: res.data.user_id,
+ longitude: wzres.longitude,
+ latitude: wzres.latitude,
+ location: wzres.address.country +
+ wzres.address.province + wzres
+ .address.city + wzres.address
+ .district + wzres.address
+ .street + wzres.address
+ .streetNum
+ }
+ })
+ }
+ });
+
setInterval(function() {
- getLocationData(res.data.user_id);
- },
- 30000)
+
+ uni.getLocation({
+ type: 'gcj02',
+ geocode: true,
+ success: function(wzres) {
+ uni.request({
+ url: "http://61.131.136.25:2080/api/liveLocation/saveLiveLocationAndLocus",
+ method: "post",
+ data: {
+ type: 1,
+ workerId: res.data.user_id,
+ longitude: wzres.longitude,
+ latitude: wzres.latitude,
+ location: wzres.address.country +
+ wzres.address.province + wzres
+ .address.city + wzres.address
+ .district + wzres.address
+ .street + wzres.address
+ .streetNum
+ }
+ })
+ }
+ });
+
+ }, 30000)
uni.request({
- url: "http://223.82.109.183:2080/api/blade-system/dept/detail?id=" + res
+ url: store.state.piAPI + "/blade-system/dept/detail?id=" + res
.data.dept_id,
method: "get",
data: {
--
Gitblit v1.9.3