From 462a636f9101d059eef0783d5ead0da56fe8c9b1 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 28 May 2021 10:54:23 +0800
Subject: [PATCH] 路线导航修改

---
 xcxjingqingmap/js/vueMain.js       |  123 +++++++++++++++++++++++++++++------------
 static/tabbar/investigation22.png  |    0 
 static/tabbar/investigationH22.png |    0 
 3 files changed, 87 insertions(+), 36 deletions(-)

diff --git a/static/tabbar/investigation22.png b/static/tabbar/investigation22.png
new file mode 100644
index 0000000..e9dbcc0
--- /dev/null
+++ b/static/tabbar/investigation22.png
Binary files differ
diff --git a/static/tabbar/investigationH22.png b/static/tabbar/investigationH22.png
new file mode 100644
index 0000000..9227478
--- /dev/null
+++ b/static/tabbar/investigationH22.png
Binary files differ
diff --git a/xcxjingqingmap/js/vueMain.js b/xcxjingqingmap/js/vueMain.js
index 62ff6fd..eb15ee4 100644
--- a/xcxjingqingmap/js/vueMain.js
+++ b/xcxjingqingmap/js/vueMain.js
@@ -23,15 +23,16 @@
     methods: {
         getDataList() {
             var that = this;
-            // var url = 'https://web.byisf.com/api/blade-jfpts/equipment/equipment/listAll';
-            // axios.get(url).then((res) => {
-            //     that.getdata = res.data.data;
-            that.beginCome();
-            // })
+            var url = 'https://web.byisf.com/api/blade-jfpts/equipment/equipment/listAll';
+            axios.get(url).then((res) => {
+                that.getdata = res.data.data;
+                // console.log(that.getdata)
+                that.beginCome();
+            })
         },
         beginCome() {
-            this.getdata = this.getQueryVariable('data');//url解码
-            // console.log(this.getdata)
+            // this.getdata = this.getQueryVariable('data');//url解码
+            console.log(this.getdata)
             // this.getdata = [{
             //     jd: 115.91042800000002,
             //     wd: 28.68094757898212,
@@ -63,23 +64,24 @@
             var that = this,
                 center = [data[0].wd, data[0].jd],
                 url = `/api/blade-jfpts/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
+            // console.log(center)
             this.nowPosition = center;
-            axios.post(url).then((res) => {
-                // console.log(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) => {
+            //     // console.log(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];
-                }
-                // console.log(this.seedata, 1524545453)
-            })
+            //     } else {
+            //         this.seedata = data[0];
+            //     }
+            //     // console.log(this.seedata, 1524545453)
+            // })
 
 
             var createMap = () => {
@@ -94,11 +96,11 @@
                 L.tileLayer( //添加切片图层
                     // "https://webmap-tile.sf-express.com/MapTileService/rt?x={x}&y={y}&z={z}", {//顺丰地图
                     "https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal", {//顺丰地图
-                        // "http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}", {
+                    // "http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}", {
 
-                        // subdomains: ["1", "2", "3", "4"],
-                        // attribution: "高德"
-                    }
+                    // subdomains: ["1", "2", "3", "4"],
+                    // attribution: "高德"
+                }
                 ).addTo(map);
             }
             createMap();
@@ -112,8 +114,8 @@
                 }
             });
             var carIcon = new transportIcon({ //引入图标
-                    iconUrl: './img/gray.png'
-                }),
+                iconUrl: './img/gray.png'
+            }),
                 planeIcon = new transportIcon({
                     iconUrl: './img/green.png'
                 }),
@@ -123,7 +125,8 @@
             // console.log(data, 43545343)
             var setData = (a) => {//定义图标
                 marker = L.marker([a.wd, a.jd], {
-                    icon: planeIcon ,
+                    icon: planeIcon,
+                    // icon: a.dtype == 0 ? carIcon : a.dtype == 1 ? planeIcon : a.dtype == 2 ? busIcon : '',
                     // title: title,
                     myData: {//自定义数据
                         ...a
@@ -140,13 +143,11 @@
                 // } else if (a.dtype == 2) {
                 //     setData(a);
                 // }
-
                 if(a.jd == '' || a.wd == '' || a.jd == null || a.wd == null){
                     console.log('没有坐标', i)
                 } else {
                     setData(a);
                 }
-
                 // marker.bindPopup(title);
                 markers.addLayer(marker);
             }
@@ -154,7 +155,9 @@
 
             markers.on('click', function (a) {
                 // that.drawer = true;
-                // that.seedata = a.layer.options.myData;
+                that.seedata = a.layer.options.myData;
+                that.nowPosition = [that.seedata.wd,that.seedata.jd]
+                console.log(that.seedata)
                 $('#seedata').css('top', '');
                 $('#map').css("height", (index, value) => {//改变地图高度
                     return '50%';
@@ -166,18 +169,66 @@
 
             });
             that.seedata = data[0];
+            this.nowPosition = center;
             // map.on('mousemove', (e) => {//实时显示坐标
             //     let latlng = e.latlng;
             //     console.log(latlng);// {lat: 30.59, lng: 114.32}
             // });
             return map;//抛出map
         },
+        getLocation() {
+            // if (navigator.geolocation) {
+            //     // console.log(navigator.geolocation)
+            //     navigator.geolocation.getCurrentPosition(onSuccess, onError);
+
+            // } else {
+            //     alert("您的浏览器不支持使用HTML 5来获取地理位置服务");
+            // }
+
+            // function onSuccess(position) {
+            //     console.log('纬度: ' + position.coords.latitude + '\n' +
+            //         '经度: ' + position.coords.longitude + '\n' +
+            //         '海拔: ' + position.coords.altitude + '\n' +
+            //         '水平精度: ' + position.coords.accuracy + '\n' +
+            //         '垂直精度: ' + position.coords.altitudeAccura)
+            // }
+            // function onError(error) {
+            //     switch (error.code) {
+            //         case error.PERMISSION_DENIED:
+            //             alert("您拒绝对获取地理位置的请求");
+            //             break;
+            //         case error.POSITION_UNAVAILABLE:
+            //             alert("位置信息是不可用的");
+            //             break;
+            //         case error.TIMEOUT:
+            //             alert("请求您的地理位置超时");
+            //             break;
+            //         case error.UNKNOWN_ERROR:
+            //             alert("未知错误");
+            //             break;
+            //     }
+            // }
+            // this.map.locate({
+            //     setView: true,
+            //     maxZoom: 16
+            // });
+            // console.log(this.map)
+            // this.map.on('locationfound', function (e) {
+            //     // var radius = e.accuracy / 2;
+            //     // L.marker(e.latlng).addTo(mapid).bindPopup("你就在这个圈内");
+            //     // L.circle(e.latlng, radius).addTo(mapid);
+            //     console.log(e)
+            // });
+        },
         handleClick(tab, event) {
             // console.log(tab, event);
         },
-
-        locationMap() {
+        titleClick(){
             this.map.setView(this.nowPosition, 12);
+        },
+        locationMap() {//定位
+            // this.map.setView(this.nowPosition, 12);//定警情位置
+            // this.getLocation();
             // console.log(wx,12);
             // wx.miniProgram.navigateTo({url: 'pages/workbench/workbench'})
         },
@@ -240,8 +291,8 @@
         },
         gotoxcx(routs) {
             wx.miniProgram.navigateTo({
-                url:`../poput/workbench/policeDetails/${routs}?id=${this.seedata.id}`,            //指定跳转至小程序页面的门路
-                success: function(){
+                url: `../poput/workbench/policeDetails/${routs}?id=${this.seedata.id}`,            //指定跳转至小程序页面的门路
+                success: function () {
                     console.log('success');   //页面跳转胜利的回调函数
                 }
             });

--
Gitblit v1.9.3