<template>
  <!-- 此页面图片没有加入预加载 -->
  <div v-if="jackpot.length" class="jackpot">
    <img class="title-img" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/chinese/MysteryChinese.png" alt="">
    <div class="grand">
      <img class="bg" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/%E7%BB%84%201(2).png " alt="">
      <div class="box">
        <div class="label-box">
          <div class="name">
            <img src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/Grand%20Mystery.png" alt="">
          </div>
          <div><img class="img" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/chinese/rangeChinese.png" alt=""></div>
        </div>
        <div class="value-box">
          <div class="value">{{ jackpot[0].currentAmount | filterToFen }}</div>
          <div class="size">{{ jackpot[0].minAmount | filterToMoney }} ~ {{ jackpot[0].maxAmount | filterToMoney }}</div>
        </div>
      </div>
    </div>
    <div class="mega">
      <img class="bg" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/Vector%20Smart%20Object%20copy%205.png" alt="">
      <div class="box">
        <div class="label-box">
          <div class="name">
            <img src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/MEGA.png" alt="">
          </div>
          <div><img class="img" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/chinese/range2Chinese.png" alt=""></div>
        </div>
        <div class="value-box">
          <div class="value">{{ jackpot[1].currentAmount | filterToFen }}</div>
          <div class="size">{{ jackpot[1].minAmount | filterToMoney }} ~ {{ jackpot[1].maxAmount | filterToMoney }}</div>
        </div>
      </div>
    </div>
    <div class="list">
      <img class="bg" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/Vector%20Smart%20Object.png" alt="">
      <template v-for="(item, index) in jackpot">
        <div v-if="index > 1" :key="index">
          <div class="item">
            <img v-if="item.currentAmount > item.fireTrigger" :style="{width: `${(190 - index * 2)}px`}" class="fire" src="https://kuawai.s3.ap-east-1.amazonaws.com/gif/fire.gif" alt="">
            <div class="label-box">
              <div class="name">{{ item.levelName }}</div>
            </div>
            <div class="value-box">
              <div class="value">{{ item.currentAmount | filterToFen }}</div>
              <div class="size">{{ item.minAmount | filterToMoney }} ~ {{ item.maxAmount | filterToMoney }}</div>
            </div>
          </div>
          <img v-if="index < 5" class="line" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/Rectangle%204%20copy%205.png" alt="">
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {
      list: [],
    }
  },
  computed: {
    ...mapState([
      'jackpot'
    ]),
  },
  created() {
    // this.network().jackpot()
  },
  methods: {
    network() {
      return {
        jackpot: () => {
          this.$request({
            url: '/api/app/jackpot/list',
            method: 'get',
          }).then(({ data }) => {
            const list = data.filter(i => i.isMulti === 0)
            const compare = (property) => {
              return function(a, b) {
                var value1 = a[property]
                var value2 = b[property]
                return value2 - value1
              }
            }
            list.sort(compare('minAmount'))
            this.list = list
            setTimeout(() => {
              this.network().jackpot()
            }, 1000)
          })
        },
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.jackpot {
  position: relative;
  .title-img {
    height: 28px;
    margin-left: 10px;
  }
  .grand {
    height: 54px;
    width: 210px;
    position: relative;
    .bg {
      position: absolute;
      right: 0;
      top: -6px;
      height: 64px;
      z-index: 20;
    }
    .box {
      display: flex;
      color: white;
      position: relative;
      z-index: 50;
      padding: 4px 0 6px;
      /* padding-bottom: 8px; */
      height: 50px;
      box-sizing: border-box;
      .label-box {
        width: 60px;
        font-size: 10px;
        display: flex;
        flex-direction: column;
        /* align-items: center; */
        justify-content: space-evenly;
        text-align: right;
        margin-right: 10px;
        .name {
          font-size: 14px;
          img {
            height: 17px;
          }
        }
        .img {
          height: 14px;
        }
      }
      .value-box {
        display: flex;
        font-size: 14px;
        flex-direction: column;
        justify-content: space-evenly;
        text-shadow: 1px 1px 1px black;
        .size {
          zoom: 0.92;
          font: 12px;
        }
      }
    }
  }
  .mega {
    height: 54px;
    width: 190px;
    position: relative;
    margin-top: -6px;
    .bg {
      position: absolute;
      right: 0;
      top: 0px;
      height: 54px;
      z-index: 10;
    }
    .box {
      display: flex;
      color: white;
      position: relative;
      z-index: 50;
      padding: 0px;
      padding-top: 4px;
      height: 50px;
      box-sizing: border-box;
      .label-box {
        width: 54px;
        font-size: 10px;
        display: flex;
        flex-direction: column;
        /* align-items: center; */
        justify-content: space-evenly;
        text-align: right;
        margin-right: 10px;
        .name {
          font-size: 14px;
          img {
            height: 17px;
          }
        }
        .img {
          height: 14px;
        }
      }
      .value-box {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        font-weight: bold;
        font-size: 14px;
        line-height: 16px;
        font-weight: bold;
        .size {
          zoom: 0.94;
          margin-top: -2px;
          font-size: 12px;
        }
        > div {
           background-image: -webkit-linear-gradient(bottom,#d9b204,#d9b204,white);
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
        }
      }
    }
  }
  .list {
    width: 170px;
    height: 222px;
    top: -10px;
    padding: 16px 0 8px 0;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .bg {
      position: absolute;
      right: 0;
      top: 0;
      width: 190px;
    }
    .item {
      position: relative;
      z-index: 60;
      display: flex;
      font-size: 12px;
      color: white;
      padding: 4px 10px 4px 6px;
      height: 32px;
      .fire {
        position: absolute;
        left: -10px;
        top: -14px;
        height: 68px;
      }
      .label-box {
        margin-right: 10px;
        width: 48px;
        font-size: 12px;
        zoom: 0.9;
      }
      .value-box {
        color: #e3bb04;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        /* text-shadow: 1px 1px 1px black; */
        font-size: 14px;
        line-height: 16px;
        .size {
          zoom: 0.9;
          font-size: 12px;
        }
        > div {
          background-image: -webkit-linear-gradient(bottom,#d9b204,#d9b204,white);
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
          font-weight: bold;
        }
      }
    }
    .line {
      height: 2px;
      display: block;
      position: relative;
      z-index: 50;
      margin-top: 5px;
    }
  }
}
</style>
