月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-09-04 1355c04087927dfed32827d23609e2b04a8cabea
src/views/menus.vue
@@ -1,40 +1,99 @@
<template>
  <div class="menus" v-show="fullScreen">
  <div
    class="menus"
    v-show="fullScreen"
  >
    <div class="logo_box">
      <img src="../assets/img/logo.png" alt="" class="logo" />
      <img
        src="../assets/img/logo.png"
        alt=""
        class="logo"
      />
      <div class="logo_name">
        <h3>月球大数据地理空间分析展示平台</h3>
        <img src="../assets/img/logob.png" alt="" class="logo_name_b" />
        <img
          src="../assets/img/logob.png"
          alt=""
          class="logo_name_b"
        />
      </div>
    </div>
    <div class="menus_box">
      <div
        class="imgBox"
        v-for="(item, i) in menuOptions"
        :key="i"
        @click="setMenuClick(item)"
      >
        <img
          v-if="checkMenuFlag != item.id"
          class="imgIcon"
          :src="require('../assets/img/leftBtn/' + item.imgUrl)"
        />
        <img
          v-if="checkMenuFlag == item.id"
          class="imgIcon"
          :src="require('../assets/img/leftBtn/' + item.checkImgUrl)"
        />
      <div class="menu_Image_box">
        <div
          class="imgBox"
          v-for="(item, i) in menuOptions"
          :key="i"
          @click="setMenuClick(item)"
        >
          <img
            v-if="checkMenuFlag != item.id"
            class="imgIcon"
            :src="require('../assets/img/leftBtn/' + item.imgUrl)"
          />
          <img
            v-if="checkMenuFlag == item.id"
            class="imgIcon"
            :src="require('../assets/img/leftBtn/' + item.checkImgUrl)"
          />
        </div>
      </div>
    </div>
  </div>
  <div class="content_box" v-show="fullScreen">
    <layer-manage v-show="checkMenuFlag == 'l1'"> </layer-manage>
    <plotting v-show="checkMenuFlag == 'l2'"> </plotting>
    <baseMapSwitching v-show="checkMenuFlag == 'l5'"> </baseMapSwitching>
    <search> </search>
  <div
    class="content_box"
    v-show="fullScreen"
  >
    <div
      v-show="checkMenuFlag == 'l1'"
      style="position: relative; display: flex"
    >
    </div>
    <div
      style="position: relative; display: flex"
      v-show="store.state.setLayerManager"
    >
      <layer-manage @setCloseLayer="setCloseLayer"></layer-manage>
    </div>
    <div
      style="position: relative; display: flex"
      v-show="checkMenuFlag == 'l2'"
    >
      <plotting @setCloseplotting="setCloseplotting"> </plotting>
    </div>
    <div v-show="checkMenuFlag == 'l5'">
      <baseMapSwitching> </baseMapSwitching>
    </div>
    <search v-if="thematicMapBtnState"> </search>
  </div>
  <top-btn v-show="fullScreen"></top-btn>
  <div class="fullScreen_btn"></div>
  <top-btn
    v-show="fullScreen"
    v-if="thematicMapBtnState"
  ></top-btn>
  <thematic-map v-show="!thematicMapBtnState"></thematic-map>
  <div
    class="fullScreen_btn"
    v-show="!fullScreen"
    @click="screen"
  ></div>
  <div
    v-show="store.state.doubleMenu"
    class="setDobuleMap"
    @click="setDoubleScreenMap"
  >
    <Operation />
  </div>
  <div
    @setDobuleCloseLayer="setDobuleCloseLayer"
    v-show="store.state.doubleMap"
  >
    <double-layer></double-layer>
  </div>
