<template>
  <div class="news-item">
    <new-link :item="{ news: { data: item, path: '/about/news' } }">
      <img :src="item.mobile_terminal_img_uri" class="news-item-pic" v-if="item.mobile_terminal_img_uri" />
      <div class="news-item-content">
        <div class="news-item-content__date">{{ formatDate(item.start_time) }}</div>
        <div class="news-item-content__title">{{ item.title }}</div>
        <div class="news-item-content__text" v-if="item.abstract">{{ item.abstract }}</div>
      </div>
    </new-link>
  </div>
</template>

<script>
import NewLink from '@/components/NewLink'
export default {
  components: { NewLink },
  props: { item: { type: Object } },
  methods: {
    formatDate(value) {
      const date = new Date(value * 1000)
      return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
    }
  }
}
</script>

<style lang="scss">
.news-item {
  margin-bottom: 0.1rem;
  background-color: #fff;
}
.news-item-pic {
  display: block;
  width: 100%;
  // height: 2.99rem;
  object-fit: cover;
}
.news-item-content {
  padding: 0.18rem;
}
.news-item-content__date {
  font-size: 0.1rem;
  color: #aa1941;
  line-height: 0.16rem;
}
.news-item-content__title {
  margin-top: 0.1rem;
  font-size: 0.14rem;
  font-weight: 500;
  color: #333;
  line-height: 0.24rem;
}
.news-item-content__text {
  margin-top: 0.2rem;
  font-size: 0.1rem;
  line-height: 0.2rem;
}
</style>
