<template>
  <div class="introduction">
    <div class="introduction__sec-title"></div>
    <div class="introduction__wrap">
      <div class="introduction__content">
        <p class="introduction__intro">{{ lotteryInfo.intro }}</p>
        <template v-if="!!lotteryInfo.isShowPrize">
          <div class="introduction__title">本场活动奖品：</div>
          <div class="introduction__prize">
            <ul
              class="introduction__list"
              :class="{ 'introduction__list--center': lotteryInfo.prizeConfigs.length < 3 }"
            >
              <li v-for="(item, index) in lotteryInfo.prizeConfigs" :key="index">
                <img v-lazy="item.icon || img" class="introduction__item-img" alt />
                <p v-if="item.prizeAlias" class="introduction__item-level">{{ item.prizeAlias }}</p>
                <p class="introduction__item-name">{{ item.name }}</p>
              </li>
            </ul>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import img from '@/assets/images/lottery/gift.png'

export default {
  name: 'Introduction',
  data() {
    return {
      img
    }
  },
  computed: {
    ...mapGetters({ lotteryInfo: 'lottery/lotteryInfo' })
  }
}
</script>

<style lang="less" scoped>
.introduction {
  width: 100%;
  border-radius: 6px;
  padding: 8px;
  position: relative;
  padding-top: 44px;
  &__sec-title {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 72px;
    background: url('~@/assets/images/lottery/intro_title.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
  }
  &__wrap {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background-color: #f6d2b6;
    padding: 6px;
  }
  &__content {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background-color: #f8e0cb;
    font-size: 12px;
    padding: 20px 14px 14px;
    color: #79420c;
  }
  &__intro {
    font-size: 12px;
    line-height: 18px;
    white-space: pre-line;
  }
  &__title {
    margin: 14px 0 10px;
  }
  &__prize {
    width: 100%;
  }
  &__list {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    &--center {
      justify-content: center;
    }
    > li {
      text-align: center;
      width: 33.3333%;
      padding: 6px;
    }
  }
  &__item-img {
    display: block;
    width: 68px;
    height: 68px;
    margin: 0 auto;
  }
  &__item-level {
    font-size: 14px;
    height: 18px;
    line-height: 18px;
    margin: 5px 0 0;
  }
  &__item-name {
    font-size: 12px;
    margin: 5px 0 0;
    line-height: 14px;
  }
}
</style>
