|
@@ -1,5 +1,5 @@
|
|
|
|
|
|
-import MapHelper from "./map_helper";
|
|
|
+// import MapHelper from "./map_helper";
|
|
|
import to from 'await-to-js';
|
|
|
const UniHelper = {
|
|
|
|
|
@@ -130,32 +130,32 @@ const UniHelper = {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- getLocation(type = "gcj02") {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- uni.getLocation({
|
|
|
- geocode: true,
|
|
|
- success: async function (res) {
|
|
|
-
|
|
|
- console.log("当前位置: res", res);
|
|
|
- console.log("当前位置的经度:" + res.longitude);
|
|
|
- console.log("当前位置的纬度:" + res.latitude);
|
|
|
- let res1 = MapHelper.wgs84togcj02(res.latitude, res.longitude);
|
|
|
- res.latitude = res1.lat;
|
|
|
- res.longitude = res1.lon;
|
|
|
- res.lat = res1.lat;
|
|
|
- res.lng = res1.lon;
|
|
|
- resolve(res);
|
|
|
- // uni.showModal({
|
|
|
- // content: "当前位置的经度:" + res.longitude + "当前位置的纬度:" + res.latitude + "," + JSON.stringify(res1)
|
|
|
- // })
|
|
|
-
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- resolve(false);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ /* getLocation(type = "gcj02") {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ uni.getLocation({
|
|
|
+ geocode: true,
|
|
|
+ success: async function (res) {
|
|
|
+
|
|
|
+ console.log("当前位置: res", res);
|
|
|
+ console.log("当前位置的经度:" + res.longitude);
|
|
|
+ console.log("当前位置的纬度:" + res.latitude);
|
|
|
+ let res1 = MapHelper.wgs84togcj02(res.latitude, res.longitude);
|
|
|
+ res.latitude = res1.lat;
|
|
|
+ res.longitude = res1.lon;
|
|
|
+ res.lat = res1.lat;
|
|
|
+ res.lng = res1.lon;
|
|
|
+ resolve(res);
|
|
|
+ // uni.showModal({
|
|
|
+ // content: "当前位置的经度:" + res.longitude + "当前位置的纬度:" + res.latitude + "," + JSON.stringify(res1)
|
|
|
+ // })
|
|
|
+
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ resolve(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } */
|
|
|
|
|
|
}
|
|
|
|