月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-08-28 6f2fb62fe828bdd74b0cd59b9cbdf6c83559c1b4
src/views/Index.vue
@@ -1,9 +1,6 @@
<template>
  <div class="body_box">
    <div
      id="cesiumContainer"
      style="width: 100%; height: 100%; position: absolute"
    ></div>
    <export-map
      v-if="layerExportshow"
      @SETexportMap="SETexportMap"
@@ -15,6 +12,21 @@
      v-if="layerSpatialshow"
      @SETspatialClose="SETspatialClose"
    ></spatial-box>
    <coord-location
      v-if="layerLocationshow"
      @SETcoordClose="setCoordLocation"
    >
    </coord-location>
    <details-query v-if="store.state.details.showDetails">
    </details-query>
    <div v-if="store.state.isShowMap">
      <map-view></map-view>
    </div>
    <div v-if="!store.state.isShowMap">
      <ol-map></ol-map>
    </div>
  </div>
</template>
@@ -33,25 +45,27 @@
//底部菜单
import bottomBtn from "@/components/bottomBtn.vue";
import exportMap from "./export/exportMap.vue";
import InitMap from "@/assets/js/Map/index.js";
import mapView from "@/views/Map/mapView.vue";
import olMap from "@/views/Map/olMap.vue";
//经纬度显示
import mouseMove from "@/components/mouseMove.vue";
//空间查询
import spatialBox from "@/views/query/SpatialQuery.vue";
//坐标定位
import CoordLocation from "@/views/query/CoordLocation.vue";
//阴影分析
import mapclock from "@/views/mapClock/index.vue";
//矢量数据信息弹窗
import detailsQuery from "@/views/query/detailsQuery.vue";
import router from "@/router";
import { useStore } from "vuex"; // 引入useStore 方法
import { dataQuery_selectByPage } from "@/api/api";
let map;
var viewer;
const store = useStore(); // 该方法用于返回store 实例
const layerExportshow = ref(false);
const layerSpatialshow = ref(false);
const init = () => {
  viewer = InitMap.Viewer;
  map = InitMap.sgworld;
  window.setMouseMove(true);
};
const layerLocationshow = ref(false);
//关闭状态
const SETexportMap = (res) => {
  layerExportshow.value = res;
@@ -59,34 +73,25 @@
const functionForJs = (res) => {
  switch (res.type) {
    case "exportMap":
      store.state.exportImgUrl = res.url;
      layerExportshow.value = res.value;
      break;
    case "spatialQuery":
      setSpatialQuery(res);
      break;
    case "closeNavigatBar":
      setCloseNavigatBar();
      break;
    case "coordLocation":
      setCoordLocation(res);
      break;
  }
};
const setSpatialQuery = async (res) => {
  layerSpatialshow.value = true;
  store.state.spatialQueryData.wkt = res.value;
  store.state.spatialQueryData.hasGeom = 1;
  store.state.spatialQueryData.filter = "";
  store.state.spatialQueryData.name = "lunarplacenane";
  var obj = store.state.spatialQueryData;
  const data = await dataQuery_selectByPage(obj);
  debugger;
const setCoordLocation = (res) => {
  layerLocationshow.value = res;
};
const SETspatialClose = (res) => {
  layerSpatialshow.value = res;
};
onMounted(() => {
  var token = getToken();
  if (!token) {
    router.push("/Login");
  }
  InitMap.init3DMap();
  init();
const setCloseNavigatBar = () => {
  const infobar = document.getElementsByClassName("map-info-bar")[0];
  infobar.style.display = "none";
  const navigation = document.getElementsByClassName("navigation-controls")[0];
@@ -95,8 +100,24 @@
  const compass = document.getElementsByClassName("compass")[0];
  compass.style.top = "calc(100% - 280px)";
  compass.style.right = "38px";
};
const setSpatialQuery = async (res) => {
  store.state.spatialQueryData.wkt = res.value;
  layerSpatialshow.value = true;
};
const SETspatialClose = (res) => {
  layerSpatialshow.value = res;
};
onMounted(() => {
  var token = getToken();
  if (!token) {
    router.push("/Login");
  }
  // setCloseNavigatBar();
  window.functionForJs = functionForJs;
  store.state.isShowMap = true;
});
</script>
<style lang="less" scoped>