<template>
  <div class="down-time">
    <div class="box">
      <div class="icon-box">
        <div class="icon"></div>
      </div>
      <div class="text">
        <div class="tip">{{ channelInfo.countdownWords || '距离直播开始还剩下' }}</div>
        <div class="time">
          {{ countDowmInfo | formatTime('dd天hh时mm分ss秒') }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
  name: 'vertical-downtime',
  data() {
    return {};
  },
  computed: {
    ...mapGetters({
      nowDate: 'nowDate',
      channelInfo: 'channelInfo'
    }),
    countDowmInfo() {
      let time = 0;
      const now = this.nowDate / 1000;
      if (now) {
        time = this.channelInfo.liveBegin - now;
      }
      time = time <= 0 ? 0 : time;
      return time;
    }
  }
};
</script>

<style lang="less" scoped>
.down-time {
  padding-left: 0.1rem;
  display: inline-block;
  .box {
    padding: 0 0.1rem 0 0.06rem;
    display: flex;
    align-items: center;
    height: 0.32rem;
    background-color: rgba(0, 0, 0, 0.29);
    border-radius: 0.4rem;
    font-size: 0;
    .icon-box {
      margin-right: 0.06rem;
      flex: 0 0 auto;
      width: 0.18rem;
      height: 0.18rem;
      .icon {
        width: 100%;
        height: 100%;
        background: url(./img/icon-time.png) no-repeat center center;
        background-size: 100% auto;
      }
    }
    .text {
      flex: 0 0 auto;
      .tip {
        height: 0.18rem;
        line-height: 0.18rem;
        color: #fff;
        font-size: 0.1rem;
      }
      .time {
        height: 0.12rem;
        line-height: 0.12rem;
        color: #fff;
        font-size: 0.09rem;
        text-align: center;
      }
    }
  }
}
</style>
