liuyg
2021-05-14 6eb62bca39ee019bc19f3681676695a0ba44829d
地图
1 files modified
35 ■■■■■ changed files
public/xcxjingqingmap/js/vueMain.js 35 ●●●●● patch | view | raw | blame | history
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) {