feat: add Vue 3 admin frontend and integrate with backend like mediabot

This commit is contained in:
mediabot-pt
2026-06-29 11:14:37 +08:00
parent 25cd9873ae
commit 6f56cde229
17 changed files with 729 additions and 11 deletions

110
web/src/views/Layout.vue Normal file
View File

@@ -0,0 +1,110 @@
<template>
<el-container class="layout-container">
<el-aside width="200px" class="aside">
<div class="logo">PAR Admin</div>
<el-menu
:default-active="$route.path"
router
class="menu"
background-color="#304156"
text-color="#bfcbd9"
active-text-color="#409EFF"
>
<el-menu-item index="/dashboard">
<el-icon><HomeFilled /></el-icon>
<span>概览</span>
</el-menu-item>
<el-menu-item index="/sites">
<el-icon><OfficeBuilding /></el-icon>
<span>站点管理</span>
</el-menu-item>
<el-menu-item index="/configs">
<el-icon><DocumentChecked /></el-icon>
<span>配置审核</span>
</el-menu-item>
<el-menu-item index="/users">
<el-icon><UserFilled /></el-icon>
<span>用户管理</span>
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
<el-header class="header">
<div class="header-right">
<el-dropdown @command="handleCommand">
<span class="user-info">
<el-icon><User /></el-icon>
{{ userEmail }}
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="logout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</el-header>
<el-main class="main">
<router-view />
</el-main>
</el-container>
</el-container>
</template>
<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
const router = useRouter()
const userEmail = ref(localStorage.getItem('par_token') || 'admin')
const handleCommand = (cmd) => {
if (cmd === 'logout') {
localStorage.removeItem('par_token')
ElMessage.success('已退出')
router.push('/login')
}
}
</script>
<style scoped>
.layout-container {
height: 100vh;
}
.aside {
background-color: #304156;
}
.logo {
height: 60px;
line-height: 60px;
text-align: center;
color: #fff;
font-size: 18px;
font-weight: bold;
border-bottom: 1px solid #1f2d3d;
}
.menu {
border-right: none;
}
.header {
background-color: #fff;
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
display: flex;
align-items: center;
justify-content: flex-end;
}
.header-right {
cursor: pointer;
}
.user-info {
display: flex;
align-items: center;
gap: 5px;
color: #606266;
}
.main {
background-color: #f5f7fa;
padding: 20px;
}
</style>