<!-- src/views/NotificationPage.vue -->
<template>
  <div class="notification-container">
    <h1>通知中心</h1>
    <div class="notification-list">
      <!-- 示例通知数据 -->
      <div 
        v-for="(notice, index) in notifications"
        :key="index"
        class="notification-item"
        @click="viewDetail(notice.id)"
      >
        <div class="notice-title">{{ notice.title }}</div>
        <div class="notice-time">{{ notice.time }}</div>
        <p class="notice-content">{{ notice.content }}</p>
      </div>
    </div>
  </div>
</template>

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

const router = useRouter();

const notifications = ref([
  {
    id: 1,
    title: "系统维护通知",
    time: "2023-08-20 14:00",
    content: "服务器将于今晚24:00进行例行维护，预计持续2小时"
  },
  {
    id: 2,
    title: "新功能上线",
    time: "2023-08-19 09:30",
    content: "消息中心新增批量处理功能，欢迎体验"
  }
]);

function viewDetail(noticeId) {
  router.push({
    name: 'NotificationDetail',
    params: { id: noticeId }
  });
}
</script>

<style scoped>
.notification-container {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.notification-item {
  cursor: pointer; 
  transition: transform 0.2s;
  padding: 15px;
  margin: 10px 0;
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.notification-item:hover {
  transform: translateX(5px);
  background-color: #f5f5f5;
}
.notice-title {
  font-weight: bold;
  color: #333;
  font-size: 1.1em;
}

.notice-time {
  color: #666;
  font-size: 0.9em;
  margin: 5px 0;
}

.notice-content {
  color: #444;
  line-height: 1.6;
}
</style>