From ed9709a6e101a7f2eca4403f93e7aa4f71a78220 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 21 Feb 2022 16:25:33 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/qfqk-android
---
leafletMapOur/grabOrdersMap/js/getPosition.js | 72 ++++++++---------------------------
1 files changed, 17 insertions(+), 55 deletions(-)
diff --git a/leafletMapOur/grabOrdersMap/js/getPosition.js b/leafletMapOur/grabOrdersMap/js/getPosition.js
index 8bcbe5b..a154b87 100644
--- a/leafletMapOur/grabOrdersMap/js/getPosition.js
+++ b/leafletMapOur/grabOrdersMap/js/getPosition.js
@@ -50,7 +50,7 @@
//开始持续获取定位
let that = this;
if (val != 1) {
- console.log("开始持续定位")
+ // console.log(that.id,"开始持续定位")
this.isContinued = true;
that.once(function(res) {
if (res.state == false) {
@@ -59,7 +59,7 @@
}
})
if (this.isContinuedTimeOut) {
- console.log("重复开始持续定位")
+ // console.log("重复开始持续定位")
return;
}
}
@@ -77,11 +77,11 @@
}
}
})
- }, 5000)
+ }, 3000)
}
overContinued() {
- console.log("结束持续定位")
+ // console.log("结束持续定位")
let that = this;
if (this.isContinued) {
this.isContinued = false;
@@ -94,22 +94,15 @@
this.isContinuedTimeOut = null;
}
}
+ this.isContinued = false;
+ that.outData('out');
}
- // overContinued() {
- // console.log("结束持续定位")
- // let that = this;
- // if (this.isContinued) {
- // this.isContinued = false;
- // clearInterval(that.isContinuedTimeInt);
- // this.isContinuedTimeInt = null;
- // }
- // }
once(fn) {
- console.log("开始获取一次定位");
+ // console.log("开始获取一次定位");
this.state = true;
let ok = true;
let that = this,
- fns = fn,
+ fns = fn || '',
outit = function() {
if (fns) {
fns({
@@ -124,8 +117,8 @@
outit();
let success = function(position) {
// console.log(position);
- var lat = position.coords.latitude;
- var lon = position.coords.longitude;
+ var lat = position.coords.longitude;//经度
+ var lon = position.coords.latitude;//纬度
// console.log("成功返回经纬度信息");
// console.log(lon, lat, "成功");
that.onceNowPosition = [lat, lon];
@@ -152,7 +145,7 @@
}
that.onceNowPosition = msg;
that.state = false;
- ok = true;
+ ok = false;
outit();
};
let options = {
@@ -166,53 +159,22 @@
error,
options
);
- //高德定位
- // console.log("开始获取一次定位");
- // this.state = true;
- // let that = this;
- // that.outData();
- // AMap.plugin("AMap.Geolocation", function() {
- // var geolocation = new AMap.Geolocation({
- // // 是否使用高精度定位,默认:true
- // enableHighAccuracy: true,
- // // 设置定位超时时间,默认:无穷大
- // // timeout: 10000,
- // });
- // geolocation.getCurrentPosition();
- // AMap.event.addListener(geolocation, "complete", onComplete);
- // AMap.event.addListener(geolocation, "error", onError);
-
- // function onComplete(data) {
- // // data是具体的定位信息
- // // console.log(data);
- // var lat = data.position.lat;
- // var lon = data.position.lng;
- // // console.log("成功返回经纬度信息");
- // // console.log(lon, lat, "成功");
- // that.onceNowPosition = [lon, lat];
- // this.state = false;
- // that.outData();
- // }
-
- // function onError(data) {
- // // 定位出错
- // // console.log(data);
- // that.onceNowPosition = data;
- // this.state = false;
- // that.outData();
- // }
- // });
}
//结束获取
outInit() {
}
//抛出数据
- outData() {
+ outData(val) {
let d = {
state: this.state,
intlat: this.onceNowPosition
}
+ if (val) {
+ d[val] = val
+ }
this.fn(d)
}
}
+
+// export default $getPositions;
--
Gitblit v1.9.3