<template>
  <card title="项目公告">
    <template #header-aside><nuxt-link to="">查看更多+</nuxt-link></template>
    <div class="future">
      <div class="future-left">即将开始的<br />课程日期</div>
      <div class="future-right">
        <div class="future-item" v-for="(item, index) in futureList" :key="index">
          <div class="future-item__title">{{ item.title }}</div>
          <div class="future-item__date">{{ formatDate(item.created_time) }}</div>
        </div>
      </div>
    </div>
    <div class="list">
      <div class="list-item" v-for="(item, index) in list" :key="index">
        <div class="list-item__date">
          <p class="t1">{{ formatMD(item.created_time) }}</p>
          <p class="t2">{{ formatYY(item.created_time) }}</p>
        </div>
        <div class="list-item__title">{{ item.title }}</div>
      </div>
    </div>
  </card>
</template>

<script>
import Card from '@/components/Card'
export default {
  components: { Card },
  data() {
    return {
      futureList: [
        { title: 'KELLEY商学院金融硕士（MSF）开学典礼', created_time: '2020-01-22 14:41:08' },
        { title: '酒店管理HMBA报名截止日', created_time: '2020-01-22 14:41:08' }
      ],
      list: [
        { title: '清华、交大等名校本硕博齐聚，全美第一在线金融硕士盛大开学！', created_time: '2020-01-22 14:41:08' },
        { title: '紫荆·国际金融人才论坛重磅发布“中国未来金融领袖计划”', created_time: '2020-01-22 14:41:08' }
      ]
    }
  },
  methods: {
    // 2月14日
    formatDate(value) {
      const date = new Date(value)
      return date.getMonth() + 1 + '月' + date.getDate() + '日'
    },
    // 2021
    formatYY(value) {
      const date = new Date(value)
      return date.getFullYear()
    },
    // 2/14
    formatMD(value) {
      const date = new Date(value)
      return date.getMonth() + 1 + '/' + date.getDate()
    }
  },
  fetch() {}
}
</script>

<style lang="scss" scoped>
.future {
  display: flex;
  align-items: center;
  background-color: #fff;
  padding: 0.15rem 0.22rem;
}
.future-left {
  width: 0.75rem;
  font-size: 0.15rem;
  color: #424242;
  text-align: center;
}
.future-right {
  flex: 1;
  padding-left: 0.28rem;
}
.future-item {
  display: flex;
  align-items: center;
  padding: 0.15rem 0;
}
.future-item + .future-item {
  border-top: 1px solid #999;
}
.future-item__title {
  flex: 1;
  font-size: 0.1rem;
  text-align: center;
}
.future-item__date {
  width: 0.8rem;
  font-size: 0.15rem;
  color: #aa1941;
  text-align: center;
}

.list-item {
  display: flex;
  align-items: center;
  padding: 0.13rem 0;
  border-bottom: 1px solid #e3e3e3;
}
.list-item__date {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex: 0 0 0.7rem;
  height: 0.54rem;
  color: #fff;
  background-color: #aa1941;
  border-radius: 0.04rem;
  .t1 {
    font-size: 0.16rem;
    opacity: 0.8;
  }
  .t2 {
    font-size: 0.13rem;
    opacity: 0.8;
  }
}
.list-item__title {
  margin-left: 0.13rem;
  font-size: 0.13rem;
  color: #424242;
  line-height: 0.26rem;
}
</style>
