ServiceListSecond.vue 5.66 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" v-if="item.cityAddress || item.areaAddress">
              <span class="count">{{ item.read_count }} 人查看</span>
            </div>
          </div>
          <div class="content">
            <p class="title">{{ item.course_name }}</p>
            <p class="address">
              <van-icon name="location" /> {{ item.cityAddress }}{{ item.cityAddress && item.areaAddress ? '·' : '' }}{{ item.areaAddress }}
            </p>
            <!-- <div class="tag_box">
              <template v-for="(tag, index2) in item.course_labels">
                <span class="tag" v-if="tag" :key="index2">{{ tag }}</span>
              </template>
            </div> -->
            <!-- <div class="flex_box">
              <p class="price" v-if="item.showPrice > 0">
                <span class="icon">¥</span>{{ item.showPrice }}<span class="tint">起 </span
                ><span class="limit">/{{ item.minPeopleCount }}{{ item.unitName }}成团</span>
              </p>
              <p class="price free" v-else>
                {{ item.price > 0 ? '¥' : '' }} {{ item.price == 0 || item.price == '免费' ? '' : item.price }}
              </p>
              <span class="count"> <van-icon name="eye-o" /> {{ item.read_count }} </span>
            </div> -->
          </div>
        </div>
      </template>
      <van-empty style="margin-top: 30%" v-if="list.length == 0" :image="require('@/assets/empty.png')" description="敬请期待" />
    </div>
  </div>
</template>
<script>
export default {
  props: {
    list: {
      type: Array,
      default: [],
    },
    courseTypeLableId:{
      type:String,
      default:''
    }
  },
  data() {
    return {
      active: 0,
      defaultImg: require('@/assets/service/defCoure.jpg'),
    }
  },
  methods: {
    handleUniDetail(item) {
      this.$router.push({
        name: 'ServiceAbroadDetail',
        query: { courseId: item.id, courseTypeLableId: this.courseTypeLableId },
      })
    },
  },
}
</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;
  }
  .uni_item_mini {
    position: relative;
    margin-top: 16px;
    display: inline-block;
    width: 336px;
    vertical-align: top;
    &:nth-of-type(2n-1) {
      margin-right: 22px;
      clear: both;
    }
    .img_box {
      position: relative;
      border-radius: 16px;
      overflow: hidden;
      width: 336px;
      height: 336px;
      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));
        .count {
          font-size: 24px;
        }
      }
    }
    .content {
      margin-top: 6px;
      .title {
        display: -webkit-box;
        font-size: 28px;
        -webkit-line-clamp: 2;
        text-overflow: ellipsis;
        overflow: hidden;
        -webkit-box-orient: vertical;
      }
      .address {
        font-size: 26px;
        margin-top: 8px;
        color: #999;
      }
      .tag_box {
        padding-top: 6px;
        .tag {
          display: inline-block;
          margin-bottom: 10px;
          margin-right: 10px;
          color: #4092ff;
          font-size: 20px;
          border-radius: 4px;
          border: 2px solid #4092ff;
          padding: 0px 6px;
        }
      }
      .flex_box {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
      .count {
        font-size: 24px;
        color: #999;
      }
      .price {
        font-size: 34px;
        font-weight: bold;
        color: #f64c37;
        .icon {
          font-size: 24px;
          color: #f64c37;
        }
        .tint {
          font-size: 22px;
          font-weight: normal;
          color: #909399;
        }
        .limit {
          font-size: 22px;
          font-weight: normal;
          color: #333333;
        }
      }
      .free {
        font-size: 28px;
        white-space: nowrap;
        overflow: hidden;
        max-width: 240px;
        text-overflow: ellipsis;
      }
    }
  }
  .line {
    width: 100%;
    height: 16px;
    background: #f5f6fa;
  }
}
</style>
<style lang="scss">
// 长辈版
.elder {
  .abroad .uni_item_mini .content .title,.abroad .uni_item_mini .content .address,.abroad .uni_item_mini .img_box .bottom{
    font-size: 36px !important;
  }
}
</style>