<template>
  <div class="dashboard">
    <h2 class="title">后台管理系统</h2>

    <div class="stats">
      <div class="stat-card">
        <h3>用户总数</h3>
        <p>{{ userCount }}</p>
      </div>
      <div class="stat-card">
        <h3>今日订单</h3>
        <p>{{ orderCount }}</p>
      </div>
      <div class="stat-card">
        <h3>系统访问量</h3>
        <p>{{ visitCount }}</p>
      </div>
    </div>
  </div>
</template>

<script setup name="Index" lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();

// 模拟数据
const userCount = ref(1234);
const orderCount = ref(567);
const visitCount = ref(8901);

const goToPage = (page: string) => {
  router.push(`/${page}`);
};
</script>

<style scoped lang="scss">
.dashboard {
  padding: 20px;
  background-color: #f8f9fa;
}

.title {
  text-align: center;
  font-size: 24px;
  margin-bottom: 20px;
}

.stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;

  .stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 200px;

    h3 {
      font-size: 16px;
      color: #333;
    }

    p {
      font-size: 20px;
      font-weight: bold;
      margin-top: 10px;
      color: #007bff;
    }
  }
}

.actions {
  text-align: center;

  button {
    margin: 0 10px;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    transition: 0.3s;

    &:hover {
      background-color: #0056b3;
    }
  }
}
</style>
