Files
ai-chat-app/www/admin.html

482 lines
10 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>AI助手 - 后台管理</title>
<link rel="stylesheet" href="admin.css?v=3.6.6">
<style>
:root {
--primary: #667eea;
--primary-dark: #5a67d8;
--bg-color: #f5f7fa;
--card-bg: #ffffff;
--text-color: #2d3748;
--text-light: #718096;
--border-color: #e2e8f0;
--danger: #e53e3e;
--success: #22c55e;
--warning: #f59e0b;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
}
/* 登录页面 */
.login-page {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
}
.login-card {
background: white;
padding: 40px;
border-radius: 16px;
width: 350px;
text-align: center;
}
.login-logo {
font-size: 48px;
margin-bottom: 16px;
}
.login-title {
font-size: 24px;
font-weight: 600;
margin-bottom: 24px;
}
.login-input {
width: 100%;
padding: 12px 16px;
border: 2px solid var(--border-color);
border-radius: 10px;
font-size: 16px;
margin-bottom: 16px;
outline: none;
}
.login-input:focus {
border-color: var(--primary);
}
.login-btn {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 10px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
margin-top: 8px;
}
.login-btn:hover {
opacity: 0.9;
}
/* 主页面 */
.admin-page {
display: none;
}
.admin-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 24px;
background: white;
border-bottom: 1px solid var(--border-color);
}
.admin-logo {
display: flex;
align-items: center;
gap: 8px;
font-size: 20px;
font-weight: 600;
}
.admin-logo span {
font-size: 28px;
}
.admin-header-right {
display: flex;
align-items: center;
gap: 16px;
}
.admin-logout {
padding: 8px 16px;
background: var(--danger);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
}
/* 侧边栏 */
.admin-container {
display: flex;
height: calc(100vh - 60px);
}
.admin-sidebar {
width: 220px;
background: white;
border-right: 1px solid var(--border-color);
padding: 16px;
}
.sidebar-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s;
margin-bottom: 4px;
}
.sidebar-item:hover {
background: rgba(102, 126, 234, 0.1);
}
.sidebar-item.active {
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
}
.sidebar-icon {
font-size: 20px;
}
/* 内容区 */
.admin-content {
flex: 1;
padding: 24px;
overflow-y: auto;
}
.content-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.content-title {
font-size: 24px;
font-weight: 600;
}
.add-btn {
padding: 10px 20px;
background: var(--primary);
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
}
/* 数据卡片 */
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-bottom: 24px;
}
.stat-card {
background: white;
padding: 20px;
border-radius: 12px;
text-align: center;
}
.stat-icon {
font-size: 32px;
margin-bottom: 8px;
}
.stat-value {
font-size: 28px;
font-weight: 600;
color: var(--primary);
}
.stat-label {
font-size: 14px;
color: var(--text-light);
}
/* 数据表格 */
.data-table {
background: white;
border-radius: 12px;
overflow: hidden;
}
.data-table table {
width: 100%;
border-collapse: collapse;
}
.data-table th, .data-table td {
padding: 14px 16px;
text-align: left;
border-bottom: 1px solid var(--border-color);
}
.data-table th {
background: var(--bg-color);
font-weight: 600;
color: var(--text-light);
}
.data-table tr:last-child td {
border-bottom: none;
}
.data-table tr:hover td {
background: rgba(102, 126, 234, 0.05);
}
/* 操作按钮 */
.action-btns {
display: flex;
gap: 8px;
}
.action-btn {
padding: 6px 12px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 12px;
}
.action-btn.edit {
background: var(--primary);
color: white;
}
.action-btn.delete {
background: var(--danger);
color: white;
}
.action-btn.default {
background: var(--success);
color: white;
}
/* 默认标记 */
.default-badge {
padding: 4px 8px;
background: var(--success);
color: white;
border-radius: 4px;
font-size: 12px;
}
/* 模态框 */
.modal {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.5);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modal.show {
display: flex;
}
.modal-content {
background: white;
padding: 24px;
border-radius: 16px;
max-width: 500px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.modal-title {
font-size: 20px;
font-weight: 600;
}
.modal-close {
font-size: 24px;
cursor: pointer;
color: var(--text-light);
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
font-size: 14px;
font-weight: 500;
margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea {
width: 100%;
padding: 12px;
border: 1px solid var(--border-color);
border-radius: 8px;
font-size: 14px;
outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
border-color: var(--primary);
}
.form-textarea {
resize: vertical;
min-height: 100px;
}
.form-submit {
width: 100%;
padding: 14px;
background: var(--primary);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
margin-top: 16px;
}
/* Toast */
.toast {
position: fixed;
top: 80px;
left: 50%;
transform: translateX(-50%);
background: var(--text-color);
color: white;
padding: 12px 24px;
border-radius: 8px;
font-size: 14px;
opacity: 0;
transition: opacity 0.3s;
z-index: 2000;
}
.toast.show {
opacity: 1;
}
</style>
</head>
<body>
<!-- 登录页面 -->
<div class="login-page" id="loginPage">
<div class="login-card">
<div class="login-logo">🤖</div>
<h1 class="login-title">后台管理系统</h1>
<input type="text" class="login-input" id="loginUsername" placeholder="用户名">
<input type="password" class="login-input" id="loginPassword" placeholder="密码">
<button class="login-btn" id="loginBtn">登录</button>
<p style="margin-top: 16px; color: #999; font-size: 12px;">默认: admin / admin123</p>
</div>
</div>
<!-- 管理页面 -->
<div class="admin-page" id="adminPage">
<header class="admin-header">
<div class="admin-logo">
<span>🤖</span>
AI助手 - 后台管理
</div>
<div class="admin-header-right">
<span id="adminName">管理员</span>
<button class="admin-logout" id="logoutBtn">退出</button>
</div>
</header>
<div class="admin-container">
<aside class="admin-sidebar">
<div class="sidebar-item active" data-page="stats">
<span class="sidebar-icon">📊</span>
<span>统计信息</span>
</div>
<div class="sidebar-item" data-page="users">
<span class="sidebar-icon">👥</span>
<span>用户管理</span>
</div>
<div class="sidebar-item" data-page="llm">
<span class="sidebar-icon">🧠</span>
<span>大模型配置</span>
</div>
<div class="sidebar-item" data-page="agents">
<span class="sidebar-icon">🤖</span>
<span>智能体管理</span>
</div>
<div class="sidebar-item" data-page="chat">
<span class="sidebar-icon">💬</span>
<span>对话配置</span>
</div>
<div class="sidebar-item" data-page="tools">
<span class="sidebar-icon">🔧</span>
<span>工具配置</span>
</div>
<div class="sidebar-item" data-page="system">
<span class="sidebar-icon">⚙️</span>
<span>系统设置</span>
</div>
</aside>
<main class="admin-content" id="mainContent">
<!-- 内容区动态加载 -->
</main>
</div>
</div>
<!-- Toast -->
<div class="toast" id="toast"></div>
<!-- 模态框 -->
<div class="modal" id="modal">
<div class="modal-content" id="modalContent">
<!-- 动态内容 -->
</div>
</div>
<script src="admin.js?v=3.6.6"></script>
</body>
</html>