forked from drone/command-center-dashboard

chenyao
2025-03-29 48bc5ec76be628ed581d3201150bddaeaadeed3e
src/views/Home/components/HomeLeft/HomeLeft.vue
@@ -1,15 +1,7 @@
<template>
  <div class="home-left">
    <!--时间 天气-->
    <div class="time-weather">
      <div class="time">{{ time }}</div>
      <div class="line"></div>
      <div class="weather">
        <img src="@/assets/images/home/homeLeft/tq.png" alt="" />
        <span class="tq">阴天</span>
        <span class="qk">适合飞行</span>
      </div>
    </div>
    <common-weather></common-weather>
    <!--机巢概况-->
    <overview-next></overview-next>
    <!--巡检任务情况-->
@@ -20,23 +12,8 @@
<script setup>
import OverviewNext from './OverviewNext.vue';
import InspectionRaskDetails from './InspectionRaskDetails.vue';
import dayjs from 'dayjs';
import CommonWeather from '@/components/CommonWeather.vue';
const time = ref('');
const updateTime = () => {
    time.value = dayjs().format('YYYY.MM.DD HH:mm:ss');
};
onMounted(() => {
    updateTime(); // 立即执行一次
    time.value = setInterval(updateTime, 1000);
});
onUnmounted(() => {
    if (time.value) {
        clearInterval(time.value);
        time.value = null;
    }
});
</script>
<style scoped lang="scss">
@@ -44,34 +21,5 @@
  position: absolute;
  top: 88px;
  color: #e7f5ff;
  .time-weather {
    margin-left: 45px;
    width: 310px;
    font-size: 14px;
    height: 36px;
    line-height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .line {
      border: 1px solid #ffffff;
      height: 10px;
      opacity: 0.5;
    }
    .weather {
      img {
        width: 20px;
        height: 20px;
      }
      .tq {
        margin: 0 5px;
        color: #e7f5ff;
      }
      .qk {
        margin-left: 5px;
        color: #04f043;
      }
    }
  }
}
</style>