</template>
<script lang="ts" setup>
@@ -45,11 +104,15 @@
  reactive,
  defineProps,
  defineEmits,
  nextTick,
} from "vue";
import { Operation } from "@element-plus/icons-vue";
import menuData from "@/assets/js/Map/menuData";
import menuTool from "@/assets/js/Map/menuTool";
//顶部菜单
import topBtn from "@/components/topBtn.vue";
//专题图菜单
import thematicMap from "@/components/thematicMap/thematicMap.vue";
//图层管理页面
import layerManage from "@/views/layer/layerManage.vue";
//地理编码搜索
@@ -58,12 +121,42 @@
import plotting from "@/views/plotting/plotting.vue";
//底图切换
import baseMapSwitching from "@/views/baseMapSwitching/baseMapSwitching.vue";
//分屏菜单
import doubleLayer from "@/views/layer/doubleLayer.vue";
import store from "@/store";
const menuOptions = ref([]);
const checkMenuFlag = ref("");
let fullScreen = ref(true);
let thematicMapState = ref(true);
let thematicMapBtnState = ref(true);
const setDoubleScreenMap = () => {
  store.state.doubleMenu = false;
  store.state.doubleMap = true;
};
const setDobuleCloseLayer = () => {
  store.state.doubleMenu = true;
  store.state.doubleMap = false;
};
const setShowMapChange = (res) => {
  switch (res.id) {
    case "15":
      break;
    default:
      break;
  }
  // store.state.isShowMap = res;
};
const setMenuClick = (res) => {
  if (res.id == "l6") {
    fullScreen.value = !fullScreen.value;
    // fullScreen.value = !fullScreen.value;
    screen();
  }
  if (res.id == "l3") {
    thematicMapState.value = false;
    thematicMapBtnState.value = false;
  } else if (res.id != "11") {
    thematicMapState.value = true;
    thematicMapBtnState.value = true;
  }
  if (checkMenuFlag.value && checkMenuFlag.value == res.id) {
    checkMenuFlag.value = null;
@@ -71,16 +164,69 @@
    checkMenuFlag.value = res.id;
    menuTool.leftTools(res);
  }
  if (res.id == "l1") {
    store.state.setLayerManager = !store.state.setLayerManager;
  } else {
    store.state.setLayerManager = false;
  }
};
onMounted(() => {
  menuOptions.value = menuData.leftMenu;
const setCloseLayer = (res) => {
  store.state.setLayerManager = false;
};
const setCloseplotting = (res) => {
  checkMenuFlag.value = null;
};
// 切换浏览器全屏
const screen = () => {
  fullScreen.value = !fullScreen.value;
  if (fullScreen.value) {
    // 退出全屏
    if (document.exitFullscreen) {
      document.exitFullscreen();
    } else if (document.mozCancelFullScreen) {
      document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
      document.webkitExitFullscreen();
    }
  } else {
    var element = document.body;
    if (element.requestFullscreen) {
      element.requestFullscreen();
    } else if (element.mozRequestFullScreen) {
      element.mozRequestFullScreen();
    } else if (element.webkitRequestFullscreen) {
      element.webkitRequestFullscreen();
    } else if (element.msRequestFullscreen) {
      element.msRequestFullscreen();
    }
  }
};
// 监听浏览器全屏事件
document.addEventListener("fullscreenchange", () => {
  if (!isFullScreen()) {
    if (!fullScreen.value) {
      fullScreen.value = !fullScreen.value;
    }
  }
});
// 判断是否全屏
function isFullScreen() {
  return (
    document.isFullScreen ||
    document.mozIsFullScreen ||
    document.webkitIsFullScreen
  );
}
menuOptions.value = menuData.leftMenu;
onMounted(() => {});
</script>
<style lang="less" scoped>
.menus {
  position: absolute;
  top: 27px;
  left: 14px;
  left: 0px;
  z-index: 40;
  .logo_box {
    display: flex;
    align-items: center;
@@ -96,7 +242,7 @@
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #ffffff;
        line-height: 9px;
        line-height: 35px;
      }
      .logo_name_b {
        text-align: center;
@@ -106,13 +252,14 @@
    }
  }
  .menus_box {
    background: url("../assets/img/矩形 1.png");
    background: rgba(1, 10, 28, 0.68);
    left: 7px;
    position: absolute;
    top: 105px;
    top: 83px;
    width: 71px;
    height: 628px;
    padding: 36px 0px;
    height: 680px;
    z-index: 40;
    box-sizing: border-box;
    .imgBox {
      width: 100%;
      display: flex;
@@ -126,16 +273,45 @@
    }
  }
}
.setDobuleMap {
  position: absolute;
  top: 105px;
  right: calc(50% - 50px);
  z-index: 30;
  width: 20px;
  height: 20px;
  color: #d6e4ff;
  background: rgba(7, 8, 14, 0.8);
  box-shadow: inset 0px 10px 40px 10px rgba(38, 47, 71, 1);
  padding: 10px;
}
.menu_Image_box {
  box-sizing: border-box;
  height: 100%;
  width: 100%;
  padding-top: 36px;
  background: url("../assets/img/矩形 1.png") no-repeat;
  background-size: 100% 100%;
}
.content_box {
  position: absolute;
  top: 135px;
  left: 100px;
  // top: 135px;
  top: 110px;
  left: 80px;
  display: flex;
}
.fullScreen_btn {
  // background: url("../assets/img/形状 3.png") no-repeat center;
  // background-size: 100% 100%;
  background: url("../assets/img/leftBtn/合集_03.png") no-repeat center;
  background-size: 100% 100%;
  width: 30px;
  height: 30px;
  position: absolute;
  right: 20px;
  top: 20px;
}
.fullScreen_btn:hover {
  background: url("../assets/img/leftBtn/合集_03-02.png") no-repeat center;
  background-size: 100% 100%;
  cursor: pointer;
}
</style>