<template>
  <AppCard title="优秀师资">
    <swiper ref="mySwiper" :options="swiperOptions" class="teacher-list">
      <swiper-slide v-for="(item, index) in list" :key="index" class="teacher-item">
        <div class="teacher-item-hd">
          <div class="teacher-item-hd-text">
            <h3>{{ item.name }}</h3>
            <h4>{{ item.project }}</h4>
            <p>{{ item.title }}</p>
          </div>
          <img :src="item.imgUrl" />
        </div>
        <div class="teacher-item-bd" v-html="item.desc"></div>
      </swiper-slide>
    </swiper>
  </AppCard>
</template>
<script>
import AppCard from '@/components/Card.vue'
export default {
  name: 'TeacherCard',
  props: { list: { type: Array, default: () => [] } },
  components: { AppCard },
  data() {
    return {
      swiperOptions: {
        autoplay: true,
        loop: true,
        slidesPerView: 'auto',
        spaceBetween: 20
      }
    }
  }
}
</script>

<style lang="scss">
.teacher-list {
  margin-bottom: 60px;
}
.teacher-item {
  position: relative;
  padding: 0.12rem;
  width: 2.4rem;
  height: 3.02rem;
  background: #a81840;
  color: #fff;
  box-sizing: border-box;
}
.teacher-item-hd {
  display: flex;
  img {
    width: 1.28rem;
    height: 1.28rem;
    object-fit: cover;
  }
}
.teacher-item-hd-text {
  flex: 1;
  overflow: hidden;
  h3 {
    font-size: 0.16rem;
    font-weight: 500;
    line-height: 0.16rem;
  }
  h4 {
    position: relative;
    margin-top: 0.1rem;
    font-size: 0.12rem;
    font-weight: 400;
    line-height: 0.12rem;
    &::after {
      content: '';
      position: absolute;
      left: 0;
      bottom: -0.05rem;
      width: 0.21rem;
      height: 0.01rem;
      background: rgba(255, 255, 255, 0.39);
    }
  }
  p {
    margin-top: 0.1rem;
    font-size: 0.12rem;
    font-weight: 400;
    line-height: 0.12rem;
  }
}
.teacher-item-bd {
  margin-top: 0.15rem;
  font-size: 0.12rem;
  font-weight: 300;
  line-height: 0.17rem;
  color: #fff;
}
</style>
