<template>
  <div class="page">
    <div class="page-top"></div>
    <div class="page-content">
      <div class="control">
        <div class="search">
          <el-input placeholder="搜索登录账户后四位或所属机构">
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input>
        </div>
        <div class="publish" @click="onPublish">发布视频</div>
      </div>
      <div class="video-content">
        <div class="title">视频排名</div>
        <div class="video-list">
          <div class="video" v-for="(i, index) in 7" :key="index">
            <div class="cover">
              <img src="https://picsum.photos/288/198" alt="" />
              <div class="name">医用透明质酸钠凝胶</div>
              <div class="rank" :class="'rank-0' + (index + 1)">
                {{ index + 1 }}
              </div>
              <div class="play"></div>
            </div>
            <div class="info">
              <div class="club-name">上海禾雅堂科技有限公司</div>
              <div class="mobile">137****6611</div>
            </div>
            <div class="foot">
              <div class="date">2022-09-28</div>
              <div class="praise">90</div>
              <div class="pv">513</div>
            </div>
          </div>
        </div>
        <!-- 列表为空 -->
        <SimpleEmpty
          name="icon-empty-video.png"
          description="敬请期待~"
        ></SimpleEmpty>

        <SimpleDialog
          v-model="dialog"
          :confirmText="dialogOption.confirmText"
          :description="dialogOption.description"
          :cancel="dialogOption.cancel"
          @confirm="onConfirm"
          @cancel="onCancel"
        ></SimpleDialog>
      </div>
    </div>
  </div>
</template>

<script>
/**
 * 抱歉，活动已结束，暂无法发布视频！
 * 抱歉，由于您未认证机构，无法参与！
 * 抱歉，平台规定每个用户只能发布一个视频，由于您已发布过视频，请勿再次发布！
 *
 * 确认证
 */

import { mapGetters } from 'vuex'
export default {
  layout: 'app-ross',
  data() {
    return {
      dialog: false,
      dialogOption: {
        confirmText: '确定',
        description: '抱歉，活动已结束，暂无法发布视频！',
        cancel: false,
      },
    }
  },
  computed: {
    ...mapGetters(['routePrefix']),
  },
  methods: {
    onConfirm() {},
    onCancel() {},
    // 去发布视频
    onPublish() {
      const url = `${this.routePrefix}/activity/challenge/publish`
      this.$router.push(url)
    },
  },
}
</script>

<style lang="scss" scoped>
@mixin ellipsis($line: 1) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: $line;
  -webkit-box-orient: vertical;
}

@media screen and (min-width: 768px) {
  .page {
    background: #fff;
    min-height: calc(100vh - 80px - 80px);
    .page-top {
      width: 100%;
      height: 530px;
      background-position: center;
      background: #ddd;
    }

    .page-content {
      width: 1200px;
      margin: 0 auto;
      padding-bottom: 80px;

      .control {
        display: flex;
        align-items: center;
        padding: 32px 0;
        .publish {
          width: 120px;
          height: 46px;
          text-align: center;
          line-height: 46px;
          background: #f3920d;
          color: #fff;
          font-size: 16px;
          border-radius: 4px;
          cursor: pointer;
          transition: all 0.2s;
          margin-left: 48px;

          &:hover {
            background: #e98d0d;
          }
        }

        .search {
          flex: 1;
          flex-shrink: 0;
          .el-input {
            height: 46px;
            font-size: 16px;
            .el-input__icon {
              font-size: 24px;
              line-height: 46px;
              margin-left: 12px;
            }

            ::v-deep {
              & > .el-input__inner {
                height: 46px;
                padding-left: 55px;
              }
            }
          }
        }
      }

      .video-content {
        .title {
          font-size: 16px;
          color: #282828;
          font-weight: bold;
          margin: 16px 0;
        }

        .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>
