123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <div class="home-index" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
- <!-- 地图 -->
- <div class="map-container" ref="mapContainer"></div>
- <!-- 新建按钮 -->
- <div class="add-button" v-show="showAddButton" @click="toSubPage">
- <el-icon class="add-button-icon"><CircleCloseFilled /></el-icon>
- <span>创建我的农场</span>
- </div>
- <!-- 天气遮罩 -->
- <div class="weather-mask" v-show="isExpanded"></div>
- <!-- 天气 -->
- <weather-info class="weather-info" @weatherExpanded="weatherExpanded"></weather-info>
- <!-- 操作按钮 -->
- <div class="operation-button">
- <div class="button-group">
- <div class="button-item">
- <img class="button-icon" src="@/assets/img/tab_bar/home-active.png" alt="">
- <span>基本信息</span>
- </div>
- <div class="button-item" @click="toFarmPhoto">
- <img class="button-icon" src="@/assets/img/home/photo-icon.png" alt="">
- <span>农场相册</span>
- </div>
- </div>
- <div class="add-farm-button">
- <el-icon class="icon"><CircleCloseFilled /></el-icon>
- <span>新增农场</span>
- </div>
- </div>
- <!-- 浮动面板 -->
- <home-floating-panel
- class="home-floating-panel"
- :style="{ zIndex: zIndex }"
- @heightChange="heightChange"
- ></home-floating-panel>
- <!-- 问题提醒 -->
- <!-- <problem-reminder></problem-reminder> -->
- </div>
- </template>
- <script setup>
- import IndexMap from "./map/index.js";
- import { onMounted, computed, ref } from "vue";
- import { useStore } from "vuex";
- import { useRouter } from "vue-router";
- import weatherInfo from "@/components/weatherInfo.vue";
- import homeFloatingPanel from "./components/homeFloatingPanel.vue";
- import problemReminder from "./components/problemReminder.vue";
- const router = useRouter();
- const store = useStore();
- const tabBarHeight = computed(() => store.state.home.tabBarHeight);
- const indexMap = new IndexMap();
- const mapContainer = ref(null);
- onMounted(() => {
- indexMap.initMap("POINT (113.61702297075017 23.584863449735067)", mapContainer.value);
- });
- const isExpanded = ref(false);
- const weatherExpanded = (isExpandedValue) => {
- isExpanded.value = isExpandedValue;
- };
- const zIndex = ref(1);
- const showAddButton = ref(true);
- const heightChange = (height) => {
- zIndex.value = 1;
- showAddButton.value = true;
- if (height === 0) {
- showAddButton.value = false;
- } else if (height > 310 + tabBarHeight.value) {
- zIndex.value = 3;
- }
- };
- function toSubPage() {
- router.push({
- path: "/create_farm",
- });
- }
- function toFarmPhoto() {
- router.push({
- path: "/farm_photo",
- });
- }
- </script>
- <style lang="scss" scoped>
- .home-index {
- position: relative;
- width: 100%;
- height: calc(100vh - 50px);
- overflow: hidden;
- .map-container {
- width: 100%;
- height: 100%;
- }
- .add-button {
- position: absolute;
- bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
- z-index: 2;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #fff;
- background-image: linear-gradient(180deg, #70bffe 0%, #2199f8 100%);
- border-radius: 25px;
- padding: 12px 0;
- width: 187px;
- .add-button-icon {
- font-size: 20px;
- margin-right: 5px;
- transform: rotate(45deg);
- }
- }
- .weather-mask {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.52);
- z-index: 2;
- }
- .weather-info {
- position: absolute;
- top: 12px;
- left: 12px;
- width: calc(100% - 24px);
- z-index: 2;
- }
- .operation-button{
- position: absolute;
- top: 117px;
- left: 12px;
- width: calc(100% - 24px);
- z-index: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 12px;
- font-weight: 500;
- .button-group{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .button-item{
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- color: rgba(0, 0, 0, 0.8);
- background-color: #fff;
- .button-icon{
- width: 13px;
- height: 13px;
- }
- }
- .button-item:first-child{
- margin-right: 10px;
- }
- }
- .add-farm-button{
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- background: rgba(0, 0, 0, 0.5);
- border: 1px solid rgba(255, 255, 255, 0.5);
- color: #fff;
- .icon{
- font-size: 16px;
- transform: rotate(45deg);
- }
- }
- .button-item,
- .add-farm-button{
- border-radius: 25px;
- padding: 8px 12px;
- }
- }
- .home-floating-panel {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- z-index: 1;
- }
- }
- </style>
|