<template>
  <div class="main">
    <div
      :style="{styleObj}"
    >
      <div class="intro">
        <div class="intro__title">活动介绍</div>
        <div class="intro__detail">{{ lotteryInfo.intro }}</div>
      </div>
      <div class="rule">
        <div class="rule__sub">本场活动奖品:</div>
        <div class="intro__rewards">
          <div v-for="item in lotteryInfo.prizeConfigs" :key="item.id" class="intro__rewards-item">
            <img v-if="item.icon" :src="item.icon" alt="" />
            <img v-else src="./img/gift.png" alt="" />
            <div>{{ item.name }}</div>
          </div>
        </div>
      </div>
      <div v-if="lotteryInfo.nextPlayPrizeConfigs.length > 0" class="rule">
        <div class="rule__sub">下一场活动奖品:</div>
        <div class="intro__rewards">
          <div v-for="item in lotteryInfo.nextPlayPrizeConfigs" :key="item.id" class="intro__rewards-item">
            <img v-if="item.icon" :src="item.icon" alt="" />
            <img v-else src="./img/gift.png" alt="" />
            <div>{{ item.name }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { LOTTERY_STATUS } from '@/utils/constant'
// 倒计时逻辑处理
import CountDown from '@/mixins/CountDown'

export default {
  mixins: [CountDown],
  data() {
    return {
      LOTTERY_STATUS,
      timer: null
    }
  },
  computed: {
    ...mapGetters({
      isLogin: 'users/isLogin',
      lotteryInfo: 'lottery/lotteryInfo'
    }),
    styleObj() {
      return `height: ${this.$route.path === '/mini/index' ? '65.5vh' : this.lotteryInfo.showType === 7 ? '46.5vh' : '37.5vh'}`
    }
  },
}
</script>
<style lang="less" scoped>
.main {
  width: calc(100% - 48px);
  height: 100%;
  // padding: 0 13px;
  // overflow-x: auto;
  display: flex;
  flex-direction: column;
  .intro {
    // margin-bottom: 24px;
    // height: 30%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 30px;
    &__title {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #fff6da;
      line-height: 22.5px;
      text-align: center;
    }
    // &__sub {
    //   font-size: 14px;
    //   font-family: PingFangSC-Regular, PingFang SC;
    //   font-weight: 400;
    //   color: #fff6da;
    //   // line-height: 20px;
    //   // margin-top: 4%;
    //   margin-left: 16px;
    // }
    &__detail {
      width: 335px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #fff6da;
      line-height: 20px;
      // margin-top: 15px;
      margin-left: 16px;
      margin-top: 16px;
      white-space: pre-wrap;
      word-wrap: break-word;
    }
    &__rewards {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      flex-wrap: wrap;
      // margin-top: 15px;
      &-item {
        width: 33%;
        display: inline-block;
        font-size: 13px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #fff6da;
        line-height: 18.5px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        margin-bottom: 12px;
        img {
          width: 48px;
          height: 48px;
          border-radius: 2px;
        }
        div {
          width: 100%;
          margin-top: 4px;
          text-align: center;
          height: 38.5px;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          overflow: hidden;
          white-space: pre-wrap;
          word-wrap: break-word;
        }
      }
    }
  }
  .rule {
    // height: 44%;
    display: flex;
    flex-direction: column;
    &__sub {
      // font-size: 16px;
      // font-family: PingFangSC-Medium, PingFang SC;
      // font-weight: 500;
      // color: #fff6da;
      // line-height: 22.5px;
      // text-align: center;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #fff6da;
      line-height: 20px;
      // margin-top: 4%;
      margin-left: 16px;
      margin-bottom: 15px;
    }
    &__detail {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #fff6da;
      line-height: 20px;
      // margin-top: 15px;
      margin-left: 16px;
    }
  }
}
</style>
