Newer
Older
HuangJiPC / src / pages / views / performance / components / Cards.vue
@zhangdeliang zhangdeliang on 21 Jun 1 KB update
<template>
  <div class="cardBox">
    <div
      class="single"
      v-for="(item, i) in data"
      :key="i"
      @click="goToScroe(item, i)"
    >
      <img :src="item.imgUrl" alt="" />
      <div class="score">
        <div class="name">{{ item.facilitiesName }}:<span class="font16">{{ item.score==null?'--':item.score }}</span>分</div>
        <div :class="[item.finishStatus == 1 ? 'done' : 'undone']">
          {{ item.finishStatus==1 ? "已完成" : "未完成" }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { ref, toRefs } from "vue";
export default {
  name: "card",
  props: {
    data: Array,
  },
  setup(props, ctx) {
    const info = ref(null);
    const goToScroe = (item, i) => {
      info.value = item;
      console.log(info);
      ctx.emit("getInfo", info.value);
    };
    return {
      info,
      goToScroe,
    };
  },
};
</script>

<style lang="less" scoped>
.cardBox {
  display: flex;
  flex-wrap: wrap;
  .single {
    margin: 10px 20px;
    padding: 10px;
    width: calc(25% - 50px);
    height: 244px;
    border: 1px solid #145bf7;
    box-shadow: 0px 1px 5px 1px rgba(82, 125, 218, 0.67);
    cursor: pointer;
    img {
      width: 100%;
      height: 190px;
    }
    .score {
      display: flex;
      height: 40px;
      justify-content: space-between;
      align-items:center ;
      .name {
        font-size: 14px;
        font-family: Source Han Sans CN;
        .font16{
          margin-right: 5px;
          font-size: 16px;
        }
      }
      .done {
        color: #41bf34;
        font-size: 14px;
      }
      .undone {
        color: #f9922d;
        font-size: 14px;
      }
    }
  }
}
</style>