安琪酵母(西藏)益生菌信息采集中心智能实验室
longyvfengyun
2023-06-30 09ab26b8df36c5ebd7cfc20a862011fb98681588
src/views/home/index.vue
@@ -1,21 +1,68 @@
<script setup>
import {onMounted, onUnmounted, ref, watch} from "vue";
import MapPin from "@/components/MapPin.vue";
import slideMenu from "@/views/mainLayout/js/slideMenu";
import homeContentModule from "@/views/home/js/homeContentModule";
import homeInfoModule from "@/views/home/js/homeInfoModule";
import FlexLayout from "@/components/FlexLayout.vue";
const isShowMapPin = ref(true);
const {
   isCollapse
} = slideMenu();
const {
   homeContentDom,
   cWidth, cHeight,
   dWidth, dHeight,
   setContainerSize
} = homeContentModule();
const {homeInfo} = homeInfoModule();
watch(isCollapse, ()=>{
   isShowMapPin.value = false;
   setTimeout(()=>{
      isShowMapPin.value = true;
      setContainerSize();
   }, 500);
});
onMounted(()=>{
   setContainerSize();
   // 监听windows窗口的缩放,绑定resize事件
   window.addEventListener("resize", setContainerSize);
});
onUnmounted(()=>{
   // 销毁resize事件
   window.removeEventListener("resize", setContainerSize);
});
</script>
<template>
   <flex-layout>
      <div class="home-content">
   <div class="home-content" ref="homeContentDom">
      <map-pin
         v-if="isShowMapPin"
         v-for="(item, index) in homeInfo" :key="'key'+index"
         :visible="item.pos.visible"
         :name="item.name"
         :c-width="cWidth" :c-height="cHeight"
         :d-width="dWidth" :d-height="dHeight"
         :x="item.pos.x" :y="item.pos.y"
         :info="item.info"></map-pin>
      <div class="card-box-list">
      </div>
   </flex-layout>
   </div>
</template>
<style scoped>
.home-content {
   position: relative;
   height: 100%;
   background-image: url("./images/home.png");
   background-image: url("./images/home-plus.png");
   background-repeat: no-repeat;
   background-size: 100% 100%;
}