<template>
  <div class="introduction-card">
    <div class="head-list">
      <div v-for="(item, index) in info.head" :key="index" class="head-item" :class="`head-item-${index}`">
        {{ item }}
      </div>
    </div>
    <div class="body-list">
      <div v-for="(item, index) in info.content" :key="index" class="body-item">
        <div class="product-name">
          <div class="title">
            {{ item.name }}
            <div v-if="item.isNew" class="isnew" />
          </div>
          <div class="label">
            {{ item.label }}
          </div>
        </div>
        <div class="product-free">
          <div v-if="item.freeClass" class="free-class" :class="item.freeClass" />
          <div v-if="item.freeText" class="free-text">
            {{ item.freeText }}
          </div>
        </div>
        <div class="product-vip">
          <div v-if="item.superClass" class="vip-class" :class="item.superClass" />
          <div v-if="item.superText" class="vip-text">
            {{ item.superText }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import contrastFunctionJson from '@/assets/js/contrast_function.js'

export default {
  name: 'IntroductionCard',
  data() {
    return {
      info: contrastFunctionJson || {
        head: [],
        content: []
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.introduction-card {
  border-radius: 12px;
  .head-list {
    display: flex;
    .head-item {
      width: 92px;
      height: 32px;
      text-align: center;
      font-size: 14px;
      line-height: 32px;
      color: #171826;
      border-radius: 12px 12px 0 0;
      background: linear-gradient(to right, #F5F5FB, #FFFFFF);
      &-0 {
        width: 175px;
      }
      &-2 {
        background: linear-gradient(to right, #FAE7CA, #F1D090);
      }
    }
  }
  .body-list {
    background: #FFFFFF;
    .body-item {
      display: flex;
      border-top: 0.5px solid rgba(0, 0, 0, 0.05);
      &:nth-child(odd) {
        background: #fff;
      }
      &:nth-child(even) {
        background: rgba(252, 252, 254, 1);
      }
      .product-name {
        padding: 12px 8px;
        width: 175px;
        text-align: center;
        border-right: 0.5px solid rgba(0, 0, 0, 0.05);
        .title {
          font-size: 14px;
          line-height: 20px;
          color: #171826;
        }
        .label {
          margin-top: 4px;
          font-size: 12px;
          line-height: 18px;
          color: #9B9CA3;
        }
      }
      .product-free, .product-vip {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 8px;
        width: 92px;
        text-align: center;
        .free-class {
          &.wrong {
            width: 100%;
            height: 100%;
            &::before {
              display: block;
              width: 100%;
              height: 100%;
              content: '';
              background: url(../../../../assets/image/icon/icon-red-close.png) no-repeat center;
              background-size: 20px 20px;
            }
          }
          &.right {
            width: 100%;
            height: 100%;
            &::before {
              display: block;
              width: 100%;
              height: 100%;
              content: '';
              background: url(../../../../assets/image/icon/icon-check.png) no-repeat center;
              background-size: 24px 24px;
            }
          }
        }
        .vip-class {
          &.right {
            width: 100%;
            height: 100%;
            &::before {
              display: block;
              width: 100%;
              height: 100%;
              content: '';
              background: url(../../../../assets/image/icon/icon-check.png) no-repeat center;
              background-size: 24px 24px;
            }
          }
        }

      }
      .product-free {
        color: #9B9CA3;
        border-right: 0.5px solid rgba(0, 0, 0, 0.05);
      }
      .product-vip {
        color: #BD7B2E;
      }
    }
  }
}
</style>
