<template>
  <card title="教育服务案例">
    <van-swipe class="my-swipe" :loop="true" :autoplay="5000" :show-indicators="false">
      <template v-for="(item, index) in list">
        <van-swipe-item :key="index">
          <div class="case">
            <nuxt-link :to="`/about/news/${item.id}?type=73`">
              <img :src="item.photo_uri" class="case-pic" />
              <p class="case-title">{{ item.title }}</p>
            </nuxt-link>
          </div>
        </van-swipe-item>
      </template>
    </van-swipe>
  </card>
</template>

<script>
import Card from '@/components/Card'
export default {
  components: { Card },
  data() {
    return { list: [] }
  },
  async fetch() {
    const params = { page: 1, per_page: 5, type: 73, project_id: 1013 }
    this.list = await this.$axios.$get('/api/zws/v1/cms/news', { params }).then(res => res)
  }
}
</script>

<style lang="scss" scoped>
.case {
  position: relative;
}
.case-pic {
  display: block;
  width: 100%;
  height: 1.17rem;
  object-fit: cover;
}
.case-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.24rem;
  padding: 0 0.1rem;
  font-size: 0.1rem;
  line-height: 0.24rem;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
}
</style>
