refactor: 移除旧版评论系统代码并重构为Vue3前端 docs: 更新后端配置文档说明 fix: 修复评论提交频率限制和邮件通知逻辑 style: 格式化代码并优化样式 test: 添加Vitest测试配置 build: 更新依赖项和构建配置 chore: 清理无用文件和缓存
131 lines
2.2 KiB
Vue
131 lines
2.2 KiB
Vue
<template>
|
|
<div class="layout">
|
|
<header class="layout-header">
|
|
<div class="layout-title">CWD 评论后台</div>
|
|
<div class="layout-actions">
|
|
<button class="layout-button" @click="goSettings">设置</button>
|
|
<button class="layout-button" @click="handleLogout">退出</button>
|
|
</div>
|
|
</header>
|
|
<div class="layout-body">
|
|
<nav class="layout-sider">
|
|
<ul class="menu">
|
|
<li class="menu-item" :class="{ active: isRouteActive('comments') }" @click="goComments">评论管理</li>
|
|
<li class="menu-item" :class="{ active: isRouteActive('settings') }" @click="goSettings">系统设置</li>
|
|
</ul>
|
|
</nav>
|
|
<main class="layout-content">
|
|
<router-view />
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
import { logoutAdmin } from '../api/admin';
|
|
|
|
const router = useRouter();
|
|
const route = useRoute();
|
|
|
|
function isRouteActive(name: string) {
|
|
return route.name === name;
|
|
}
|
|
|
|
function goComments() {
|
|
router.push({ name: 'comments' });
|
|
}
|
|
|
|
function goSettings() {
|
|
router.push({ name: 'settings' });
|
|
}
|
|
|
|
function handleLogout() {
|
|
logoutAdmin();
|
|
router.push({ name: 'login' });
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.layout {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
}
|
|
|
|
.layout-header {
|
|
height: 56px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 24px;
|
|
background-color: #24292f;
|
|
color: #ffffff;
|
|
}
|
|
|
|
.layout-title {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.layout-actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.layout-button {
|
|
padding: 6px 10px;
|
|
border-radius: 4px;
|
|
border: 1px solid #57606a;
|
|
background-color: #24292f;
|
|
color: #ffffff;
|
|
cursor: pointer;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.layout-button:hover {
|
|
background-color: #32383f;
|
|
}
|
|
|
|
.layout-body {
|
|
display: flex;
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
|
|
.layout-sider {
|
|
width: 180px;
|
|
background-color: #f6f8fa;
|
|
border-right: 1px solid #d0d7de;
|
|
}
|
|
|
|
.menu {
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 12px 0;
|
|
}
|
|
|
|
.menu-item {
|
|
padding: 10px 16px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
color: #24292f;
|
|
}
|
|
|
|
.menu-item:hover {
|
|
background-color: #eaeef2;
|
|
}
|
|
|
|
.menu-item.active {
|
|
background-color: #d0ebff;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.layout-content {
|
|
flex: 1;
|
|
padding: 16px 20px;
|
|
overflow: auto;
|
|
}
|
|
</style>
|
|
|