Newer
Older
VueSharedPrinting / src / components / top.vue
<template>
  <div class="top flex-between">
    <div class="logo flex-start" @click="_goHome()">
      <img src="../assets/logo.png" />
      <span></span>
      <div>天章自助打印</div>
    </div>
<!--    <div class="sbzt">{{cite.memberLoginVo?'当前设备正在被使用!':''}}</div>-->
    <div class="time flex-start">
      <div>
        <div>{{ time.week }}</div>
        <div>{{ time.y }}/{{ time.M }}/{{ time.d }}</div>
      </div>
      <div class="info">{{ time.h }}:{{ time.m }}</div>
    </div>
    <div class="tip flex-start">
      <!-- <div v-for="(item, index) in cite.facility.paperNumber" :key="index">{{ item.name }}剩余{{ item.residue }}张</div> -->
<!--      <div>{{cite.memberLoginVo?'已登录':'未登录'}}</div>-->
    </div>
  </div>
</template>

<script>
export default {
  name: "top",
  data() {
    return {
      time: {},
    }
  },
  mounted() {
    this.format()
  },
  methods: {
    add(t) {
      if(t<10) {
        return '0' + t
      }
      return t
    },
    format() {
      let date = new Date();
      let o = {
        "y": date.getFullYear(), //年
        "M": this.add(date.getMonth() + 1), //月份
        "d": this.add(date.getDate()), //日
        "h": this.add(date.getHours()), //小时
        "m": this.add(date.getMinutes()), //分
        "week": '',
      };
      let str = "星期";
      switch (date.getDay()) {
        case 0 :
          str += "日";
          break;
        case 1 :
          str += "一";
          break;
        case 2 :
          str += "二";
          break;
        case 3 :
          str += "三";
          break;
        case 4 :
          str += "四";
          break;
        case 5 :
          str += "五";
          break;
        case 6 :
          str += "六";
          break;
      }
      o.week = str
      this.time = o

      setTimeout(() =>{
        this.format()
      },1000)
    },
    _goHome() {
      // this.quit()
      this.$router.push({
        name: 'device'
      })
    }
  }
}
</script>

<style scoped lang="less">
.top {
  width: 100%;
  height: 9.81rem;
  background: #52A39D;
  position: relative;
  .logo {
    padding-left: 5.5rem;
    font-size: 3.5rem;
    font-weight: 400;
    color: #FFFFFF;
    line-height: 3.69rem;
    img {
      width: 5.56rem;
      height: 5.56rem;
    }
    span {
      width: 0;
      height: 4.43rem;
      border-left: 1px solid #FFFFFF;
      margin: 0 1.94rem;
    }
  }
  .time {
    padding-right: 3.88rem;
    font-size: 1.38rem;
    font-weight: 400;
    color: #FFFFFF;
    line-height: 1.94rem;
    text-align: right;
    .info {
      font-weight: bold;
      color: #FFFFFF;
      margin-left: 1.13rem;
      font-size: 3.69rem;
      line-height: 5.2rem;
    }
  }
  .tip {
    position: absolute;
    bottom: .5rem;
    right: 3.88rem;
    font-size: 1.2rem;
    color: #fff;
    div {
      margin-left: 2rem;
    }
  }
  .sbzt {
    font-size: 3rem;
    font-weight: bold;
    color: #FFFFFF;
  }
}
</style>