<template>
  <div class="com_cell">
    <div class="com_cell_img_box">
      <img
        src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
        class="com_cell_img"
      />
    </div>
    <div class="com_cell_message">
      <div class="com_cell_msg_title">
        {{ cellData.name }}
        <span v-if="cellData.mapService" class="tags map_service">mapService</span>
        <span v-if="cellData.openness == 1" class="tags shared">共享</span>
        <span v-else-if="cellData.openness ==  2" class="tags restricted">受限</span>
        <span v-else class="tags sensitive">敏感</span>
      </div>
      <div class="com_cell_item">
        <span class="com_cell_item_title">资源摘要：</span>
        <span class="com_cell_data">{{ cellData.descript }}</span>
      </div>
      <div class="com_cell_item">
        <span class="com_cell_item_title">提供机构：</span>
        <span class="com_cell_data">{{ cellData.organization_name }}</span>
      </div>
      <div class="com_cell_item">
        <span class="com_cell_item_title">数据领域：</span>
        <span class="com_cell_data">{{ cellData.sectors_name }}</span>
      </div>
      <div class="com_cell_item">
        <span class="com_cell_item_title">服务类型：</span>
        <span
          class="com_cell_data"
        >{{ cellData.data_service_type1_name }}&nbsp;&nbsp;{{ cellData.data_service_type2_str }}&nbsp;&nbsp;{{ cellData.data_service_type3_str }}</span>
      </div>
      <div class="com_cell_item">
        <span class="com_cell_item_title">更新时间：</span>
        <span class="com_cell_data">{{ helper.dateStringTransform(cellData.update_date) }}</span>
      </div>
    </div>
    <div class="com_cell_right">
      <el-rate
        v-model="cellData.score"
        disabled
        show-score
        text-color="#58617a"
        score-template="{value}"
      ></el-rate>
      <div class="com_cell_right_text">
        <span class="com_cell_right_time_tit">本月获取次数：</span>
        <span class="com_cell_right_time">{{ cellData.apply_num }}次</span>
      </div>
      <el-button class="com_cell_right_btn" @click="goUrl(cellData.id)">查看详情</el-button>
    </div>
  </div>
</template>

<script>
import helper from "@/services/helper.js";
// if you meet date which like 2020-06-05T00:00:00+08:00, use helper.dateStringTransform()
export default {
  components: {},
  props: {
    url: { type: String, default: "" },
    cellData: { type: Object, default: {} }
  },
  data: () => ({ helper: helper }),
  computed: {},
  watch: {},
  methods: {
    goUrl(parame) {
      if (this.url != "") {
        this.$router.push(this.url + "/" + parame);
      }
    }
  },
  mounted() {}
};
</script>

<style scoped>
.com_cell {
  display: flex;
  justify-content: flex-start;
  padding: 20px 10px;
  border-bottom: 2px #f4f7fc solid;
}
.com_cell_img_box {
  width: 166px;
  height: 166px;
  border-radius: 12px;
  overflow: hidden;
}
.com_cell_img {
  width: 100%;
  height: 100%;
}
.com_cell_message {
  padding-left: 20px;
  width: calc(100% - 420px);
}
.com_cell_msg_title {
  color: #0d1847;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.com_cell_item {
  font-size: 16px;
  line-height: 26px;
  margin-top: 1px;
  color: #8890a7;
  display: flex;
  align-self: start;
}
.com_cell_item_title {
  width: 80px;
}
.com_cell_data {
  display: inline-block;
  width: calc(100% - 90px);
  color: #242c43;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.com_cell_right {
  width: 250px;
  padding: 25px 0 0 50px;
}
.com_cell_right_text {
  font-size: 14px;
  margin-top: 15px;
}
.com_cell_right_time_tit {
  color: #8890a7;
}
.com_cell_right_time {
  color: #242c43;
}
.com_cell_right_btn {
  background-color: #0f2683;
  color: #f8f9fd;
  width: 160px;
  height: 40px;
  border-radius: 20px;
  margin-top: 35px;
}
.tags {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 8px 2px;
  font-size: 12px;
  font-weight: 500;
  line-height: 12px;
  border-radius: 4px;
  position: relative;
  top: -2px;
}
.map_service {
  background-color: #626de9;
  border: solid 1px #626de9;
  color: #fff;
}
.shared {
  background-color: #e7fdfc;
  border: solid 1px #8bd6d0;
  color: #25bdb1;
}
.restricted {
  background-color: #fffee8;
  border: solid 1px #e4c884;
  color: #ef9433;
}
.sensitive {
  background-color: #ffefef;
  border: solid 1px #d7a4a9;
  color: #e15260;
}
</style>
<style>
.com_cell_right .el-rate__text {
  display: inline-block;
  margin-left: 10px;
  font-size: 22px;
  font-weight: 700;
}
.com_cell_right .el-rate__icon {
  font-size: 20px;
}
</style>