<template>
  <div class="item-box">
    <img :src="data.cover_pc_url" alt="">
    <div class="right-content">
      <div class="title">{{ data.title }}</div>
      <!-- v-html="data.additional" -->
      <div class="des-box">
        <!-- <p class="ind">计划时间：3.24-3.26</p> -->
        <p>计划时间：3.24-3.26</p>
        <!-- <p class="ind">ISBN：基础数据维护及档案管理</p> -->
        <p>计划人数：50</p>
      </div>
      <router-link :to="`/train/detail?id=${data.id}`">
        <div class="detail-btn">在线报名</div>
      </router-link>
    </div>
    <div class="right-time">
      <div class="week">{{ setDate('w') }}</div>
      <div class="time">{{ setDate('m') }}</div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
      input: ''
    }
  },
  computed: {
    setDate() {
      return (type) => {
        const date = new Date(this.data.published_time)
        let reData = ''
        if (type === 'w') {
          reData = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[date.getDay()]
        } else {
          reData = date.getMonth() + 1 +'月'+ date.getDate() +'日'
        }
        return reData
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.item-box{
  padding: 24px 0;
  border-bottom: 1px solid #eee;
  display: flex;
  img{
    width: 180px;
    height: 100px;
    display: block;
  }
  .right-content{
    margin-left: 24px;
    .title{
      font-size: 18px;
      font-weight: bold;
      color: #C01540;
      line-height: 25px;
      width: 400px;
    }
    .des-box{
      width: 400px;
      margin-top: 24px;
      p{
        font-size: 14px;
        color: #717171;
        line-height: 20px;
        margin-bottom: 8px;
        &.ind{
          text-indent: 2em;
        }
      }
    }
    .detail-btn{
      color: #fff;
      text-align: center;
      line-height: 36px;
      width: 96px;
      height: 36px;
      background: linear-gradient(315deg, rgba(225, 47, 116, 0.83) 0%, #C01540 100%);
      border-radius: 4px;
      margin-top: 16px;
    }
  }
}
.right-time{
  margin-left: auto;
  width: 77px;
  height: 59px;
  background: url(https://zws-imgs-pub.ezijing.com/static/public/30ec4d9c7c282da2e3dae066b00b180b.png);
  background-size: 100% 100%;
  position: relative;
  .week{
    text-align: center;
    font-size: 12px;
    color: #FFFFFF;
    line-height: 12px;
    margin-top: 6px;
  }
  .time{
    margin-top: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #666666;
    line-height: 22px;
  }
}
</style>
