diff --git a/plugins/addon/theme_configurator/template/admin/index.html b/plugins/addon/theme_configurator/template/admin/index.html
index cea617c..3479ad6 100644
--- a/plugins/addon/theme_configurator/template/admin/index.html
+++ b/plugins/addon/theme_configurator/template/admin/index.html
@@ -662,18 +662,22 @@
renderFeedbackTypes(types);
};
- // ========== 顶部导航(简化) ==========
+ // ========== 顶部导航(完整版 - 支持子菜单) ==========
function renderHeaderNav(navs) {
const container = document.getElementById('headerNavList');
if (!container) return;
container.innerHTML = '';
navs.forEach((nav, index) => {
+ const hasChildren = Array.isArray(nav.children) && nav.children.length > 0;
const item = document.createElement('div');
item.className = 'config-item';
item.innerHTML = `
@@ -683,12 +687,42 @@
-
-
-
+
+
+ `;
+ container.appendChild(item);
+
+ if (hasChildren) {
+ renderHeaderNavChildren(index, nav.children);
+ }
+ });
+ }
+
+ function renderHeaderNavChildren(navIndex, children) {
+ const container = document.getElementById(`header-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:#f9f9f9; border-radius:4px;';
+ item.innerHTML = `
+
`;
container.appendChild(item);
@@ -697,19 +731,32 @@
function collectHeaderNav() {
const navs = [];
+
+ // 收集主导航
document.querySelectorAll('[data-hnav]').forEach(input => {
const index = parseInt(input.dataset.hnav);
const field = input.dataset.field;
if (!navs[index]) navs[index] = { children: [] };
navs[index][field] = input.value;
});
- // 保留原有的children
- const orig = config.header_nav || [];
- navs.forEach((nav, i) => {
- if (orig[i] && orig[i].children) {
- nav.children = orig[i].children;
+
+ // 收集子菜单
+ document.querySelectorAll('[data-hnav-child]').forEach(input => {
+ const [navIndex, childIndex] = input.dataset.hnavChild.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);
}
@@ -725,6 +772,40 @@
renderHeaderNav(navs);
};
+ window.toggleHeaderNavChildren = function (index) {
+ const container = document.getElementById(`header-nav-children-${index}`);
+ if (container) {
+ const isHidden = container.style.display === 'none';
+ container.style.display = isHidden ? 'block' : 'none';
+ }
+ };
+
+ window.addHeaderNavChild = function (navIndex) {
+ const navs = collectHeaderNav();
+ if (!navs[navIndex]) navs[navIndex] = { children: [] };
+ if (!navs[navIndex].children) navs[navIndex].children = [];
+
+ navs[navIndex].children.push({
+ name: '',
+ file_address: '',
+ icon: '',
+ description: '',
+ blank: false
+ });
+
+ renderHeaderNav(navs);
+ // 确保展开
+ document.getElementById(`header-nav-children-${navIndex}`).style.display = 'block';
+ };
+
+ window.removeHeaderNavChild = function (navIndex, childIndex) {
+ const navs = collectHeaderNav();
+ if (navs[navIndex] && navs[navIndex].children) {
+ navs[navIndex].children.splice(childIndex, 1);
+ renderHeaderNav(navs);
+ }
+ };
+
// ========== 底部导航(简化) ==========
function renderFooterNav(navs) {
const container = document.getElementById('footerNavList');