c_CourseList.vue 3.65 KB

<template>
  <div class="tab_content abroad">
    <div class="padding_box">
      <template v-for="(item, index) in list">
        <!-- <div class="uni_item_mini" :key="index" @click="handleUniDetail(item)" v-if="index<=3"> -->
        <div class="uni_item_mini" :key="index" @click="handleUniDetail(item)">
          <div class="img_box" :style="{ backgroundImage: 'url(' + item.coverUrl + ')' }">
            <div class="bottom">
              <span class="view">{{item.read_count}} 人查看</span>
            </div>
          </div>
          <div class="course_content">
            <p class="title">{{ item.course_name }}</p>
            <p class="des">{{ item.cityAddress }}</p>
          </div>
        </div>
      </template>
      <van-empty v-if="list.length == 0" :image="require('@/assets/empty.png')" description="敬请期待" />
    </div>
  </div>
</template>
<script>
export default {
  props: {
    list: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {
      active: 0,
      defaultImg: require('@/assets/service/defCoure.jpg'),
    }
  },
  methods: {
    handleUniDetail(item) {
      this.$router.push({ name: 'ServiceAbroadDetail', query: { courseId: item.id} })
    },
  },
}
</script>
<style lang="scss" scoped>
.tab_content {
  box-sizing: border-box;
  overflow: auto;
}
.tab_btn_box {
  .tab_btn {
    width: 178px;
    height: 52px;
    border-radius: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.36);
    color: #666666;
    padding: 0;
    margin-right: 16px;
    &.active {
      background: #ffffff;
      color: #4092ff;
    }
  }
}
.abroad {
  padding: 18px 0;
  .padding_box {
    padding: 0 28px;
    padding-bottom: 16px;
    white-space:nowrap;
  }
  .uni_item_mini {
    position: relative;
    margin-top: 16px;
    display: inline-block;
    width: 328px;
    vertical-align: top;
    &:not(:last-of-type) {
      margin-right: 22px;
      clear: both;
    }
    .img_box {
      position: relative;
      border-radius: 16px;
      overflow: hidden;
      width: 100%;
      height: 226px;
      background-size: cover;
      background-position: center;
      .time {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        line-height: 52px;
        font-size: 21px;
        font-weight: bold;
        background: rgba(0, 0, 0, 0.27);
        border-radius: 16px;
        color: #fff;
        text-align: center;
        white-space: nowrap;
      }
      .bottom {
        position: absolute;
        bottom: 0;
        left: 0;
        color: #fff;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
        padding: 0 20px;
        background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
        .views {
          font-size: 24px;
        }
      }
    }
    .course_content {
      margin-top: 6px;
      .title {
        // display: -webkit-box;
        font-size: 28px;
        // -webkit-line-clamp: 2;
        text-overflow: ellipsis;
        overflow: hidden;
        // -webkit-box-orient: vertical;
        white-space:nowrap;
        margin-top:16px;
        margin-bottom:0;
      }
      .des {
        font-size: 26px;
        line-height:36px;
        color:#999;
        margin-top:6px;
      }
      
    }
  }
  .line {
    width: 100%;
    height: 16px;
    background: #f5f6fa;
  }
}
</style>
<style lang="scss">
// 长辈版
.elder {
  .abroad .uni_item_mini .content .title,.abroad .uni_item_mini .img_box .bottom .level,.abroad .uni_item_mini .img_box .bottom .count,.abroad .uni_item_mini .content .name{
    font-size: 36px !important;
  }
}
</style>