<template>
  <div class="top-count-card">
    <div v-for="(item, index) in statsData" :key="index" class="count-card">
      <div class="count-card-icon" :class="'icon-' + item.icon"></div>
      <div class="count-card-content">
        <div class="count-card-title">
          <div class="title-zh">{{ item.zh }}</div>
        </div>
        <div class="count-card-value">
          <div class="value">{{ item.value }}</div>
          <div class="unit">{{ item.unit }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue"

// 统计数据
const statsData = ref([
  {
    icon: "xiaoshoujine",
    zh: "圩区监测覆盖率",
    value: 98.5,
    unit: "%"
  },
  {
    icon: "zongxiaoliang",
    zh: "河道水质达标率",
    value: 92.3,
    unit: "%"
  },
  {
    icon: "xiaoshoujine",
    zh: "出入境监测覆盖率",
    value: 100,
    unit: "%"
  },
  {
    icon: "zongxiaoliang",
    zh: "预警数量",
    value: 12,
    unit: "个"
  },
  {
    icon: "xiaoshoujine",
    zh: "处置完成率",
    value: 95.8,
    unit: "%"
  }
])
</script>

<style lang="scss">
.top-count-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 130px;
  display: flex;
  justify-content: center;
  z-index: 10;
  & > div {
    padding: 0 35px;
  }
}

.count-card {
  display: flex;
  align-items: center;
  padding: 10px;
  transform: translateY(150%);
  opacity: 0;
  &-icon {
    width: 48px;
    height: 48px;
    margin-right: 15px;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100%;
    &.icon-xiaoshoujine {
      background-image: url("~@/assets/images/icon1.png");
    }
    &.icon-zongxiaoliang {
      background-image: url("~@/assets/images/icon2.png");
    }
  }
  &-content {
    display: flex;
    flex-direction: column;
  }
  &-title {
    margin-bottom: 5px;
    .title-zh {
      font-weight: bold;
      font-size: 16px;
      color: #ffffff;
      white-space: nowrap;
    }
  }
  &-value {
    display: flex;
    align-items: baseline;
    .value {
      font-family: D-DIN;
      font-weight: bold;
      font-size: 24px;
      color: #ffffff;
      letter-spacing: 1px;
      margin-right: 5px;
      text-shadow: 0px 0px 18px rgba(255, 255, 255, 0.7);
      white-space: nowrap;
    }
    .unit {
      font-weight: 500;
      font-size: 12px;
      color: #ffffff;
      opacity: 0.5;
      white-space: nowrap;
    }
  }
}
</style>