index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="home-index" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
  3. <!-- 地图 -->
  4. <div class="map-container" ref="mapContainer"></div>
  5. <!-- 天气遮罩 -->
  6. <div class="weather-mask" v-show="isExpanded"></div>
  7. <!-- 天气 -->
  8. <weather-info class="weather-info" @weatherExpanded="weatherExpanded"></weather-info>
  9. <!-- 浮动面板 -->
  10. <farm-floating-panel class="farm-floating-panel"></farm-floating-panel>
  11. </div>
  12. </template>
  13. <script setup>
  14. import IndexMap from "./map/index.js";
  15. import { onMounted, computed, ref } from "vue";
  16. import { useStore } from "vuex";
  17. import { useRouter } from "vue-router";
  18. import weatherInfo from "@/components/weatherInfo.vue";
  19. import farmFloatingPanel from "./components/farmFloatingPanel.vue";
  20. const router = useRouter();
  21. const store = useStore();
  22. const tabBarHeight = computed(() => store.state.home.tabBarHeight);
  23. const indexMap = new IndexMap();
  24. const mapContainer = ref(null);
  25. onMounted(() => {
  26. indexMap.initMap("POINT (113.61702297075017 23.584863449735067)", mapContainer.value);
  27. });
  28. const isExpanded = ref(false);
  29. const weatherExpanded = (isExpandedValue) => {
  30. isExpanded.value = isExpandedValue;
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. .home-index {
  35. position: relative;
  36. width: 100%;
  37. height: calc(100vh - 50px);
  38. overflow: hidden;
  39. .map-container {
  40. width: 100%;
  41. height: 100%;
  42. }
  43. .weather-mask{
  44. position: absolute;
  45. top: 0;
  46. left: 0;
  47. width: 100%;
  48. height: 100%;
  49. background-color: rgba(0, 0, 0, 0.52);
  50. }
  51. .weather-info {
  52. position: absolute;
  53. top: 12px;
  54. left: 12px;
  55. width: calc(100% - 24px);
  56. }
  57. .farm-floating-panel{
  58. position: absolute;
  59. bottom: 0;
  60. left: 12px;
  61. width: calc(100% - 24px);
  62. }
  63. }
  64. </style>
  65. <style lang="scss">
  66. .marsGreenGradientPnl {
  67. color: #FFFFFF;
  68. padding: 4px 12px 4px 10px;
  69. background: rgba(0, 0, 0, 0.3);
  70. border: 1px solid rgba(255, 255, 255, 0.6);
  71. border-radius: 8px;
  72. }
  73. </style>