<template>
  <el-card class="popular-card">
    <div slot="header" class="popular-header">
      <img src="../../assets/img/crowd-contest.png" alt="hot-crowd" class="popular-header-img"/>
      <span class="popular-header-title">众测大赛</span>
      <el-button style="float: right; padding: 3px 0;line-height: 25px" type="text"  @click="getMore()">>></el-button>
    </div>
    <div class="popular-list">
      <el-row class="popular-list-item" v-for="item in competitionList" :key="item.id">
        <el-col :span="23" @click.native="gotoDetail(item)">
          <img :src="logo_background" alt="logo-project" class="pull-left project-logo-img">
          <div style="margin-left: 55px">
            <div class="list-item-title">
              {{item.name}}
            </div>
            <div class="list-item-info">
              {{$moment(item.startTime).format("YYYY-MM-DD HH:mm:ss")}}
            </div>
          </div>
        </el-col>
        <el-col :span="1">
          <div class="project-people-number">
            >
          </div>
        </el-col>
      </el-row>
    </div>
  </el-card>
</template>

<script>
  import {CONFIG} from '../../config/index'
  export default {
    name: 'HotContest',
    props:['competitionList'],
    data(){
      return {
        logo_background:CONFIG.logo_background
      }
    },
    methods:{
        getMore(){
            this.$router.push({
                name: 'CompetitionList',
            });
        },
        gotoDetail(item){
            window.open(item.linkUrl)
        }
    }
  }
</script>

<style lang="scss">
  @import "../../style/main";
  .popular-card {
    margin-bottom: 5px;
  }
  .popular-header .el-card__header{
    border-bottom: 2px solid rgba(0,117,203,1) !important;
  }

  .popular-card .el-card__body{
    padding: 0 !important;
  }
  .popular-header {
    height: 25px;
    vertical-align:middle;
  }
  .popular-header-title {
    display: inline-block;
    line-height: 25px;
    vertical-align:middle;
  }
  .popular-header-img {
    height: 25px;
    width: 25px;
    vertical-align:middle;
  }

  .popular-list {
    .popular-list-item {
      padding: 4px 10px;
      border-bottom: 1px solid #ccc !important;

      .list-item-title {
        font-size: 14px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: rgba(0, 0, 0, 1);
        overflow: hidden;
        text-overflow: ellipsis; //溢出用省略号显示
        white-space: nowrap; //溢出不换行
      }

      .single-line-title{
        line-height: 48px;
      }

      .list-item-info {
        font-size: 14px;
        font-family: Adobe Heiti Std;
        font-weight: normal;
        color: rgba(153, 153, 153, 1);
        overflow: hidden; //超出的文本隐藏
        text-overflow: ellipsis; //溢出用省略号显示
        white-space: nowrap; //溢出不换行
      }

      .project-logo-img {
        width: 44px;
        height: 44px;
        display: inline-block;
        margin: 2px 0;
      }

      .project-people-number {
        font-size: 16px;
        font-family: Roboto;
        font-weight: 400;
        line-height: 48px;
        color: $--color-primary;
      }
    }
  }
</style>
