shuishen
2022-02-19 d25a69f40c327f8bd72a7a16d5090bc85f6952df
leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -136,11 +136,19 @@
            serid: "1123598821738675201,",
            time: "无数据",
            url: "http://223.82.109.183:2081/zhba/upload/20211102/07fe327a76a43fa8d3431c73febade22.jpg",
            buttype: "0",
            type:'1'
            buttype: "1",
            type: '1',
            captain: '队长',
            team: "张三,李四",
            iscation: '0',
            publisher: '管理者'
         }
         //url解码
         this.data = this.getQueryVariable('data') || data;
         if (this.data.team) {
            this.data.team = this.data.team.split(',');
         }
         console.log(this.data)
         // this.getdata = data;
         // this.changeDom(this.getdata[0]);//改变地图高度
         // console.log(this.getdata[0]);
@@ -360,8 +368,9 @@
      // },
      //定位当前位置
      locationMap() {
         // console.log([this.lat, this.lng])
         this.map.setView([this.lat, this.lng], 20);
         // this.map.setView([this.lat, this.lng], 20);
      },
      toJQposition() {
         this.map.setView([this.oldlat, this.oldlng], 20);
@@ -551,21 +560,85 @@
         })
         // let point = L.circle([28.67705200351289,115.88518439579809],{color:'#FF0000',fillColor:'#FF0000',radius:1000000,fillOpacity:1});
         map.addLayer(polyline)
      },
      checkDomHeight(data) {
         //  声明定时器
         var timer = null;
         //  检查dom是否执行完成
         function checkDom() {
            let useData;
            if (data.domName == 'not') {
               useData = this[data.name];
            } else {
               let dom = document[data.domName](data.name);
               useData = dom;
            }
            if (useData) {
               //  执行dom加载完成后的操作
               //  清除定时器
               if (!timer) {
                  clearTimeout(timer);
               }
               if (data.fn) {
                  //回调函数
                  data.fn(useData);
                  return;
               } else {
                  return dom;
               }
            } else {
               //  自我调用
               timer = setTimeout(checkDom, 200);
            }
         }
         //  首次执行
         checkDom();
      }
   },
   created() {},
   mounted() {
      let that = this;
      this.getDataList();
      // var time = setInterval(() => {
      //    if (this.haveShishiweizhi == 1) {
      //       this.getLocationData();
      //       // console.log(this.haveShishiweizhi)
      //    } else if (this.haveShishiweizhi == 2) {
      //       clearInterval(time);
      //       time = null;
      //    }
      // }, 1000)
      //map适应任务详情高度
      // console.log(document.getElementById("map"))
      let UmainHeight = document.getElementById("Umain").clientHeight;
      let h = document.getElementById("mapVue").clientHeight;
      this.checkDomHeight({
         domName: "getElementById",
         name: "map",
         fn: function(dom) {
            dom.style.height = h - UmainHeight + "px";
            document.getElementsByClassName("dingwei")[0].style.bottom =
               UmainHeight + 10 + "px";
            that.map.invalidateSize(true);
         }
      })
      //开启滑动
      //计算最小单位
      let rows = document.getElementsByClassName("once"),
         rowsHeight = 45;
      for (let ri = 0; ri < 3; ri++) {
         rowsHeight += rows[ri].clientHeight;
      }
      this.domMove = new $moveWindow({
         id: "Umain",
         minHeight: rowsHeight,
         maxHeight: UmainHeight,
         critical: (UmainHeight - rowsHeight) / 4,
         openAnimation: false,
         fn: function(res) {
            // console.log(that.map.options)
            document.getElementById("map").style.height = h - res.height + "px";
            // that.map.setView([that.map.options.center[0], +that.map.options.center[1] + 0.002], that.map
            //    .options.zoom);
            // console.log(h - res.height)
            if (res.state === true || res.state === false) {
               that.map.invalidateSize(true);
            }
            document.getElementsByClassName("dingwei")[0].style.bottom = res.height + 10 + "px";
         },
      });
      this.domMove.init();
   },
   wacth: {}
})