<template>
  <div class="down-time">
    <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>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
  name: 'player-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 {
  margin-bottom: 0.1rem;
  padding: 0.06rem;
  display: flex;
  align-items: center;
  height: 0.6rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.6rem;
  .icon-box {
    flex: 0 0 auto;
    width: 0.48rem;
    height: 0.48rem;
    background: linear-gradient(#f0cb6c, #f4a281);
    border-radius: 100%;
    .icon {
      width: 100%;
      height: 100%;
      background: url(./img/icon-time.png) no-repeat center center;
      background-size: 50% auto;
    }
  }
  .text {
    flex: 0 0 auto;
    padding: 0 0.08rem;
    line-height: 0.2rem;
    color: #fff;
    font-size: 0.16rem;
    width: 1.6rem;
  }
}
</style>
