diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..7272af4 --- /dev/null +++ b/admin.php @@ -0,0 +1,123 @@ + + + + + + 后台登录 - 财神组 + + + + +
+

财神组内部管理

+ $error
"; ?> +
+
+ + +
+ +
+ + + + prepare("UPDATE site_content SET title = :title, content = :content WHERE id = :id"); + $stmt->execute(['title' => $title, 'content' => $content, 'id' => $id]); + $success = "内容更新成功!"; +} + +$contents = $db->query("SELECT * FROM site_content ORDER BY id ASC")->fetchAll(); +?> + + + + + 内容管理后台 - 财神组 + + + + + + +
+ $success
"; ?> + +
+
+ +
+
+ () +
+
+
+ +
+ + +
+
+ + +
+ +
+
+
+ +
+
+ + + diff --git a/assets/css/custom.css b/assets/css/custom.css index 947053e..3487deb 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -22,7 +22,7 @@ body { height: 100%; pointer-events: none; z-index: 9999; - opacity: 0.05; + opacity: 0.04; display: flex; flex-wrap: wrap; justify-content: space-around; @@ -30,52 +30,78 @@ body { } .watermark-text { - font-size: 3rem; + font-size: 2.5rem; font-weight: 900; transform: rotate(-30deg); color: var(--primary-red); white-space: nowrap; user-select: none; - margin: 50px; + margin: 40px; } /* Sidebar Styling */ -#sidebar { - height: 100vh; - box-shadow: 2px 0 10px rgba(0,0,0,0.1); +.sidebar { + position: fixed; + top: 0; + bottom: 0; + left: 0; + z-index: 100; + padding: 0; + box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1); background-color: var(--sidebar-bg) !important; border-right: 2px solid var(--primary-red); - z-index: 100; + transition: transform 0.3s ease-in-out; } -#sidebar .nav-link { +.sidebar-sticky { + height: calc(100vh - 48px); + overflow-x: hidden; + overflow-y: auto; +} + +#sidebarMenu .nav-link { font-weight: 600; color: #495057; padding: 12px 20px; border-radius: 8px; margin: 5px 15px; - transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); + transition: all 0.2s; + display: flex; + align-items: center; } -#sidebar .nav-link:hover { +#sidebarMenu .nav-link:hover { background-color: #fce4e4; color: var(--primary-red); transform: translateX(5px); } -#sidebar .nav-link.active { +#sidebarMenu .nav-link.active { background-color: var(--primary-red); color: var(--accent-gold) !important; box-shadow: 0 4px 6px rgba(183, 28, 28, 0.3); } .sidebar-heading { - font-size: 0.8rem; + font-size: 0.75rem; font-weight: 800; color: var(--primary-red) !important; - letter-spacing: 0.15rem; + letter-spacing: 0.1rem; padding: 0 2rem; - margin-top: 2rem !important; + margin-top: 1.5rem !important; + opacity: 0.8; +} + +/* Navbar */ +.navbar-brand { + padding-top: .75rem; + padding-bottom: .75rem; + font-size: 1rem; +} + +.navbar-toggler { + top: .25rem; + right: 1rem; } /* Content Area */ @@ -84,7 +110,7 @@ main { } #content-area { - min-height: 85vh; + min-height: 80vh; line-height: 1.8; background: white; padding: 2.5rem !important; @@ -115,20 +141,13 @@ main { margin-bottom: 0.8rem; } -/* Buttons */ -.btn-primary { - background-color: #0088cc !important; - border: none; - transition: transform 0.2s; -} - -.btn-primary:hover { - transform: scale(1.1); -} - -.btn-danger { - background-color: var(--primary-red) !important; - border: none; +/* Image styling in content */ +#content-area img { + max-width: 100%; + height: auto; + border-radius: 10px; + margin: 1rem 0; + border: 1px solid #eee; } /* Footer */ @@ -141,9 +160,26 @@ main { text-align: center; } +/* Responsive adjustments */ +@media (max-width: 767.98px) { + .sidebar { + top: 48px; + transform: translateX(-100%); + } + .sidebar.show { + transform: translateX(0); + width: 100%; + max-width: 280px; + } + #content-area { + padding: 1.5rem !important; + margin-top: 20px; + } +} + /* Scrollbar */ ::-webkit-scrollbar { - width: 8px; + width: 6px; } ::-webkit-scrollbar-track { background: #f1f1f1; @@ -152,16 +188,6 @@ main { background: var(--primary-red); border-radius: 10px; } -::-webkit-scrollbar-thumb:hover { - background: #880000; -} -/* Responsive adjustments */ -@media (max-width: 767.98px) { - #sidebar { - height: auto; - border-right: none; - border-bottom: 2px solid var(--primary-red); - } -} -@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .animate-fade-in { animation: fadeIn 0.5s ease-out forwards; } +@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } +.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; } \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index d525e6a..bd7c3a7 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,8 +1,18 @@ document.addEventListener('DOMContentLoaded', function() { - const siteData = JSON.parse(document.getElementById('site-data').textContent); + const siteDataElement = document.getElementById('site-data'); + if (!siteDataElement) return; + + let siteData = []; + try { + siteData = JSON.parse(siteDataElement.textContent); + } catch (e) { + console.error("Failed to parse site data", e); + } + const contentArea = document.getElementById('content-area'); const navLinks = document.querySelectorAll('.nav-link'); const backToTopBtn = document.getElementById('backToTop'); + const sidebarMenu = document.getElementById('sidebarMenu'); // Handle Content Switching navLinks.forEach(link => { @@ -18,9 +28,15 @@ document.addEventListener('DOMContentLoaded', function() { if (data) { renderContent(data); - // On mobile, scroll to content after selection + + // On mobile, scroll to content after selection and close sidebar if (window.innerWidth < 768) { contentArea.scrollIntoView({ behavior: 'smooth' }); + // Close bootstrap collapse if open + const bsCollapse = bootstrap.Collapse.getInstance(sidebarMenu); + if (bsCollapse) { + bsCollapse.hide(); + } } } }); @@ -56,9 +72,9 @@ document.addEventListener('DOMContentLoaded', function() { window.scrollTo({ top: 0, behavior: 'smooth' }); }); - // Auto-select Day 1 on load + // Auto-select Day 1 on load if available const firstLink = document.querySelector('.nav-link[data-section="day1"]'); - if (firstLink) { + if (firstLink && siteData.length > 0) { firstLink.click(); } -}); \ No newline at end of file +}); diff --git a/index.php b/index.php index b1d793b..4d837a5 100644 --- a/index.php +++ b/index.php @@ -5,12 +5,15 @@ $projectName = "财神组聊天构造"; $projectDesc = "财神组内部资料 翻版必究"; $projectLogo = "assets/pasted-20260130-145435-442da57a.jpg"; +$dbError = false; +$allContent = []; + try { $db = db(); $stmt = $db->query("SELECT section_key, title, content FROM site_content ORDER BY id ASC"); $allContent = $stmt->fetchAll(); } catch (PDOException $e) { - $allContent = []; + $dbError = "数据库连接失败或未初始化。请检查 db/config.php 并访问 /db/setup_db.php"; error_log("DB Error: " . $e->getMessage()); } ?> @@ -36,17 +39,28 @@ try {
- +
财神组
+ + +
-