From de313ebf13ac360ffc962ec381e46ccaa4ce50fb Mon Sep 17 00:00:00 2001 From: yiqiu Date: Sun, 28 Dec 2025 22:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA=E5=AD=90?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=8F=AF=E8=A7=86=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/admin/index.html | 110 +++++++++++++++--- 1 file changed, 96 insertions(+), 14 deletions(-) diff --git a/plugins/addon/theme_configurator/template/admin/index.html b/plugins/addon/theme_configurator/template/admin/index.html index 820ee11..6c69fff 100644 --- a/plugins/addon/theme_configurator/template/admin/index.html +++ b/plugins/addon/theme_configurator/template/admin/index.html @@ -671,11 +671,12 @@ const hasChildren = Array.isArray(nav.children) && nav.children.length > 0; const item = document.createElement('div'); item.className = 'config-item'; + item.style.borderLeft = '3px solid #52c41a'; // 绿色标识 item.innerHTML = ` -
-

导航 ${index + 1}: ${nav.name || '(未命名)'}

+
+

导航 ${index + 1}: ${nav.name || '(未命名)'}

- +
@@ -809,47 +810,93 @@ } }; - // ========== 底部导航(简化) ========== + // ========== 底部导航(完整版 - 支持子菜单) ========== function renderFooterNav(navs) { const container = document.getElementById('footerNavList'); if (!container) return; container.innerHTML = ''; navs.forEach((col, index) => { + const hasChildren = Array.isArray(col.children) && col.children.length > 0; const item = document.createElement('div'); item.className = 'config-item'; + item.style.borderLeft = '3px solid #1890ff'; // 蓝色标识 item.innerHTML = ` -
-

栏目 ${index + 1}

- +
+

栏目 ${index + 1}: ${col.name || '(未命名)'}

+
+ + +
-
-
链接列表请使用JSON编辑器配置
+
`; container.appendChild(item); + + if (hasChildren) { + renderFooterNavChildren(index, col.children); + } + }); + } + + function renderFooterNavChildren(navIndex, children) { + const container = document.getElementById(`footer-nav-children-list-${navIndex}`); + if (!container) return; + container.innerHTML = ''; + + children.forEach((child, childIndex) => { + const item = document.createElement('div'); + item.style.cssText = 'padding:8px; margin-bottom:8px; background:#f0f8ff; border-radius:4px; border-left:2px solid #1890ff;'; + item.innerHTML = ` +
+
+ + + +
+ +
+ `; + container.appendChild(item); }); } function collectFooterNav() { const navs = []; + + // 收集栏目名称 document.querySelectorAll('[data-fnav]').forEach(input => { const index = parseInt(input.dataset.fnav); if (!navs[index]) navs[index] = { children: [] }; navs[index][input.dataset.field] = input.value; }); - // 保留原有的children - const orig = config.footer_nav || []; - navs.forEach((nav, i) => { - if (orig[i] && orig[i].children) { - nav.children = orig[i].children; + + // 收集链接列表 + document.querySelectorAll('[data-fnav-child]').forEach(input => { + const [navIndex, childIndex] = input.dataset.fnavChild.split('.').map(Number); + const field = input.dataset.field; + + if (!navs[navIndex]) navs[navIndex] = { children: [] }; + if (!navs[navIndex].children[childIndex]) { + navs[navIndex].children[childIndex] = {}; + } + + if (input.type === 'checkbox') { + navs[navIndex].children[childIndex][field] = input.checked; + } else { + navs[navIndex].children[childIndex][field] = input.value; } }); + return navs.filter(n => n); } @@ -865,6 +912,41 @@ renderFooterNav(navs); }; + window.toggleFooterNavChildren = function (index) { + const container = document.getElementById(`footer-nav-children-${index}`); + const toggleBtn = document.getElementById(`toggle-footer-${index}`); + + if (container && toggleBtn) { + const isHidden = container.style.display === 'none'; + container.style.display = isHidden ? 'block' : 'none'; + toggleBtn.textContent = isHidden ? '收起链接列表' : '展开链接列表'; + } + }; + + window.addFooterNavChild = function (navIndex) { + const navs = collectFooterNav(); + if (!navs[navIndex]) navs[navIndex] = { children: [] }; + if (!navs[navIndex].children) navs[navIndex].children = []; + + navs[navIndex].children.push({ + name: '', + url: '', + blank: false + }); + + renderFooterNav(navs); + // 确保展开 + document.getElementById(`footer-nav-children-${navIndex}`).style.display = 'block'; + }; + + window.removeFooterNavChild = function (navIndex, childIndex) { + const navs = collectFooterNav(); + if (navs[navIndex] && navs[navIndex].children) { + navs[navIndex].children.splice(childIndex, 1); + renderFooterNav(navs); + } + }; + // 文件上传 document.addEventListener('click', (e) => {