<script setup lang="ts">
import dayjs from 'dayjs'
import TopImg from '../../../assets/image/screenTopImg.png'
import { onUnmounted, onMounted, computed, ref } from 'vue'
const nowTimer = ref(null) as any
const nowDate = ref('')

const getTime = () => {
  nowDate.value = dayjs().format('YYYY-MM-DD HH:mm')
}

const getWeek = computed(() => {
  const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  const weekIndex = dayjs().day()
  return week[weekIndex]
})
onMounted(() => {
  nowTimer.value = setInterval(() => {
    getTime()
  }, 1000)
})

onUnmounted(() => {
  clearInterval(nowTimer.value)
})
</script>

<template>
  <div class="custom-screen-header">
    <img :src="TopImg" alt="" class="top-img" />
    <div class="time">{{ nowDate }} <span class="week"> {{ getWeek }} </span></div>
    <div class="title">资产风险态势</div>
  </div>
</template>

<style scoped lang="scss">
.custom-screen-header {
  display: flex;
  position: relative;
  width: 100%;
  padding: 0 24px;
  height: 78px;
  box-sizing: border-box;
  font-family: 'MicrosoftYaHei';

  .top-img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 78px;
    box-sizing: border-box;
    z-index: 0;
  }

  .time {
    position: absolute;
    right: 30px;
    top: 30px;
    width: 30%;
    font-weight: 400;
    font-size: 16px;
    color: #ffffff;
    margin-top: 15px;
    color: #23CEFF;
    width: 205px;
    min-width: 205px;

    .week {
      margin-left: 10px;
    }
  }

  .title {
    position: absolute;
    width: 100%;
    font-size: 36px;
    font-family: 'MicrosoftYaHei';
    color: #ffffff;
    text-align: center;
    font-weight: bold;
    text-shadow: 2px 3px 4px rgba(185, 215, 249, 0.5900);
    letter-spacing: 5px;
    z-index: 1;
    font-family: 'MicrosoftYaHei';
    margin-top: 10px;
  }

  .week {
    width: 30%;
    font-family: 'MicrosoftYaHei';
    text-align: right;
    font-weight: 400;
    color: #ffffff;
    font-size: 18px;
    text-shadow: 0px 6px 5px rgba(0, 252, 255, 0.18);
    background: linear-gradient(0deg, #1eaff2 0%, #82e0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 15px;
  }

  .fullscreen-img {
    width: 120px;
    height: 44px;
    background: #000d48;
    border-radius: 2px;
    cursor: pointer;
    z-index: 10;
    position: fixed;
    right: 20px;
    top: 3px;
  }

  .inset {
    position: fixed;
    top: 14px;
    right: 41px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    cursor: pointer;
  }

  .icon {
    width: 22px;
    height: 22px;
    fill: #00c6ff;
  }

  .font {
    font-size: 18px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #00c6ff;
    padding-left: 20px;
  }
}
</style>
