From 6eb62bca39ee019bc19f3681676695a0ba44829d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 14 May 2021 18:06:52 +0800
Subject: [PATCH] 地图
---
public/xcxjingqingmap/js/vueMain.js | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/public/xcxjingqingmap/js/vueMain.js b/public/xcxjingqingmap/js/vueMain.js
index 98cb3a3..9758852 100644
--- a/public/xcxjingqingmap/js/vueMain.js
+++ b/public/xcxjingqingmap/js/vueMain.js
@@ -15,7 +15,7 @@
seedata: '',
},
methods: {
- getDataList() {//获取全部设备
+ getDataList() {
var that = this;
// var url = 'https://web.byisf.com/api/blade-jfpts/equipment/equipment/listAll';
// axios.get(url).then((res) => {
@@ -24,17 +24,24 @@
// })
},
beginCome() {
- this.getdata = this.getQueryVariable('data');//url传值解码
-
+ // this.getdata = this.getQueryVariable('data');//url解码
+ this.getdata = [{
+ jd: 115.91042800000002,
+ wd: 28.68094757898212,
+ state: 0,
+ dtype: 0,
+ size: 300,
+ title: '第一个'
+ }];//url解码
this.map = this.beginMap(this.map, this.getdata);//创建并接受map
this.move = new myDomMove('#seedata', '.title', '#map');
- var dy = document.documentElement.clientHeight - 50;
- $('#seedata').animate({ top: dy + "px" }, 10);
- $('#map').css("height", (index, value) => {//改变地图高度
- return '100%';
- })
+ // var dy = document.documentElement.clientHeight - 50;
+ // $('#seedata').animate({ top: dy + "px" }, 10);
+ // $('#map').css("height", (index, value) => {//改变地图高度
+ // return '100%';
+ // })
this.map.invalidateSize(true);//应用地图高度
- this.move.followFinger(this.map, 'up');
+ this.move.followFinger(this.map, 'down');
},
getQueryVariable(variable) {
var query = window.location.search.substring(1);
@@ -47,10 +54,12 @@
},
beginMap(map, data) {
var that = this;
+ var center = [data[0].wd,data[0].jd];
+ this.seedata = data[0].datas;
+ console.log(this.seedata)
var createMap = () => {
map = L.map('map', { //初始化地图
- center: [data[0].wd, data[0].jd],
- // center: [28.658056100535727, 115.85803985595703],
+ center: center,
zoom: 12,
minZoom: 2,
maxZoom: 17,
@@ -90,7 +99,7 @@
var setData = (a) => {//定义图标
marker = L.marker([a.wd, a.jd], {
icon: a.dtype == 0 ? carIcon : a.dtype == 1 ? planeIcon : a.dtype == 2 ? busIcon : '',
- title: title,
+ // title: title,
myData: {//自定义数据
...a
}
@@ -98,7 +107,7 @@
}
for (var i = 0; i < data.length; i++) {
var a = data[i];
- var title = a.title;
+ // var title = a.title;
if (a.dtype == 0) {
setData(a);
} else if (a.dtype == 1) {
--
Gitblit v1.9.3