<template>
  <div class="xtjc-left-side" v-show="mapStore.rightSideMenu">
    <!-- 气象一览 -->
    <!-- <meteorologicalOverview :oneHourPrecipitation="rainLiveImg.rainLiveImgData['hourly-precipitation']" /> -->
    <meteorologicalOverview />
    <!-- 卫星云图 -->
    <nephogram />
    <!-- 雷达图 -->
    <radar />
  </div>
</template>

<script lang="ts" setup>
import { onMounted, reactive } from 'vue';
import meteorologicalOverview from './components/meteorologicalOverview.vue';
import nephogram from './components/nephogram.vue';
import radar from './components/radar.vue';
import { useMapStore } from '/@/store/modules/map';
import { getRainLiveImg } from '/@/api/swHome/index';
import eventBus from '/@/utils/eventBus';
eventBus.on('metRefreshName', () => {
  getRainLiveImgData();
});
eventBus.on('metRefreshName2', () => {
  getRainLiveImgData();
});
const mapStore = useMapStore();
// 获取云图，气象，雷达反射率
let rainLiveImg = reactive({
  rainLiveImgData: {},
});
function getRainLiveImgData() {
  getRainLiveImg().then((res) => {
    rainLiveImg.rainLiveImgData = res.data;
    eventBus.emit('onHourPrecipitation', res.data['hourly-precipitation']);
    eventBus.emit('onHourSatellite', res.data['FY4A_true_color']);
    eventBus.emit('onHourAll', res.data);
    eventBus.emit('onHourRadar', res.data['Radar_xz_linzhi']);
  });
}
onMounted(() => {
  getRainLiveImgData();
});
</script>
<style lang="less" scoped>
.xtjc-left-side {
  // position: fixed;
  position: absolute;
  right: 20px;
  top: 90px;
  z-index: 3;
  width: 400px;
  // height: 100%;
}
.xtjc-left-side {
  animation-name: move;
  animation-duration: 0.5s;
  animation-fill-mode: forwards;
}
@keyframes move {
  0% {
    right: -400px;
  }
  100% {
    right: 20px;
  }
}
</style>
