<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">
            <new-link :item="{ news: { data: item, path: '/about/news' } }">
              <img :src="item.web_img_uri" class="case-pic" />
              <p class="case-title">{{ item.title }}</p>
            </new-link>
          </div>
        </van-swipe-item>
      </template>
    </van-swipe>
    <!-- 、、阿萨德 -->
  </card>
</template>

<script>
import Card from '@/components/Card'
import NewLink from '@/components/NewLink'
export default {
  components: { Card, NewLink },
  data() {
    return { list: [] }
  },
  async fetch() {
    const params = { project_id: process.env.projectId, type_tag: 'service_case' }
    this.list = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => res.data.data)
  }
}
</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>
