修复移动设备视图

This commit is contained in:
Alex Yang
2025-11-29 02:24:56 +08:00
parent 11bf99355d
commit 11e52e0ffc
6 changed files with 2933 additions and 72 deletions

View File

@@ -132,26 +132,7 @@ header p {
/* 响应式布局 - 移动设备 */
@media (max-width: 768px) {
.sidebar {
position: fixed;
left: -var(--sidebar-width);
top: var(--header-height);
z-index: 99;
height: calc(100vh - var(--header-height));
}
.sidebar.open {
left: 0;
width: var(--sidebar-width);
}
.sidebar.open .nav-item span {
display: block;
}
.sidebar.open .nav-item i {
margin-right: 1rem;
}
/* 这些样式已经通过Tailwind CSS类在HTML中实现这里移除避免冲突 */
}
.nav-menu {

View File

@@ -268,7 +268,7 @@
<li>
<a href="#query" class="flex items-center px-4 py-3 text-gray-700 hover:bg-gray-100 rounded-md transition-all">
<i class="fa fa-search mr-3 text-lg"></i>
<span>DNS查询</span>
<span>DNS屏蔽查询</span>
</a>
</li>
<li>
@@ -295,7 +295,7 @@
<!-- 顶部导航栏 -->
<header class="bg-white border-b border-gray-200 h-16 flex items-center justify-between px-6">
<div class="flex items-center">
<button id="toggle-sidebar" class="md:block lg:hidden text-gray-500 hover:text-gray-700 focus:outline-none">
<button id="toggle-sidebar" class="block md:hidden text-gray-500 hover:text-gray-700 focus:outline-none">
<i class="fa fa-bars text-xl"></i>
</button>
<h2 class="ml-4 text-xl font-semibold" id="page-title">仪表盘</h2>

1727
static/index.html.2 Normal file

File diff suppressed because it is too large Load Diff

1190
static/index.html.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -40,40 +40,52 @@ function setupNavigation() {
// 打开侧边栏函数
function openSidebar() {
console.log('Opening sidebar...');
if (sidebar) {
sidebar.classList.remove('-translate-x-full');
sidebar.classList.add('translate-x-0');
}
if (sidebarOverlay) {
sidebarOverlay.classList.remove('hidden');
sidebarOverlay.classList.add('block');
}
// 防止页面滚动
document.body.style.overflow = 'hidden';
console.log('Sidebar opened successfully');
}
// 关闭侧边栏函数
function closeSidebar() {
console.log('Closing sidebar...');
if (sidebar) {
sidebar.classList.add('-translate-x-full');
sidebar.classList.remove('translate-x-0');
}
if (sidebarOverlay) {
sidebarOverlay.classList.add('hidden');
sidebarOverlay.classList.remove('block');
}
// 恢复页面滚动
document.body.style.overflow = '';
console.log('Sidebar closed successfully');
}
// 切换侧边栏函数
function toggleSidebarVisibility() {
console.log('Toggling sidebar visibility...');
console.log('Current sidebar classes:', sidebar ? sidebar.className : 'sidebar not found');
if (sidebar && sidebar.classList.contains('-translate-x-full')) {
console.log('Sidebar is hidden, opening...');
openSidebar();
} else {
console.log('Sidebar is visible, closing...');
closeSidebar();
}
}
// 绑定切换按钮事件
if (toggleSidebar) {
toggleSidebar.addEventListener('click', openSidebar);
toggleSidebar.addEventListener('click', toggleSidebarVisibility);
}
// 绑定关闭按钮事件

View File

@@ -1,49 +0,0 @@
package main
import (
"fmt"
"dns-server/config"
"dns-server/shield"
"log"
"os"
)
func main() {
// 创建默认Shield配置
shieldCfg := &config.ShieldConfig{
LocalRulesFile: "data/rules.txt",
}
// 创建ShieldManager
shieldManager := shield.NewShieldManager(shieldCfg)
// 添加一条测试规则
rule := "||test.example.com"
err := shieldManager.AddRule(rule)
if err != nil {
log.Fatalf("添加规则失败: %v", err)
}
fmt.Printf("添加规则 %s 成功\n", rule)
// 验证规则是否被添加
localRules := shieldManager.GetLocalRules()
fmt.Printf("添加规则后,本地规则数量: %d\n", len(localRules["domainRules"].([]string)))
// 删除规则
err = shieldManager.RemoveRule(rule + "^")
if err != nil {
log.Fatalf("删除规则失败: %v", err)
}
fmt.Printf("删除规则 %s 成功\n", rule)
// 验证规则是否被删除
localRules = shieldManager.GetLocalRules()
fmt.Printf("删除规则后,本地规则数量: %d\n", len(localRules["domainRules"].([]string)))
// 验证文件内容
fileContent, err := os.ReadFile("data/rules.txt")
if err != nil {
log.Fatalf("读取规则文件失败: %v", err)
}
fmt.Printf("规则文件内容: %s\n", string(fileContent))
}