新增表格排版

This commit is contained in:
MasonLiu committed 2026-06-01 00:24:51 +08:00
1 parent e58195147f
commit b69243e51a
4 files changed
+1019 -11

No files matched your search

+95 -8
View File
@@ -232,6 +232,54 @@ try {
visibility: visible;
}
/* 视图切换下拉菜单 */
.view-menu {
position: fixed;
top: 60px;
right: 15px;
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
padding: 8px 0;
min-width: 150px;
z-index: 101;
display: none;
}
.view-menu.show {
display: block;
}
.view-menu-item {
display: flex;
align-items: center;
padding: 10px 16px;
color: var(--text-primary);
text-decoration: none;
transition: background-color 0.2s ease;
cursor: pointer;
border: none;
background: none;
width: 100%;
font-size: 0.9em;
text-align: left;
}
.view-menu-item:hover {
background-color: var(--hover-bg);
}
.view-menu-item.active {
background-color: var(--accent-color);
color: white;
}
.view-menu-icon {
margin-right: 10px;
font-size: 1.1em;
}
/* 栏目区域 */
.section {
margin-bottom: 20px;
@@ -523,10 +571,23 @@ try {
<button id="theme-toggle" class="theme-toggle" title="点击切换白天/黑夜模式">
<span class="theme-icon">🌙</span>
</button>
<button id="view-toggle" class="view-toggle" title="切换到标准视图" onclick="window.location.href='simple.php'">
<span class="view-icon">📄</span>
<span class="view-tooltip">标准视图</span>
<button id="view-toggle" class="view-toggle" title="切换视图">
<span class="view-icon">📑</span>
</button>
<div id="view-menu" class="view-menu">
<button class="view-menu-item active">
<span class="view-menu-icon">📋</span>
<span>简洁视图</span>
</button>
<button class="view-menu-item" onclick="window.location.href='full.php'">
<span class="view-menu-icon">📄</span>
<span>标准视图</span>
</button>
<button class="view-menu-item" onclick="window.location.href='table.php'">
<span class="view-menu-icon">📊</span>
<span>表格视图</span>
</button>
</div>
</header>
<?php foreach ($sections as $key => $config): ?>
@@ -713,20 +774,20 @@ try {
const themeToggle = document.getElementById('theme-toggle');
const themeIcon = themeToggle.querySelector('.theme-icon');
const body = document.body;
// 从localStorage读取主题设置
// 从 localStorage 读取主题设置
const currentTheme = localStorage.getItem('theme') || 'light';
// 应用保存的主题
if (currentTheme === 'dark') {
body.classList.add('dark-mode');
themeIcon.textContent = '☀️';
}
// 切换主题
themeToggle.addEventListener('click', function() {
body.classList.toggle('dark-mode');
if (body.classList.contains('dark-mode')) {
themeIcon.textContent = '☀️';
localStorage.setItem('theme', 'dark');
@@ -736,6 +797,32 @@ try {
}
});
})();
// 视图切换下拉菜单
(function() {
const viewToggle = document.getElementById('view-toggle');
const viewMenu = document.getElementById('view-menu');
// 点击按钮显示/隐藏菜单
viewToggle.addEventListener('click', function(e) {
e.stopPropagation();
viewMenu.classList.toggle('show');
});
// 点击其他地方关闭菜单
document.addEventListener('click', function(e) {
if (!viewToggle.contains(e.target) && !viewMenu.contains(e.target)) {
viewMenu.classList.remove('show');
}
});
// ESC 键关闭菜单
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
viewMenu.classList.remove('show');
}
});
})();
</script>
</body>
</html>