<template>
  <div>

    <div class="box">
      <div>
        {{ time }}
      </div>
      <div>
        {{ $moment().format('yyyy/MM/DD') }}
      </div>
      <div>
        {{ $moment().format('dddd') }}
      </div>
      <div>
        {{temp}}℃ {{text}}
      </div>
      <div @click="$router.replace({path: `/wel/index`})">
        <img src="../../../../public/img/energySources/r.png" style="width: 0.2rem;height: 0.2rem;" srcset="">
        返回首页
      </div>

    </div>
    <div class="htitle">
      {{ userInfo.dept_name }}实业公司能耗监测系统
    </div>
  </div>
</template>

<script>
import { getWeather } from "@/api/energySourcesProvince/energySourcesProvince"
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      time: '',
      timeFun: null,
      temp:'',
      text:'',
    };
  },
  computed:{
    ...mapGetters(["userInfo", "permission"]),
  },
  created() {
    getWeather().then(res => {
      this.temp = res.data.now.temp
      this.text = res.data.now.text
    })
    this.timeFun = setInterval(() => {
      this.time = this.$moment().format('HH:mm:ss')
    }, 1000)
    // this.timeFun()
  },
  methods: {
  },
  beforeDestroyed() { 
    clearInterval(this.timeFun)
  },
};
</script>
<style lang="scss" scoped>
.box {
  width: calc(100% - 0.48rem);
  height: 0.54rem;
  display: flex;
  color: #85AADD;
  box-sizing: border-box;
  position: absolute;
  top: 0.16rem;
  left: 0.24rem;

  div {

    vertical-align: sub;
  }

  div:nth-child(1) {
    font-size: 0.3rem;
    font-family: Microsoft YaHei;
    font-weight: bold;
  }

  div:nth-child(2) {
    font-size: 0.2rem;
    line-height: 0.48rem;
    margin-left: 0.2rem;
  }

  div:nth-child(3) {
    font-size: 0.2rem;
    line-height: 0.48rem;
    margin-left: 0.14rem;
  }

  div:nth-child(4) {
    font-size: 0.2rem;
    line-height: 0.48rem;
    margin-left: 0.36rem;
  }
  div:nth-child(5) {
    font-size: 0.2rem;
    line-height: 0.48rem;
    position: absolute;
    top: 0;
    right: 10px;
  }
}

.htitle {
  position: absolute;
  top: 0.18rem;
  left: 7.2rem;
  width: 4.82rem;
  height: 0.46rem;
  text-align: center;
  font-size: 0.34rem;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #FFFFFF;
  text-shadow: 3px 4px 2px rgba(0, 0, 0, 0.2);
  background: linear-gradient(-12deg, #C9E7FF 0%, #ECFCFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
</style>
