diff --git a/js/admin.js b/js/admin.js index 76ddf8f..cfd7089 100644 --- a/js/admin.js +++ b/js/admin.js @@ -60,6 +60,10 @@ function renderAdminReports() { }); } +// ============================================================ +// 👥 用户列表(支持分页 + 搜索) +// ============================================================ + let currentUsersPage = 1; let usersTotalPages = 1; let usersSearchKeyword = ''; @@ -244,6 +248,10 @@ function renderAdminUsers(page = 1, search = '') { }); } +// ============================================================ +// 📜 操作日志(支持分页) +// ============================================================ + function renderAdminLogs(page = 1) { const container = document.getElementById('adminContent'); container.innerHTML = '
加载中...
'; @@ -345,6 +353,10 @@ function renderAdminLogs(page = 1) { }); } +// ============================================================ +// 🔗 友情链接管理 +// ============================================================ + function renderAdminLinks() { const container = document.getElementById('adminContent'); container.innerHTML = ` @@ -368,7 +380,7 @@ function renderAdminLinks() { html += `
${l.title} - @@ -400,52 +412,26 @@ function renderAdminLinks() { } // ============================================================ -// ⚙️ 论坛设置(含自定义 CSS) +// ⚙️ 论坛设置(只改名称) // ============================================================ function renderAdminSettings() { const container = document.getElementById('adminContent'); container.innerHTML = ` -

⚙️ 论坛设置

+

⚙️ 论坛名称

- -
+
- -
- - -

🎨 自定义 CSS

-

上传 style.css 覆盖默认样式,自定义论坛外观。

- -
-
- -

- 点击或拖拽上传 style.css -

-

只能上传 style.css 文件

- -
-
- -
- - -
-
`; - // 加载当前论坛名称 API.getSettings().then(data => { document.getElementById('settingsForumName').value = data.forum_name || 'Forumlify'; }).catch(() => {}); - // 保存论坛名称 document.getElementById('settingsForumSave').addEventListener('click', async () => { const name = document.getElementById('settingsForumName').value.trim(); if (!name) { alert('请输入论坛名称'); return; } @@ -462,8 +448,37 @@ function renderAdminSettings() { document.getElementById('settingsResult').style.color = '#ef4444'; } }); +} - // 自定义 CSS 上传 +// ============================================================ +// 🎨 自定义 CSS(独立标签页) +// ============================================================ + +function renderAdminCustomCSS() { + const container = document.getElementById('adminContent'); + container.innerHTML = ` +

🎨 自定义 CSS

+

上传 style.css 覆盖默认样式,自定义论坛外观。

+ +
+
+ +

+ 点击或拖拽上传 style.css +

+

只能上传 style.css 文件

+ +
+
+ +
+ + +
+
+ `; + + // 自定义 CSS 上传逻辑 const dropZone = document.getElementById('customCssDropZone'); const fileInput = document.getElementById('customCssInput'); const dropText = document.getElementById('customCssDropText'); @@ -527,7 +542,6 @@ function renderAdminSettings() { statusEl.style.color = '#22c55e'; } - // 保存 CSS document.getElementById('customCssSaveBtn').addEventListener('click', function() { if (!selectedFile) { statusEl.textContent = '⚠️ 请先选择 style.css 文件'; @@ -551,7 +565,6 @@ function renderAdminSettings() { }); }); - // 删除 CSS document.getElementById('customCssDeleteBtn').addEventListener('click', async function() { if (!confirm('确定要删除自定义 CSS 吗?将恢复默认样式。')) return; try { @@ -808,6 +821,7 @@ document.querySelector('.admin-nav')?.addEventListener('click', function(e) { users: renderAdminUsers, logs: renderAdminLogs, links: renderAdminLinks, + 'custom-css': renderAdminCustomCSS, settings: renderAdminSettings, custom: renderAdminCustomPages };