<template>
  <div class="company-rating">
    <img class="rating-img" src="@/assets/images/institute-safety/rating-2X.png" alt="" />
    <div>
      <div class="rating-label">{{ rating ? '今日AI检测异常问题' : '今日院区安全指数' }}</div>
      <div class="rating-value">{{ rating ? rating : '100%' }}</div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { onMounted, ref } from 'vue';
  import { getTodayIssueNumber } from '../apis';

  const rating = ref();

  onMounted(async () => {
    const res = await getTodayIssueNumber();
    rating.value = res;
  });
</script>

<style scoped>
  .company-rating {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    backdrop-filter: blur(10px);
  }
  .rating-label {
    font-weight: 500;
    font-size: 14px;
    color: #ffffff;
  }
  .rating-value {
    font-family: DINAlternate, DINAlternate;
    font-weight: bold;
    font-size: 36px;
    color: #17cba5;
    text-align: center;
  }

  .rating-img {
    height: 60px;
  }
</style>
