<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 futureList" :key="index">
        <div class="list-item__date">
          <p>{{ formatMD(item.created_time) }}</p>
          <p>{{ 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.getMonth() + 1 + '月' + date.getDate() + '日'
    },
    // 2/14
    formatMD(value) {
      const date = new Date(value)
      return date.getMonth() + 1 + '/' + date.getDate()
    }
  },
  fetch() {}
}
</script>
