web重做

This commit is contained in:
Alex Yang
2025-11-24 01:53:26 +08:00
parent f499a4a84a
commit 85320611cb
17 changed files with 4936 additions and 2346 deletions

760
static/css/style.css Normal file
View File

@@ -0,0 +1,760 @@
/* 全局样式重置 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f5f7fa;
color: #333;
line-height: 1.6;
width: 100%;
height: 100%;
overflow-x: hidden;
}
body {
position: relative;
}
/* 主容器样式 */
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
width: 100%;
max-width: 100%;
background-color: #fff;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}
/* 头部样式 */
header.header-container {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1.5rem;
width: 100%;
text-align: center;
box-sizing: border-box;
position: relative;
z-index: 10;
}
.logo {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1rem;
}
.logo i {
margin-right: 1rem;
color: white;
}
.logo h1 {
font-size: 1.8rem;
margin: 0;
font-weight: 600;
}
header p {
font-size: 1rem;
opacity: 0.9;
}
/* 主体布局容器 */
.main-layout {
display: flex;
flex: 1;
min-height: 0;
}
/* 侧边栏样式 */
.sidebar {
width: 250px;
background-color: #2c3e50;
color: white;
padding: 1rem 0;
flex-shrink: 0;
overflow-y: auto;
height: calc(100vh - 130px); /* 减去header的高度 */
}
.nav-menu {
list-style: none;
}
.nav-item {
padding: 1rem 1.5rem;
display: flex;
align-items: center;
cursor: pointer;
transition: all 0.3s ease;
}
.nav-item:hover {
background-color: #34495e;
padding-left: 1.75rem;
}
.nav-item.active {
background-color: #3498db;
border-left: 4px solid #fff;
}
.nav-item i {
margin-right: 1rem;
width: 20px;
text-align: center;
}
/* 主内容区域样式 */
.content {
flex: 1;
padding: 1rem;
overflow-y: auto;
background-color: #f8f9fa;
min-width: 0; /* 防止flex子元素溢出 */
height: calc(100vh - 130px); /* 减去header的高度 */
}
/* 面板样式 */
.panel {
display: none;
background-color: white;
border-radius: 8px;
padding: 1.5rem;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
box-sizing: border-box;
overflow: hidden;
}
.panel.active {
display: block;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid #e9ecef;
}
.panel-header h2 {
font-size: 1.5rem;
color: #2c3e50;
}
/* 状态指示器 */
.status-indicator {
display: flex;
align-items: center;
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #e74c3c;
margin-right: 8px;
animation: pulse 2s infinite;
}
.status-dot.connected {
background-color: #2ecc71;
}
@keyframes pulse {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.1);
opacity: 0.7;
}
100% {
transform: scale(1);
opacity: 1;
}
}
/* 按钮样式 */
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
}
.btn i {
margin-right: 0.5rem;
}
.btn-primary {
background-color: #3498db;
color: white;
}
.btn-primary:hover {
background-color: #2980b9;
}
.btn-secondary {
background-color: #7f8c8d;
color: white;
}
.btn-secondary:hover {
background-color: #6c757d;
}
.btn-success {
background-color: #2ecc71;
color: white;
}
.btn-success:hover {
background-color: #27ae60;
}
.btn-danger {
background-color: #e74c3c;
color: white;
}
.btn-danger:hover {
background-color: #c0392b;
}
.btn-warning {
background-color: #f39c12;
color: white;
}
.btn-warning:hover {
background-color: #e67e22;
}
.btn-sm {
padding: 0.375rem 0.75rem;
font-size: 0.8rem;
}
.btn-block {
width: 100%;
}
/* 统计卡片网格 */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
.stat-card {
background-color: white;
border-radius: 8px;
padding: 1.5rem;
text-align: center;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.stat-card i {
font-size: 2rem;
margin-bottom: 1rem;
color: #3498db;
}
.stat-value {
font-size: 2rem;
font-weight: bold;
margin-bottom: 0.5rem;
color: #2c3e50;
}
.stat-label {
font-size: 0.9rem;
color: #7f8c8d;
text-transform: uppercase;
letter-spacing: 0.5px;
}
/* 图表容器 */
.charts-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
margin-bottom: 1.5rem;
}
.chart-card {
background-color: white;
border-radius: 8px;
padding: 1.5rem;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.chart-card h3 {
margin-bottom: 1rem;
font-size: 1.2rem;
color: #2c3e50;
}
/* 表格容器 */
.tables-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
}
.table-card {
background-color: white;
border-radius: 8px;
padding: 1.5rem;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.table-card h3 {
margin-bottom: 1rem;
font-size: 1.2rem;
color: #2c3e50;
}
/* 表格样式 */
.table-wrapper {
overflow-x: auto;
border-radius: 8px;
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 16px;
display: block;
width: 100%;
}
table {
width: 100%;
border-collapse: collapse;
background-color: #ffffff;
margin: 0;
}
th, td {
padding: 0.75rem 1rem;
text-align: left;
border-bottom: 1px solid #e9ecef;
}
th {
background-color: #f8f9fa;
font-weight: 600;
color: #2c3e50;
}
td.loading {
text-align: center;
color: #7f8c8d;
font-style: italic;
}
tr:hover {
background-color: #f8f9fa;
}
/* 分页控件样式 */
.pagination-controls {
background-color: #ffffff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 16px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 16px;
}
.pagination-info {
font-size: 14px;
color: #666;
}
.pagination-buttons {
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}
.items-per-page {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
}
.items-per-page select {
padding: 6px 12px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #fff;
font-size: 14px;
cursor: pointer;
}
.nav-buttons {
display: flex;
gap: 8px;
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* 规则内容样式优化 */
.rule-content {
max-width: 600px;
}
.rule-content pre {
margin: 0;
font-family: inherit;
white-space: pre-wrap;
word-break: break-all;
font-size: 14px;
}
/* 表单样式 */
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: #2c3e50;
}
.form-group input,
.form-group select {
width: 100%;
padding: 0.75rem;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.form-group input:focus,
.form-group select:focus {
outline: none;
border-color: #3498db;
}
.form-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem;
}
/* 管理区域样式 */
.rules-management,
.hosts-management,
.blacklists-management {
margin-top: 1rem;
}
.rules-input,
.rules-filter,
.hosts-filter {
display: grid;
grid-template-columns: 1fr auto;
gap: 1rem;
margin-bottom: 1.5rem;
}
.rules-input {
grid-template-columns: 1fr auto auto;
}
/* 查询表单 */
.query-form .form-group {
display: grid;
grid-template-columns: 1fr auto;
gap: 1rem;
}
/* 查询结果样式 */
.query-result {
margin-top: 2rem;
}
#query-result-container {
background-color: #f8f9fa;
border-radius: 8px;
padding: 1.5rem;
}
#query-result-container.hidden {
display: none;
}
.result-header {
margin-bottom: 1rem;
border-bottom: 1px solid #e9ecef;
padding-bottom: 0.5rem;
}
.result-header h3 {
font-size: 1.2rem;
color: #2c3e50;
}
.result-item {
padding: 0.5rem 0;
border-bottom: 1px solid #e9ecef;
}
.result-item:last-child {
border-bottom: none;
}
/* 配置表单样式 */
.config-form {
margin-top: 1rem;
}
.config-section {
background-color: #f8f9fa;
border-radius: 8px;
padding: 1.5rem;
margin-bottom: 2rem;
}
.config-section h3 {
margin-bottom: 1.5rem;
font-size: 1.2rem;
color: #2c3e50;
}
.config-actions {
text-align: center;
margin-top: 2rem;
}
/* 通知组件 */
.notification {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #3498db;
color: white;
padding: 1rem 1.5rem;
border-radius: 4px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
z-index: 1000;
transform: translateX(100%);
transition: transform 0.3s ease;
}
.notification.show {
transform: translateX(0);
}
.notification.success {
background-color: #2ecc71;
}
.notification.error {
background-color: #e74c3c;
}
.notification.warning {
background-color: #f39c12;
}
.notification-content {
display: flex;
align-items: center;
}
.notification-content i {
margin-right: 1rem;
}
/* 大屏幕优化 */
@media (min-width: 1200px) {
.container {
max-width: 1400px;
margin: 0 auto;
}
}
/* 平板设备 */
@media (max-width: 1024px) {
.content {
padding: 1rem;
}
.stats-grid,
.charts-container {
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.tables-container {
grid-template-columns: 1fr;
}
}
/* 移动设备 */
@media (max-width: 768px) {
.container {
flex-direction: column;
}
.sidebar {
width: 100%;
height: auto;
max-height: 120px;
}
.nav-menu {
display: flex;
overflow-x: auto;
padding-bottom: 0.5rem;
}
.nav-item {
white-space: nowrap;
padding: 0.75rem 1rem;
}
.stats-grid,
.charts-container,
.tables-container {
grid-template-columns: 1fr;
}
.rules-input,
.rules-filter,
.hosts-filter {
grid-template-columns: 1fr;
}
.form-row {
grid-template-columns: 1fr;
}
.query-form .form-group {
grid-template-columns: 1fr;
}
.panel {
padding: 1rem;
}
.pagination-controls {
flex-direction: column;
align-items: stretch;
gap: 12px;
}
.pagination-buttons {
flex-direction: column;
align-items: stretch;
gap: 12px;
}
.nav-buttons {
justify-content: center;
}
}
/* 小屏幕移动设备 */
@media (max-width: 480px) {
header {
padding: 1.5rem 1rem;
}
.logo h1 {
font-size: 1.5rem;
}
.content {
padding: 0.75rem;
}
.panel-header {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.stat-card {
padding: 1rem;
}
.stat-value {
font-size: 1.5rem;
}
.chart-card {
padding: 1rem;
}
th, td {
padding: 0.5rem;
font-size: 0.9rem;
}
}
/* 加载动画 */
.loading {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid #f3f3f3;
border-top: 3px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 确保按钮在不同容器中保持一致宽度 */
.w-full {
width: 100%;
}
/* 确保输入和按钮在表单组中有合适的高度对齐 */
.form-group button {
height: auto;
align-self: flex-end;
}
/* 优化表格中的操作按钮间距 */
.actions-cell {
display: flex;
gap: 0.5rem;
}