<template>
  <div class="summary5">
    <div class="summary5-item" v-for="(item, index) in data" :key="index" v-if="index < 4">
      <div class="left">
        <img :src="getImg(index)">
        <div class="corner left-top"></div>
        <div class="corner right-top"></div>
        <div class="corner left-bottom"></div>
        <div class="corner right-bottom"></div>
      </div>
      <div class="right">
        <h2>{{ item[keys] }}</h2>
        <p>{{ item[value] }}</p>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'summary5',

    props: {
      data: {
        type: Array,
        default: () => []
      },

      keys: {
        type: String,
        default: 'key'
      },

      value: {
        type: String,
        default: 'value'
      }
    },

    data () {
      return {
        img1: require('../asset/summary5-1.png'),
        img2: require('../asset/summary5-2.png'),
        img3: require('../asset/summary5-3.png'),
        img4: require('../asset/summary5-4.png')
      }
    },

    methods: {
      getImg (index) {
        return {
          '0': this.img1,
          '1': this.img2,
          '2': this.img3,
          '3': this.img4
        }[index]
      }
    }
  }
</script>

<style lang="scss" scoped>
  .summary5 {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;

    div {
      box-sizing: border-box;
    }

    .summary5-item {
      display: flex;
      position: relative;
      align-items: center;

      .right {
        min-width: 90px;
      }

      .left {
        display: flex;
        position: relative;
        align-items: center;
        justify-content: center;
        margin-right: 20px;
        width: 50px;
        height: 50px;
        box-shadow: 0 0 8px 4px #0e3a77 inset;
        background: transparent;
  
        .corner {
          height: 18px;
          width: 18px;
          position: absolute;
          display: block;
          background-image: url(./../asset/corner.svg);
          background-repeat: no-repeat;
        }
        .corner.left-top {
          left: -6px;
          top: -6px;
          transform: rotateY(180deg);
        }
        .corner.right-top {
          right: -6px;
          top: -6px;
        }
        .corner.left-bottom {
          left: -6px;
          bottom: -6px;
          transform: rotateX(180deg) rotateY(180deg);
        }
        .corner.right-bottom {
          right: -6px;
          bottom: -6px;
          transform: rotateX(180deg);
        }
      }

      h2 {
        line-height: 24px;
        color: #fff;
        font-size: 16px;
        font-weight: normal;
      }

      p {
        font-size: 26px;
        color: #fff;
        font-weight: 700;
      }
    }
  }
</style>
