校园-江西科技师范大学-前端
shuishen
2023-12-14 e733164e1c779b3aef7245936b9daf7875bf791e
src/store/modules/popupParams.js
@@ -16,6 +16,16 @@
window.divIcon = null;
window.divIcononces = null;
function updateUrl(url) {
  if (url.indexOf("http://172.18.4.135:9000/zhxy") != -1) {
    url = url.replace(
      "http://172.18.4.135:9000/zhxy",
      "https://fkxt.jxstnu.edu.cn/changjing/gminio/zhxy"
    );
  }
  return url;
}
const popupParams = {
  state: {
    ...leftNavsData.state,
@@ -150,37 +160,9 @@
  },
  actions: {
    ...leftNavsData.actions,
    openPopups({ state, commit, dispatch }, value) {
      //     //订阅事件
      //   divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
      //     that.openPopups({
      //       lng: e.overlay.position.lng,
      //       lat: e.overlay.position.lat,
      //       item: item,
      //     });
      //   });
      var box = new global.DC.DivForms(state.viewer, {
        domId: "divFormsDomBox",
        position: [
          global.DC.Transform.transformWGS84ToCartesian(
            new global.DC.Position(
              Number(value.lng),
              Number(value.lat),
              Number(value.alt || 0)
            )
          ),
        ],
      });
      dispatch("setOurDataInPoput", value);
      dispatch("pcFlyView", {
        jd: value.lng,
        wd: value.lat,
        viewer: this.viewer,
      });
    },
    setOurDataInPoput({ state, commit, dispatch }, value) {
      // 弹窗使用方法
      commit("CLEAR_ALL", null);
      commit("SET_MONITORPOPUP", false);
      commit("SET_PANORAMAPOPUP", false);
@@ -191,6 +173,9 @@
      if (value.item.tpurl) {
        imgArr = value.item.tpurl.split(",");
      }
      imgArr = imgArr.map((item) => updateUrl(item));
      commit("SET_POPUPBGURL", imgArr[0]);
      commit("SET_POPUPIMGATLAS", imgArr);
      commit("SET_POPUPQRURL", value.item.codeurl);
@@ -204,14 +189,16 @@
      ]);
      commit("SET_DETAILSPOPUP", true);
    },
    pcMoveView({ state, commit, dispatch }, val) {
      openlayerData.state.openlayers.map2D
        .getView()
        .setCenter([val.jd, val.wd]);
      openlayerData.state.openlayers.map2D
        .getView()
        .setResolution(0.00009517844023321122);
        .setResolution(val.resolution);
    },
    pcFlyView({ state, commit, dispatch }, val) {
      openlayerData.state.openlayers.map2D
        .getView()
@@ -294,12 +281,16 @@
    },
    addLabelLayerIconMobelUse({ state, commit, dispatch }, val) {
      window.labelLayer = new VectorLayer({
        // 图标图层
        zIndex: 32,
        source: new VectorSource(),
      });
      openlayerData.state.openlayers.map2D.addLayer(window.labelLayer);
      if (window.labelLayer) {
        window.labelLayer.getSource().clear();
      } else {
        window.labelLayer = new VectorLayer({
          // 图标图层
          zIndex: 32,
          source: new VectorSource(),
        });
        openlayerData.state.openlayers.map2D.addLayer(window.labelLayer);
      }
      // state.myviewer = val.mviewer
      if (val.clear) {
@@ -308,18 +299,8 @@
      }
      const iconFeature = new Feature({
        geometry: new Point([Number(post[0]), Number(post[1])]),
        attributes: {
          data: value[2],
          ourD: {
            label: value[2].from,
          },
          lntLat: [post[0], post[1]],
        },
        geometry: new Point([Number(val.data.jd), Number(val.data.wd)]),
      });
      var textElement = document.createElement("span");
      textElement.innerHTML = point[k].name;
      iconFeature.setStyle(
        new Style({
@@ -337,6 +318,7 @@
          }),
        })
      );
      window.labelLayer.getSource().addFeature(iconFeature);
    },