<template>
  <div class="video-list">
    <div
      class="video"
      v-for="(item, index) in list"
      :key="index"
      @click="onPlay(item)"
    >
      <div class="cover">
        <img :src="item.cover" alt="" />
        <div class="name">{{ item.title }}</div>
        <div class="rank" :class="'rank-0' + (index + 1)">
          {{ index + 1 }}
        </div>
        <div class="play" @click="onPlay(item)"></div>
      </div>
      <div class="info">
        <div class="club-name">{{ item.authParty }}</div>
        <div class="mobile">{{ item.userName | mobileFormat }}</div>
      </div>
      <div class="foot">
        <div class="date">{{ item.releaseTime | dateFormat }}</div>
        <div class="praise">{{ item.diggCount }}</div>
        <div class="pv">{{ item.playCount }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => [],
    },
  },
}
</script>

<style lang="scss" scoped>
@media screen and (min-width: 768px) {
  .video-list {
    &::after {
      content: '';
      display: block;
      clear: both;
    }

    .video {
      float: left;
      width: 288px;
      height: 356px;
      background: #fff;
      box-sizing: border-box;
      border: 1px solid #efefef;
      margin: 0 16px 16px 0;
      transition: all 0.4s;

      &:hover {
        transform: translateY(-10px);
        box-shadow: 0px 6px 16px 1px rgba(0, 0, 0, 0.1);

        .info {
          .club-name {
            color: #f3920d;
          }
        }
      }

      &:nth-child(4n) {
        margin-right: 0;
      }

      .cover {
        width: 100%;
        height: 198px;
        position: relative;

        img {
          display: block;
          width: 100%;
          height: 100%;
        }

        &::after {
          content: '';
          display: block;
          position: absolute;
          left: 0;
          top: 0;
          z-index: 1;
          width: 100%;
          height: 100%;
          background: #000;
          opacity: 0;
          transition: opacity 0.2s;
        }

        .play {
          position: absolute;
          z-index: 2;
          width: 48px;
          height: 48px;
          background: url(~assets/theme-images/common/pc-icon-play.png)
            no-repeat center;
          background-size: 48px;
          left: 50%;
          top: 50%;
          transform: translate(-50%, -50%);
          opacity: 0;
          transition: opacity 0.2s;
          cursor: pointer;
        }

        &:hover {
          .play {
            opacity: 1;
          }

          .rank,
          .name {
            opacity: 0;
          }

          &::after {
            opacity: 0.4;
          }
        }

        .name {
          color: #fff;
          font-size: 16px;
          text-align: center;
          width: 100%;
          line-height: 40px;
          @include ellipsis(1);
          box-sizing: border-box;
          padding: 0 16px;
          position: absolute;
          left: 0;
          bottom: 0;
          background: rgba(0, 0, 0, 0.5);
          transition: opacity 0.2s;
        }

        .rank {
          position: absolute;
          left: 10px;
          top: 0;
          width: 43px;
          height: 45px;
          background: url(~assets/theme-images/ross/pc-rank.png) no-repeat
            center;
          background-size: 43px;
          text-align: center;
          box-sizing: border-box;
          padding-top: 13px;
          font-weight: bold;
          color: #fff;
          font-size: 13px;
          transition: opacity 0.2s;

          &.rank-01 {
            background-image: url(~assets/theme-images/ross/pc-rank-01.png);
          }
          &.rank-02 {
            background-image: url(~assets/theme-images/ross/pc-rank-02.png);
          }
          &.rank-03 {
            background-image: url(~assets/theme-images/ross/pc-rank-03.png);
          }
        }
      }

      .info {
        padding: 24px 16px;
        .club-name {
          font-size: 18px;
          color: #282828;
          @include ellipsis(1);
        }
        .mobile {
          font-size: 16px;
          color: #666;
          margin-top: 12px;
        }
      }

      .foot {
        color: #999999;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 0 16px;
        border-top: 1px solid #efefef;
        padding-top: 12px;

        .date,
        .praise,
        .pv {
          flex-shrink: 0;
          line-height: 24px;
        }

        .praise,
        .pv {
          position: relative;
          margin-left: 16px;
          padding-left: 30px;

          &::after {
            content: '';
            display: block;
            width: 24px;
            height: 24px;
            background: url(~assets/theme-images/common/icon-praise.png)
              no-repeat center;
            background-size: 24px;
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
          }
        }

        .pv {
          &::after {
            background-image: url(~assets/theme-images/common/icon-pv.png);
          }
        }

        .date {
          margin-right: 44px;
        }
      }
    }
  }
}
</style>
