shuishen
2022-02-21 bd43cf042d48087d2f75237c0fe27ffb56fed5f4
leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -39,19 +39,57 @@
      onPosition: false, //持续定位指示
   },
   methods: {
      setUniAppMsg(state, data) {
         let that = this;
         state == "hBackMsg" ? window.parent.hBackMsg(data);
         state == "setIntLat" ? window.parent.setIntLat({
            rid: that.data.id,
            fn: (out) => {
               // console.log(out,"1111");
               // that.addIcon(out);
               that.addIcon([out[1], out[0]]);
      unis(data) {
         //向uniapp传值
         uni.postMessage({
            data: {
               action: data
            }
         });
         state == "showTip" ? that.parent.showTip("获取定位失败");
      },
      setUniAppMsg(state, data) {
         let that = this;
         if (window.parent) {
            console.log("有window.parent")
            if (state == "hBackMsg") {
               window.parent.hBackMsg(data);
            }
            if (state == "setIntLat") {
               window.parent.setIntLat({
                  rid: that.data.id,
                  fn: (out) => {
                     // console.log(out,"1111");
                     // that.addIcon(out);
                     that.addIcon([out[1], out[0]]);
                  }
               });
            }
            if (state == "showTip") {
               that.parent.showTip("获取定位失败");
            }
         } else {
            console.log("没window.parent")
            if (state == "hBackMsg") {
               // window.parent.hBackMsg(data);
               that.unis("hBackMsg")
            }
            if (state == "setIntLat") {
               // window.parent.setIntLat({
               //    rid: that.data.id,
               //    fn: (out) => {
               //       // console.log(out,"1111");
               //       // that.addIcon(out);
               //       that.addIcon([out[1], out[0]]);
               //    }
               // });
               that.unis("setIntLat")
            }
            if (state == "showTip") {
               // that.parent.showTip("获取定位失败");
               that.unis("showTip")
            }
         }
      },
      openAPP(type) {
         // console.log(type)
@@ -65,7 +103,7 @@
               });
            } else if (that.data.butCT == "begin") {
               // 开始任务
               that.setUniAppMsg({
               that.setUniAppMsg("hBackMsg", {
                  type: "start",
                  data: {
                     id: that.data.id,
@@ -372,6 +410,7 @@
                     if (typeof res.intlat === "string") {
                        // that.parent.showTip("获取定位失败")
                        //向uniapp传值
                        that.setUniAppMsg("showTip")
                     } else {
                        that.addIcon([res.intlat[1], res.intlat[0]]);
@@ -677,6 +716,7 @@
      });
      this.domMove.init();
      // console.log(window.parent.setIntLat)
      that.setUniAppMsg("setIntLat")
      // window.parent.setIntLat({
      //    rid: this.data.id,
      //    fn: (out) => {