<template>
  <AppCard :title="$t('menu.story')" class="home-alumni">
    <template #title
      ><nuxt-link to="/alumnus/story">{{
        $t('menu.story')
      }}</nuxt-link></template
    >
    <template #header-aside
      ><nuxt-link to="/alumnus/story">{{ $t('viewMore') }}</nuxt-link></template
    >
    <app-link
      v-if="listData.length > 0"
      :data="listData[0]"
      :to="`/alumnus/story/${listData[0].id}`"
    >
      <div class="alumni_content">
        <img
          class="content_img"
          :src="listData[0].web_img_uri"
          loading="lazy"
        />
        <div class="content_desc">
          <div class="desc_tit">
            {{ listData[0].title }}
          </div>
          <div class="desc_con">
            {{ listData[0].abstract }}
          </div>
        </div>
      </div>
    </app-link>
  </AppCard>
</template>
<script>
import AppCard from '@/components/AppCard'
import AppLink from '@/components/Link'
export default {
  components: { AppCard, AppLink },
  data() {
    return {
      listData: []
    }
  },
  async fetch() {
    const params = {
      project_id: process.env.projectId,
      type_tag: 'article_alumni'
    }
    this.listData = await this.$axios
      .get('/api/cms/api/v1/articles', { params })
      .then((res) => {
        return res.data.data
      })
  }
}
</script>
<style lang="scss" scoped>
.alumni_content {
  display: flex;
  height: 450px;

  .content_img {
    width: 600px;
    height: 100%;
    object-fit: cover;
  }
  .content_desc {
    width: 568px;
    height: 100%;
    margin-left: 32px;
    .desc_tit {
      margin-top: 56px;
      font-size: 20px;
      line-height: 32px;
      color: #000000;
    }
    .desc_con {
      text-align: justify;
      font-size: 16px;
      font-weight: 400;
      line-height: 34px;
      color: #666666;
      margin-top: 30px;
    }
  }
}
</style>
