<template>
  <div
    :class="[
      'area-card',
      data.systemList.length ? 'cursor-pointer' : 'cursor-not-allowed',
      { 'is-hover': data.systemList.length },
    ]"
    @click="handleClick"
  >
    <div class="banner">
      <img class="banner-img" :src="data.img" />
    </div>
    <div class="content">
      <!-- 对接时间 -->
      <div class="w-full">
        <span class="time" v-if="data.systemList.length">
          对接时间:{{ data.date }}
        </span>
      </div>
      <!-- name -->
      <span class="name">{{ data.name }}</span>
      <div class="flex gap-2" v-if="data.systemList.length">
        <span class="item" v-for="(v, i) in data.systemList" :key="i">{{
          v
        }}</span>
      </div>
      <span class="item-2" v-else>等待对接</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    handleClick() {
      if (this.info.systemList.length) {
        this.$emit("click", this.info);
      }
    },
  },
};
</script>

<style lang="less" scoped>
.area-card {
  width: 100%;
  height: 150px;
  font-family: Source Han Sans CN;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: #fff;

  .banner {
    width: 100%;
    height: 110px;
    mask: linear-gradient(to top, transparent 0%, #000 20%);
    position: absolute;
    left: 0px;
    top: 0px;
    overflow: hidden;
    .banner-img {
      width: 100%;
      height: 100%;
      transition: all 0.5s;
    }
  }
  .content {
    width: 100%;
    height: 100%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 1;
  }
  .time {
    padding: 2px 10px;
    background: rgba(35, 35, 35, 0.1);
    border-radius: 4px;
    font-size: 14px;
    color: #ffffff;
  }
  .name {
    padding: 4px 10px;
    font-weight: bold;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    position: relative;
    z-index: 1;
  }
  .item {
    padding: 4px 10px;
    font-weight: bold;
    background: rgba(8, 87, 232, 0.1);
    border-radius: 8px;
    color: #0857e8;
  }
  .item-2 {
    padding: 4px 10px;
    font-weight: bold;
    background: rgba(49, 64, 91, 0.1);
    border-radius: 8px;
    color: #6e7f9e;
  }
}
.is-hover {
  &:hover {
    .banner-img {
      transform: scale(1.1);
    }
  }
}
</style>