<template>
  <div class="content">
    <!-- 天气区域 -->
    <div class="weather">
      <img class="weather_img" src="@/assets/images/sun.png" />
      晴 5℃
    </div>
    <!-- 头部标题区域 -->
    <div class="title">智慧教室统一管控平台</div>
    <!-- 时间区域 -->
    <div class="time">
      <div class="time_date">{{ currentDate }}</div>
      <div>{{ currentTime }}</div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { getCurrentTime } from '@/utils/getTime.js'

// 当前日期星期
const currentDate = ref('')
// 当前时分秒
const currentTime = ref('')

onMounted(() => {
  getTimeData()
})

const getTimeData = () => {
  currentDate.value = getCurrentTime().currentDate
  currentTime.value = getCurrentTime().currentTime
  setInterval(() => {
    currentDate.value = getCurrentTime().currentDate
    currentTime.value = getCurrentTime().currentTime
  }, 1000)
}
</script>
<style lang="scss" scoped>
.content {
  position: relative;
  margin-bottom: 25px;
  height: 98px;
  color: #fff;
  background-image: url(@/assets/images/room-header-bg.png);
  background-size: 100% 100%;

  .weather {
    position: absolute;
    top: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 368px;
    height: 70px;
    font-size: 16px;

    .weather_img {
      margin-right: 10px;
      width: 30px;
      height: 30px;
    }
  }
  .title {
    position: absolute;
    top: 10px;
    left: 745px;
    height: 65px;
    font-size: 42px;
    font-weight: bold;
  }
  .time {
    position: absolute;
    top: 25px;
    right: 0;
    display: flex;
    align-items: center;
    width: 368px;
    height: 70px;
    font-size: 16px;

    .time_date {
      margin: 0 15px 0 75px;
    }
  }
}
</style>
