月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-07-12 cd09654cd3d8cdcef089ff69c3af8209e0e07ee8
src/views/Index.vue
@@ -4,10 +4,17 @@
      id="cesiumContainer"
      style="width: 100%; height: 100%; position: absolute"
    ></div>
    <export-map
      v-if="layerExportshow"
      @SETexportMap="SETexportMap"
    ></export-map>
    <menus></menus>
    <bottom-btn></bottom-btn>
    <top-btn></top-btn>
    <mouse-move></mouse-move>
    <spatial-box
      v-if="layerSpatialshow"
      @SETspatialClose="SETspatialClose"
    ></spatial-box>
  </div>
</template>
@@ -20,25 +27,71 @@
  defineProps,
  defineEmits,
} from "vue";
import { removeToken, getToken } from "@/utils/auth";
//左侧菜单
import menus from "@/views/menus.vue";
//底部菜单
import bottomBtn from "@/components/bottomBtn.vue";
//顶部菜单
import topBtn from "@/components/topBtn.vue";
import exportMap from "./export/exportMap.vue";
import InitMap from "@/assets/js/Map/index.js";
//经纬度显示
import mouseMove from "@/components/mouseMove.vue";
//空间查询
import spatialBox from "@/views/query/SpatialQuery.vue";
import router from "@/router";
import { useStore } from "vuex"; // 引入useStore 方法
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 SETexportMap = (res) => {
  layerExportshow.value = res;
};
const functionForJs = (res) => {
  switch (res.type) {
    case "exportMap":
      layerExportshow.value = res.value;
      break;
    case "spatialQuery":
      setSpatialQuery(res);
      break;
  }
};
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");
  }
  InitMap.init3DMap();
  init();
  const infobar = document.getElementsByClassName("map-info-bar")[0];
  infobar.style.display = "none";
  const navigation = document.getElementsByClassName("navigation-controls")[0];
  navigation.style.top = "calc(100% - 182px)";
  navigation.style.right = "70px";
  const compass = document.getElementsByClassName("compass")[0];
  compass.style.top = "calc(100% - 280px)";
  compass.style.right = "38px";
  window.functionForJs = functionForJs;
});
</script>
<style lang="less" scoped>