From 464af9e1583e469e68c846456513f8a11cb3aff1 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 28 May 2021 16:24:15 +0800
Subject: [PATCH] 样式优化
---
xcxMapJQ/img/shiyongren.png | 0
xcxjingqingmap_lxdh/js/lxdhmap.js | 60 ++++++++++++++-----
xcxMapJQ/js/vueMain.js | 81 +++++++++++++++++++++++++++
3 files changed, 124 insertions(+), 17 deletions(-)
diff --git a/xcxMapJQ/img/shiyongren.png b/xcxMapJQ/img/shiyongren.png
new file mode 100644
index 0000000..424c1f4
--- /dev/null
+++ b/xcxMapJQ/img/shiyongren.png
Binary files differ
diff --git a/xcxMapJQ/js/vueMain.js b/xcxMapJQ/js/vueMain.js
index 23e3766..8e46082 100644
--- a/xcxMapJQ/js/vueMain.js
+++ b/xcxMapJQ/js/vueMain.js
@@ -6,6 +6,9 @@
marker: null,
layuiLayer: null,
nowIndex: null,
+
+ LXdhEnd: null,
+ LxdhLine: null,
activeName: 'first',
@@ -156,6 +159,7 @@
console.log('没有坐标', i)
} else {
setData(a);
+ that.getDHLine(a.jd,a.wd);
}
// marker.bindPopup(title);
markers.addLayer(marker);
@@ -185,6 +189,83 @@
// });
return map;//抛出map
},
+ getDHLine(x, y) {
+
+ var that = this;
+
+ //获取导航信息
+ axios({
+ method: "get",
+ url: `https://web.byisf.com/sf/rp/v2/api`,
+ params: {
+ ak: "1986afc8a5744263971b7f2482253dfc",
+ x1: "114.95675749182703",
+ y1: "25.84163062532512",
+ x2: x,
+ y2: y,
+ type: "1",
+ strategy: "0",
+ opt: "sf2"
+ },
+ }).then((res) => {
+ var resdata = res.data.result.coords;
+ var data = [];
+ for (var i = 0; i < resdata.length; i++) {
+ var xy = [];
+ xy.push(resdata[i][1]);
+ xy.push(resdata[i][0]);
+ data.push(xy);
+ }
+
+ if (that.LXdhEnd != null) {
+ that.map.removeLayer(that.LXdhEnd);
+ }
+ if (that.LxdhLine != null) {
+ that.map.removeLayer(that.LxdhLine);
+ }
+
+ //绘制起点和终点
+ that.LXdhEnd = L.markerClusterGroup();
+
+ var transportIcon = L.Icon.extend({ //图标初始化
+ options: {
+ iconSize: [56, 32], // 图标尺寸
+ }
+ });
+
+ var zd = new transportIcon({
+ iconUrl: './img/zd.png'
+ });
+ // var qd = new transportIcon({
+ // iconUrl: './img/qd.png'
+ // });
+
+ var qdzb = res.data.result.query;
+
+ var x = resdata[resdata.length - 1][0];
+ var y = resdata[resdata.length - 1][1];
+
+ that.LXdhEnd.addLayer(L.marker([y, x], {
+ icon: zd,
+ }));
+ // markers.addLayer(L.marker([qdzb.start.y, qdzb.start.x], {
+ // icon: qd,
+ // }));
+
+ that.map.addLayer(that.LXdhEnd);
+
+ that.showPolyLine(data);
+ });
+ },
+ showPolyLine(xy) {
+ var that = this;
+ that.LxdhLine = L.polyline(xy, {
+ color: 'red'
+ }).addTo(that.map);
+
+ // zoom the map to the polyline
+ that.map.fitBounds(that.LxdhLine.getBounds())
+ },
getLocation() {
// if (navigator.geolocation) {
// // console.log(navigator.geolocation)
diff --git a/xcxjingqingmap_lxdh/js/lxdhmap.js b/xcxjingqingmap_lxdh/js/lxdhmap.js
index 319ba0a..d6a70c7 100644
--- a/xcxjingqingmap_lxdh/js/lxdhmap.js
+++ b/xcxjingqingmap_lxdh/js/lxdhmap.js
@@ -167,7 +167,7 @@
that.seedata = a.layer.options.myData;
$('#seedata').css('top', '');
$('#map').css("height", (index, value) => { //改变地图高度
- return '45%';
+ return '43%';
})
map.invalidateSize(true); //应用地图高度
// console.log(a.layer.options.myData);
@@ -197,7 +197,7 @@
LXdhJQ() {
var that = this;
var jqdata = that.seedata;
- that.getDHLine(jqdata.jd,jqdata.wd);
+ that.getDHLine(jqdata.jd, jqdata.wd);
$('#map').css("height", (index, value) => { //改变地图高度
return '100%';
@@ -243,8 +243,9 @@
var ids = $(this).attr("id");
$("#mh_query").html("");
-
- that.getDHLine(that.ZBCXresult[ids].location.lng,that.ZBCXresult[ids].location.lat);
+
+ that.getDHLine(that.ZBCXresult[ids].location.lng, that.ZBCXresult[ids]
+ .location.lat);
// alert(that.ZBCXresult[ids].name);
});
@@ -252,10 +253,10 @@
this.mh_query_show = true;
},
- getDHLine(x,y){
-
+ getDHLine(x, y) {
+
var that = this;
-
+
//获取导航信息
axios({
method: "get",
@@ -279,44 +280,44 @@
xy.push(resdata[i][0]);
data.push(xy);
}
-
+
if (that.LXdhEnd != null) {
that.map.removeLayer(that.LXdhEnd);
}
if (that.LxdhLine != null) {
that.map.removeLayer(that.LxdhLine);
}
-
+
//绘制起点和终点
that.LXdhEnd = L.markerClusterGroup();
-
+
var transportIcon = L.Icon.extend({ //图标初始化
options: {
iconSize: [56, 32], // 图标尺寸
}
});
-
+
var zd = new transportIcon({
iconUrl: './img/zd.png'
});
// var qd = new transportIcon({
// iconUrl: './img/qd.png'
// });
-
+
var qdzb = res.data.result.query;
-
+
var x = resdata[resdata.length - 1][0];
var y = resdata[resdata.length - 1][1];
-
+
that.LXdhEnd.addLayer(L.marker([y, x], {
icon: zd,
}));
// markers.addLayer(L.marker([qdzb.start.y, qdzb.start.x], {
// icon: qd,
// }));
-
+
that.map.addLayer(that.LXdhEnd);
-
+
that.showPolyLine(data);
});
},
@@ -351,12 +352,37 @@
}).then((resdata) => {
var res = resdata.data.data;
for (var i = 0; i < res.length; i++) {
+ var data = res[i];
res[i].state = "0";
res[i].dtype = "0";
res[i].size = "300";
-
+ for (var key in res[i]) {
+ if (data[key] == null || data[key] == '') {
+ data[key] = '暂无'
+ }
+ }
}
this.getDataList(res);
+ debugger
+
+ var latitude = null;
+ var longitude = null;
+ var speed = null;
+ var accuracy = null;
+
+ wx.getLocation({
+ type: 'wgs84',
+ success(resLo) {
+ latitude = resLo.latitude
+ longitude = resLo.longitude
+ speed = resLo.speed
+ accuracy = resLo.accuracy
+ },fail(reserr){
+
+ }
+
+ });
+ alert(latitude);
});
},
--
Gitblit v1.9.3