<template>
  <div class="header">
    <div class="header-data">
      <div>
        <div class="data-title">算法总量</div>
        <div class="algorithm-total">{{ panelData?.algoCount }}</div>
      </div>
      <el-divider direction="vertical" border-style="solid" />
      <div>
        <div class="data-title">在线相机</div>
        <div class="camera-data">
          <div class="camera-online">{{ panelData?.onlineCameraCount }}</div>
          <div class="camera-total">/{{ panelData?.totalCameraCount }}</div>
        </div>
      </div>
      <el-divider direction="vertical" border-style="solid" />
      <div>
        <div style="margin-left: 20px" class="data-title">用户总量</div>
        <div class="user-total">{{ panelData?.userCount }}</div>
      </div>
    </div>
    <div class="header-user">
      <div class="user-greet">
        <img src="~@/assets/icons/user-logo.png" class="img-user" alt="" />
        <div class="greet-content">早安,{{ getUsername }},祝你开心每一天</div>
      </div>
      <div class="user-guide">天眼管理中台 | 配置安全管控平台</div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { useUserStore } from '@/store/modules/user';
  import { computed, onMounted } from 'vue';
  import usePanel from '../hooks/usePanel';

  const usePanelInfo = usePanel();
  const { panelData, getPanelCount } = usePanelInfo;
  onMounted(() => {
    getPanelCount();
  });

  const userStore = useUserStore();

  const getUsername = computed(() => {
    // return userStore.getUserInfo.username;
    return userStore.getUserInfo.nickname;
  });
</script>

<style scoped>
  .header {
    display: flex;
    justify-content: space-between;
  }

  .header-data {
    margin-left: 28px;
    margin-top: 32px;
    display: flex;
  }
  .header-user {
    margin-top: 28px;
    margin-right: 32px;
    /* display: flex; */
  }

  .algorithm-total {
    font-size: 30px;
    color: #1890ff;
    margin-left: 22px;
    margin-top: 4px;
    text-align: center;
  }

  .el-divider--vertical {
    height: 40px;
    margin-left: 32px;
    margin-top: 11px;
    margin-right: 32px;
  }

  .camera-data {
    display: flex;
    margin-top: 4px;
    text-align: center;
  }

  .camera-online {
    font-size: 30px;
    color: #1890ff;
  }

  .camera-total {
    color: rgb(0, 0, 0, 0.45);
    font-size: 20px;
    margin-left: 4px;
    margin-top: 9px;
  }

  .user-total {
    font-size: 30px;
    color: #1890ff;
    margin-top: 4px;
    text-align: center;
  }

  .data-title {
    color: rgb(0, 0, 0, 0.65);
    font-size: 14px;
  }

  .user-greet {
    display: flex;
  }

  .greet-content {
    margin-top: 5px;
    margin-left: 16px;
    margin-bottom: 9px;
    color: rgb(0, 0, 0, 0.85);
    font-size: 20px;
  }

  .user-guide {
    color: rgb(0, 0, 0, 0.45);
    font-size: 14px;
    margin-left: 52px;
  }

  .img-user {
    width: 36px;
    height: 36px;
  }
</style>
