<template>
    <div class="the-header d-flex jc-center title_wrap">
        <div class="zuojuxing"></div>
        <div class="youjuxing"></div>
        <div class="guang"></div>
        <div class="d-flex jc-center">
            <div class="title">
                <span class="title-text">市政一公司项目承揽情况</span>
            </div>
        </div>
        <div class="timers">
            {{ dateYear }} {{ dateWeek }} {{ dateDay }}
        </div>
    </div>
</template>

<script>
import { formatTime } from "@/utils/index.js";

export default {
    name: 'TheHeader',

    data() {
        return {
            timing: null,
            dateDay: null,
            dateYear: null,
            dateWeek: null,
            weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
        }
    },

    methods: {
        timeFn() {
            this.timing = setInterval(() => {
                this.dateDay = formatTime(new Date(), "HH: mm: ss");
                this.dateYear = formatTime(new Date(), "yyyy-MM-dd");
                this.dateWeek = this.weekday[new Date().getDay()];
            }, 1000);
        },
    },

    mounted() {
        this.timeFn()
    },

    
    beforeDestroy() {
      clearInterval(this.timing);
    }
}
</script>

<style>

</style>