<template>
  <!-- ppt -->
  <div class="Ppt">
    <div class="top">
      <div class="title">
        <span class="icon">P</span>
        <span class="text"> PPT </span>
      </div>
    </div>
    <div class="class_list">
      <div v-for="(item, i) in classList" :key="i">
        <img lazy src="../../assets/teacherdev/ppt.png" alt="" />
        <p class="one_name">{{ item.name }}</p>
        <p class="price">
          $
          <span class="price_1" v-text="changePrice('1', item.price)"></span>
          <span class="price_2" v-text="changePrice('2', item.price)"></span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["classList"],
  data() {
    return {};
  },
  methods: {
    // 处理价格
    changePrice(type, item) {
      if (item.indexOf(".") != -1) {
        if (type == 1) {
          return item.split(".")[0];
        } else if (type == 2) {
          return "." + item.split(".")[1];
        }
      } else {
        if (type == 1) {
          return item;
        }
      }
    },
  },
};
</script>

<style lang="scss"  scoped>
.Ppt {
  .top {
    width: 1200px;
    margin: 0 auto;
    display: flex;
    height: 100px;
    justify-content: space-between;
    line-height: 100px;

    .title {
      font-weight: bold;
      font-size: 30px;
      .icon {
        display: inline-block;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: linear-gradient(215.75deg, #ff881a 17.74%, #ffc077 82.17%);
        text-align: center;
        margin-right: 16px;
        color: white;
        font-size: 20px;
        line-height: 42px;
      }
      .text {
        position: relative;
        top: 10px;
      }
    }
  }
  .class_list {
    width: 1200px;
    margin: 0 auto;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: 50px;
    > div {
      margin: 0 0 0 32px;
      width: 192px;
      height: 356px;
      overflow: hidden;
      transition: all 1s;
      .one_name {
        width: 90%;
        height: 50px;
        margin-top: 10px;
        word-break: break-all;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        text-overflow: ellipsis;
        overflow: hidden;
        font-size: 14px;
        color: #2c2c2c;
      }
      .price {
        font-weight: bold;
        color: #2c2c2c;
        font-size: 24px;
        .price_2 {
          font-size: 16px;
        }
      }
      p {
        font-size: 16px;
        margin-left: 10px;
      }
      img {
        width: 100%;
        height: 60%;
        cursor: pointer;
      }
      .gray {
        color: #a3a3a3;
      }
      .origin {
        color: #ff9900;
      }
    }
    .more {
      background: url("../../assets/teacherdev/image 13.png") center;
      position: relative;
      .shade {
        position: absolute;
        width: 100%;
        height: 100%;
        background: #000000;
        opacity: 0.6;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        > div {
          img {
            width: 58px;
            height: 58px;
          }
          span {
            position: relative;
            color: white;
            top: -20px;
          }
        }
      }
    }
  }
}
</style>