227 lines
9.9 KiB
HTML
227 lines
9.9 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="zh-CN">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>直播管理系统</title>
|
||
|
<script src="./js/tailwindcss.js"></script>
|
||
|
<link href="./fontawesome-free-6.4.0-web/css/all.css" rel="stylesheet">
|
||
|
<script>
|
||
|
tailwind.config = {
|
||
|
theme: {
|
||
|
extend: {
|
||
|
colors: {
|
||
|
primary: '#165DFF',
|
||
|
secondary: '#36CFC9',
|
||
|
neutral: '#F5F7FA',
|
||
|
'neutral-dark': '#4E5969',
|
||
|
success: '#00B42A',
|
||
|
warning: '#FF7D00',
|
||
|
danger: '#F53F3F',
|
||
|
},
|
||
|
fontFamily: {
|
||
|
inter: ['Inter', 'system-ui', 'sans-serif'],
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
<style type="text/tailwindcss">
|
||
|
@layer utilities {
|
||
|
.content-auto {
|
||
|
content-visibility: auto;
|
||
|
}
|
||
|
.sidebar-item {
|
||
|
@apply flex items-center gap-3 px-4 py-3 rounded-lg transition-all duration-200 hover:bg-primary/10 hover:text-primary;
|
||
|
}
|
||
|
.sidebar-item.active {
|
||
|
@apply bg-primary/10 text-primary font-medium;
|
||
|
}
|
||
|
.btn-primary {
|
||
|
@apply bg-primary hover:bg-primary/90 text-white px-4 py-2 rounded-lg transition-all duration-200 shadow-sm hover:shadow flex items-center justify-center gap-2;
|
||
|
}
|
||
|
.btn-outline {
|
||
|
@apply border border-gray-200 hover:border-primary/50 text-neutral-dark hover:text-primary px-4 py-2 rounded-lg transition-all duration-200 flex items-center justify-center gap-2;
|
||
|
}
|
||
|
.fade-in {
|
||
|
animation: fadeIn 0.3s ease-in-out;
|
||
|
}
|
||
|
@keyframes fadeIn {
|
||
|
from { opacity: 0; transform: translateY(-10px); }
|
||
|
to { opacity: 1; transform: translateY(0); }
|
||
|
}
|
||
|
.page-container {
|
||
|
display: none;
|
||
|
}
|
||
|
.page-container.active {
|
||
|
display: block;
|
||
|
}
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body class="bg-neutral font-inter text-gray-800">
|
||
|
<!-- 顶部导航栏 - 移动设备 -->
|
||
|
<header class="lg:hidden fixed top-0 left-0 right-0 bg-white shadow-sm z-10">
|
||
|
<div class="container mx-auto px-4 py-3 flex justify-between items-center">
|
||
|
<div class="flex items-center gap-2">
|
||
|
<i class="fa-solid fa-shield text-primary text-lg"></i>
|
||
|
<span class="text-lg font-bold text-primary">智能保镖</span>
|
||
|
</div>
|
||
|
<button id="mobile-menu-button" class="p-2 rounded-lg hover:bg-gray-100">
|
||
|
<i class="fa-solid fa-bars"></i>
|
||
|
</button>
|
||
|
</div>
|
||
|
</header>
|
||
|
|
||
|
<div class="flex min-h-screen pt-14 lg:pt-0">
|
||
|
<!-- 侧边栏导航 -->
|
||
|
<aside id="sidebar" class="lg:w-64 bg-white shadow-sm flex-shrink-0 hidden lg:block transition-all duration-300 z-20">
|
||
|
<div class="p-4 border-b border-gray-100">
|
||
|
<div class="flex items-center gap-2">
|
||
|
<i class="fa-solid fa-shield text-primary text-xl"></i>
|
||
|
<h1 class="text-lg font-bold text-primary">智能保镖</h1>
|
||
|
</div>
|
||
|
<p class="text-xs text-gray-400 mt-1">直播间智能管理助手</p>
|
||
|
</div>
|
||
|
|
||
|
<nav class="p-4">
|
||
|
<ul class="space-y-1">
|
||
|
<li><a href="#/live-management" class="sidebar-item" data-page="live-management"><i class="fa-solid fa-video"></i> 直播管理</a></li>
|
||
|
<li><a href="#/smart-bodyguard" class="sidebar-item" data-page="smart-bodyguard"><i class="fa-solid fa-cogs"></i> 保镖设置</a></li>
|
||
|
<li><a href="#/id-whitelist-blacklist" class="sidebar-item" data-page="id-whitelist-blacklist"><i class="fa-solid fa-user-check"></i> ID黑白名单</a></li>
|
||
|
<li><a href="#/id-blacklist" class="sidebar-item" data-page="id-blacklist"><i class="fas fa-ban"></i> 拉黑记录</a></li>
|
||
|
<li><a href="#/logging" class="sidebar-item" data-page="logging"><i class="fa-solid fa-file-lines"></i> 运行日志</a></li>
|
||
|
<li><a href="#/tutorial" class="sidebar-item" data-page="tutorial"><i class="fa-solid fa-book"></i> 使用教程</a></li>
|
||
|
<li><a href="#/feedback" class="sidebar-item" data-page="feedback"><i class="fa-solid fa-comment-dots"></i> 意见反馈</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</aside>
|
||
|
|
||
|
<!-- 主内容区 -->
|
||
|
<main id="main-content" class="flex-1 overflow-y-auto bg-neutral p-4 lg:p-6">
|
||
|
<!-- 登录页面 -->
|
||
|
<div id="login-page" class="page-container min-h-screen flex items-center justify-center">
|
||
|
<!-- 登录页面内容将通过 JavaScript 动态加载 -->
|
||
|
</div>
|
||
|
|
||
|
<!-- 其他页面容器 -->
|
||
|
<div id="live-management-page" class="page-container"></div>
|
||
|
<div id="smart-bodyguard-page" class="page-container"></div>
|
||
|
<div id="id-whitelist-blacklist-page" class="page-container"></div>
|
||
|
<div id="id-blacklist-page" class="page-container"></div>
|
||
|
<div id="logging-page" class="page-container"></div>
|
||
|
<div id="tutorial-page" class="page-container"></div>
|
||
|
<div id="feedback-page" class="page-container"></div>
|
||
|
</main>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
// 路由管理
|
||
|
class Router {
|
||
|
constructor() {
|
||
|
this.routes = {
|
||
|
'': 'login',
|
||
|
'login': 'login',
|
||
|
'live-management': 'live-management',
|
||
|
'smart-bodyguard': 'smart-bodyguard',
|
||
|
'id-whitelist-blacklist': 'id-whitelist-blacklist',
|
||
|
'id-blacklist': 'id-blacklist',
|
||
|
'logging': 'logging',
|
||
|
'tutorial': 'tutorial',
|
||
|
'feedback': 'feedback'
|
||
|
};
|
||
|
|
||
|
this.currentPage = '';
|
||
|
this.init();
|
||
|
}
|
||
|
|
||
|
init() {
|
||
|
// 监听 hash 变化
|
||
|
window.addEventListener('hashchange', () => this.handleRoute());
|
||
|
// 初始加载
|
||
|
this.handleRoute();
|
||
|
|
||
|
// 移动端菜单按钮事件
|
||
|
document.getElementById('mobile-menu-button').addEventListener('click', () => {
|
||
|
const sidebar = document.getElementById('sidebar');
|
||
|
sidebar.classList.toggle('hidden');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
async handleRoute() {
|
||
|
const hash = window.location.hash.slice(2) || 'login';
|
||
|
const page = this.routes[hash] || 'login';
|
||
|
|
||
|
if (this.currentPage === page) return;
|
||
|
|
||
|
// 更新导航状态
|
||
|
document.querySelectorAll('.sidebar-item').forEach(item => {
|
||
|
item.classList.remove('active');
|
||
|
if (item.getAttribute('data-page') === page) {
|
||
|
item.classList.add('active');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// 隐藏所有页面
|
||
|
document.querySelectorAll('.page-container').forEach(container => {
|
||
|
container.classList.remove('active');
|
||
|
});
|
||
|
|
||
|
// 加载新页面
|
||
|
const pageContainer = document.getElementById(`${page}-page`);
|
||
|
if (!pageContainer) return;
|
||
|
|
||
|
if (page === 'login') {
|
||
|
// 特殊处理登录页面
|
||
|
pageContainer.classList.add('active');
|
||
|
if (!pageContainer.innerHTML) {
|
||
|
const response = await fetch('login.html');
|
||
|
const content = await response.text();
|
||
|
const parser = new DOMParser();
|
||
|
const doc = parser.parseFromString(content, 'text/html');
|
||
|
const loginContent = doc.querySelector('.bg-white.rounded-xl');
|
||
|
if (loginContent) {
|
||
|
pageContainer.innerHTML = loginContent.outerHTML;
|
||
|
this.attachLoginHandlers();
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
// 加载其他页面内容
|
||
|
if (!pageContainer.innerHTML) {
|
||
|
const response = await fetch(`${page}.html`);
|
||
|
const content = await response.text();
|
||
|
const parser = new DOMParser();
|
||
|
const doc = parser.parseFromString(content, 'text/html');
|
||
|
const mainContent = doc.querySelector('main');
|
||
|
if (mainContent) {
|
||
|
pageContainer.innerHTML = mainContent.innerHTML;
|
||
|
}
|
||
|
}
|
||
|
pageContainer.classList.add('active');
|
||
|
}
|
||
|
|
||
|
this.currentPage = page;
|
||
|
}
|
||
|
|
||
|
attachLoginHandlers() {
|
||
|
const loginForm = document.getElementById('login-form');
|
||
|
if (loginForm) {
|
||
|
loginForm.addEventListener('submit', (e) => {
|
||
|
e.preventDefault();
|
||
|
const loginSuccess = document.getElementById('login-success');
|
||
|
if (loginSuccess) {
|
||
|
loginSuccess.classList.remove('hidden');
|
||
|
setTimeout(() => {
|
||
|
window.location.hash = '#/live-management';
|
||
|
}, 3000);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// 初始化路由
|
||
|
const router = new Router();
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|