From 273beff9c110f6c4753b9436d872a9fa8d63b7d3 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 30 Jul 2021 15:42:42 +0800
Subject: [PATCH] 文件配置及部分修改

---
 xcxMapWz/js/vueMain.js |   90 ++++++++++++++++++++++++---------------------
 1 files changed, 48 insertions(+), 42 deletions(-)

diff --git a/xcxMapWz/js/vueMain.js b/xcxMapWz/js/vueMain.js
index 354c1f8..8dd16ed 100644
--- a/xcxMapWz/js/vueMain.js
+++ b/xcxMapWz/js/vueMain.js
@@ -31,18 +31,21 @@
             that.beginCome();
         },
         beginCome() {
-            var data = [{
-                    "id": '100000',
-                    "place": '无数据',
-                    "state": '0',
-                    "dtype": '0',
-                    "size": '300',
-                    "jd": "115.822311",
-                    "wd": "28.646341"
-                }]
+            var data = []
                 //url解码
-            this.getdata = this.getQueryVariable('data') || data;
-            this.map = this.beginMap(this.map, this.getdata); //创建并接受map
+				
+			axios.get('http://192.168.0.108:81/blade-user/page?size=99999').then((res) => {
+			   console.log(res, 4848)
+			   res.data.data.records.forEach(item => {
+				   if (item.longitude && item.latitude) {
+					   data.push(item)
+				   }
+			   })
+			})
+				
+				
+            // this.getdata = this.getQueryVariable('data') || data;
+            this.map = this.beginMap(this.map, data); //创建并接受map
             this.move = new myDomMove('#seedata', '.title', '#map');
             this.map.invalidateSize(true); //应用地图高度
             this.move.followFinger(this.map, 'down');
@@ -59,29 +62,29 @@
         },
         beginMap(map, data) {
             var that = this,
-                center = [data[0].wd, data[0].jd],
-                url = `http://s16s652780.51mypc.cn/api/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
+                center = [Number(data[0].longitude), Number(data[0].latitude)];
+                // url = `http://s16s652780.51mypc.cn/api/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
             // url = `http://localhost:89/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
             this.nowPosition = center;
-            axios.post(url).then((res) => {
-                if (res.data.data.length != 0) {
-                    var dat = res.data.data[0];
-                    for (var key in dat) {
-                        if (dat[key] == null || dat[key] == '') {
-                            dat[key] = '暂无'
-                        }
-                    }
-                    this.seedata = dat;
+            // axios.post(url).then((res) => {
+            //     if (res.data.data.length != 0) {
+            //         var dat = res.data.data[0];
+            //         for (var key in dat) {
+            //             if (dat[key] == null || dat[key] == '') {
+            //                 dat[key] = '暂无'
+            //             }
+            //         }
+            //         this.seedata = dat;
 
-                } else {
-                    this.seedata = data[0];
-                }
-            })
+            //     } else {
+            //         this.seedata = data[0];
+            //     }
+            // })
 
             var createMap = () => {
                 map = L.map('map', { //初始化地图
                     center: center,
-                    zoom: 20,
+                    zoom: 10,
                     minZoom: 2,
                     maxZoom: 17,
                     attributionControl: false, //去掉右下角
@@ -110,9 +113,12 @@
                 busIcon = new transportIcon({
                     iconUrl: './img/red.png'
                 });
+				wzIcon = new transportIcon({
+				    iconUrl: './img/wz.png'
+				});
             var setData = (a) => { //定义图标
-                marker = L.marker([a.wd, a.jd], {
-                    icon: planeIcon,
+                marker = L.marker([Number(a.longitude), Number(a.latitude)], {
+                    icon: wzIcon,
                     // icon: a.dtype == 0 ? carIcon : a.dtype == 1 ? planeIcon : a.dtype == 2 ? busIcon : '',
                     // title: title,
                     myData: { //自定义数据
@@ -126,25 +132,25 @@
                     console.log('没有坐标', i)
                 } else {
                     setData(a);
-                    that.getDHLine(a.jd, a.wd);
+                    // that.getDHLine(a.jd, a.wd);
                 }
                 markers.addLayer(marker);
             }
             map.addLayer(markers);
 
-            markers.on('click', function(a) {
-                // that.drawer = true;
-                that.seedata = a.layer.options.myData;
-                that.nowPosition = [that.seedata.wd, that.seedata.jd]
-                $('#seedata').css('top', '');
-                $('#map').css("height", (index, value) => { //改变地图高度
-                    return '50%';
-                })
-                map.invalidateSize(true); //应用地图高度
-                that.move.destruction();
-                that.move.followFinger(map, 'down');
+            // markers.on('click', function(a) {
+            //     // that.drawer = true;
+            //     that.seedata = a.layer.options.myData;
+            //     that.nowPosition = [that.seedata.wd, that.seedata.jd]
+            //     $('#seedata').css('top', '');
+            //     $('#map').css("height", (index, value) => { //改变地图高度
+            //         return '50%';
+            //     })
+            //     map.invalidateSize(true); //应用地图高度
+            //     that.move.destruction();
+            //     that.move.followFinger(map, 'down');
 
-            });
+            // });
             this.nowPosition = center;
             return map; //抛出map
         },

--
Gitblit v1.9.3