<script setup lang="ts">
import { ref, reactive } from "vue";
import CapsuleChart from "@/components/datav/capsule-chart";
import { ranking } from "@/api";
import { ElMessage } from "element-plus";

const config = ref({
  showValue: true,
  unit: "次",
});
const data = ref([]);
const getData = () => {
  ranking()
    .then((res) => {
      console.log("右中--报警排名", res);
      if (res.success) {
        data.value = res.data;
      } else {
        ElMessage({
          message: res.msg,
          type: "warning",
        });
      }
    })
    .catch((err) => {
      ElMessage.error(err);
    });
};
getData();
</script>

<template>
  <ul class="user_Overview flex">
    <li class="user_Overview-item" style="color: #f0e728">
      <div class="user_Overview_nums allnum">
      </div>
      <p>20</p>
    </li>
    <li class="user_Overview-item" style="color: #c11f6f">
      <div class="user_Overview_nums online">
      </div>
      <p>20</p>
    </li>
    <li class="user_Overview-item" style="color: #1196dd">
      <div class="user_Overview_nums offline">
      </div>
      <p>10</p>
    </li>
    <li class="user_Overview-item" style="color: #24bb01">
      <div class="user_Overview_nums laramnum">
      </div>
      <p>20</p>
    </li>
  </ul>
</template>

<style scoped lang="scss">
.right_bottom {
  box-sizing: border-box;
  padding: 0 16px;
}
.user_Overview {
  li {
    flex: 1;

    p {
      text-align: center;
      height: 16px;
      font-size: 30px;
    }

    .user_Overview_nums {
      width: 100px;
      height: 100px;
      text-align: center;
      line-height: 100px;
      font-size: 18px;
      margin: 50px auto 30px;
      background-size: cover;
      background-position: center center;
      position: relative;

      &::before {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
      }

      &.bgdonghua::before {
        animation: rotating 14s linear infinite;
      }
    }

    .allnum {
      &::before {
        background-image: url("@/assets/img/co2.png");
        background-size: cover;
      }
    }

    .online {
      &::before {
        background-image: url("@/assets/img/hcho.png");
        background-size: cover;
      }
    }

    .offline {
      &::before {
        background-image: url("@/assets/img/pm2.5.png");
        background-size: cover;
      }
    }
    
    .laramnum {
      &::before {
        background-image: url("@/assets/img/tvoc.png");
        background-size: cover;
      }
    }
  }
}
</style>
