<template>
  <div class="shop_card">
    <div class="shop_car-img" v-if="data.img" @click="intoDetail">
      <img :src="data.img" width="100%" />
    </div>
    <div class="shop_card-top">
      <p
        class="shop_card-title text_clip_2"
        v-text="data.title"
        :title="data.title"
        @click="intoDetail"
      ></p>
      <p class="shop_card-text under_text">
        <span
          class="text_clip"
          v-text="data.provider"
          :title="data.provider"
        ></span>
        <span>
          <i class="el-icon-star-on"></i>
          <span v-text="data.rate"></span>
        </span>
      </p>
    </div>
    <div class="shop_card-bottom">
      <p class="shop_card-text summary text_clip_2" v-if="data.resourceSummary">
        <span v-text="data.resourceSummary"></span>
      </p>
      <p class="shop_card-text update_time">
        <i class="el-icon-time"></i>
        <span class="text_clip" v-text="'更新时间：' + data.updateTime"></span>
      </p>
      <div class="shop_card-text access">
        <span>
          <img :src="require('@/assets/imgs/icon_liulan.png')" />
          <span class="text_clip" v-text="data.viewCount + '次浏览'"></span>
        </span>
        <span>
          <img :src="require('@/assets/imgs/icon_huoqu.png')" />
          <span class="text_clip" v-text="data.numberOfMonth + '次获取'"></span>
        </span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      required: true,
    },
    detailPath: {
      type: String,
      required: true,
    },
  },
  methods: {
    intoDetail() {
      this.$router.push(this.detailPath + this.data.id);
    },
  },
};
</script>

<style scoped>
.shop_card {
  overflow: hidden;
  border: 1px solid #ededed;
  border-radius: 10px;
  box-sizing: border-box;
}
.shop_car-img {
  cursor: pointer;
}
.shop_car-img > img {
  display: block;
}
.shop_card-top {
  background-color: #f9fafc;
  padding: 19px 19px 6px;
}
.shop_card-bottom {
  background-color: #fff;
  padding: 12px 19px 15px;
}
.shop_card-title {
  height: 42px;
  font-size: 16px;
  font-weight: bold;
  color: #0d1847;
  line-height: 21px;
  cursor: pointer;
  margin-bottom: 8px;
}
.shop_card-text {
  font-size: 14px;
  color: #8890a7;
  line-height: 21px;
}
.shop_card-text.under_text {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shop_card-text.under_text > span:nth-child(2) {
  flex-shrink: 0;
  margin-left: 10px;
}
.shop_card-text.under_text > span:nth-child(2) > i {
  font-size: 20px;
  color: #fac266;
}
.shop_card-text.under_text > span:nth-child(2) > span {
  font-family: Arial;
  font-size: 18px;
  font-weight: bold;
  color: #ea7d19;
}
.shop_card-text.summary {
  height: 42px;
  margin-bottom: 12px;
}
.shop_card-text.update_time {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 15px;
}
.shop_card-text.update_time > i {
  flex-shrink: 0;
  margin-right: 5px;
}
.shop_card-text.access {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 11px;
  border-top: 1px solid #ededed;
}
.shop_card-text.access > span > img {
  width: 15px;
  margin-right: 5px;
}
</style>
