修复插件
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yiqiu
2025-12-28 15:59:59 +08:00
parent 9e19c14b9e
commit 6c960f8175

View File

@@ -180,7 +180,7 @@
</div> </div>
</section> </section>
<!-- 导航配置 --> <!-- 导航配置 -->
<section id="tab-nav" class="config-section"> <section id="tab-nav" class="config-section">
<div class="section-card"> <div class="section-card">
<div class="section-header"> <div class="section-header">
@@ -202,7 +202,7 @@
</div> </div>
</section> </section>
<!-- 其他配置 --> <!-- 其他配置 -->
<section id="tab-other" class="config-section"> <section id="tab-other" class="config-section">
<div class="section-card"> <div class="section-card">
<div class="section-header"> <div class="section-header">
@@ -317,11 +317,11 @@
// 渲染荣誉列表 // 渲染荣誉列表
renderHonors(data.honor || []); renderHonors(data.honor || []);
// 渲染导航 // 渲染导航
renderHeaderNav(data.header_nav || []); renderHeaderNav(data.header_nav || []);
renderFooterNav(data.footer_nav || []); renderFooterNav(data.footer_nav || []);
// 渲染其他配置 // 渲染其他配置
renderFriendlyLinks(data.friendly_link || []); renderFriendlyLinks(data.friendly_link || []);
renderSides(data.side || []); renderSides(data.side || []);
@@ -495,7 +495,7 @@
// ========== 友情链接 ========== // ========== 友情链接 ==========
function renderFriendlyLinks(links) { function renderFriendlyLinks(links) {
const container = document.getElementById('friendlyLinkList'); const container = document.getElementById('friendlyLinkList');
if(!container) return; if (!container) return;
container.innerHTML = ''; container.innerHTML = '';
links.forEach((link, index) => { links.forEach((link, index) => {
const item = document.createElement('div'); const item = document.createElement('div');
@@ -533,13 +533,13 @@
return links.filter(l => l); return links.filter(l => l);
} }
window.addFriendlyLink = function() { window.addFriendlyLink = function () {
const links = collectFriendlyLinks(); const links = collectFriendlyLinks();
links.push({ name: '', url: '' }); links.push({ name: '', url: '' });
renderFriendlyLinks(links); renderFriendlyLinks(links);
}; };
window.removeFriendlyLink = function(index) { window.removeFriendlyLink = function (index) {
const links = collectFriendlyLinks(); const links = collectFriendlyLinks();
links.splice(index, 1); links.splice(index, 1);
renderFriendlyLinks(links); renderFriendlyLinks(links);
@@ -548,7 +548,7 @@
// ========== 侧边浮窗 ========== // ========== 侧边浮窗 ==========
function renderSides(sides) { function renderSides(sides) {
const container = document.getElementById('sideList'); const container = document.getElementById('sideList');
if(!container) return; if (!container) return;
container.innerHTML = ''; container.innerHTML = '';
sides.forEach((side, index) => { sides.forEach((side, index) => {
const item = document.createElement('div'); const item = document.createElement('div');
@@ -593,13 +593,13 @@
return sides.filter(s => s); return sides.filter(s => s);
} }
window.addSide = function() { window.addSide = function () {
const sides = collectSides(); const sides = collectSides();
sides.push({ name: '', icon: '', content: '' }); sides.push({ name: '', icon: '', content: '' });
renderSides(sides); renderSides(sides);
}; };
window.removeSide = function(index) { window.removeSide = function (index) {
const sides = collectSides(); const sides = collectSides();
sides.splice(index, 1); sides.splice(index, 1);
renderSides(sides); renderSides(sides);
@@ -608,7 +608,7 @@
// ========== 反馈类型 ========== // ========== 反馈类型 ==========
function renderFeedbackTypes(types) { function renderFeedbackTypes(types) {
const container = document.getElementById('feedbackTypeList'); const container = document.getElementById('feedbackTypeList');
if(!container) return; if (!container) return;
container.innerHTML = ''; container.innerHTML = '';
types.forEach((type, index) => { types.forEach((type, index) => {
const item = document.createElement('div'); const item = document.createElement('div');
@@ -650,13 +650,13 @@
return types.filter(t => t); return types.filter(t => t);
} }
window.addFeedbackType = function() { window.addFeedbackType = function () {
const types = collectFeedbackTypes(); const types = collectFeedbackTypes();
types.push({ id: '', name: '', description: '' }); types.push({ id: '', name: '', description: '' });
renderFeedbackTypes(types); renderFeedbackTypes(types);
}; };
window.removeFeedbackType = function(index) { window.removeFeedbackType = function (index) {
const types = collectFeedbackTypes(); const types = collectFeedbackTypes();
types.splice(index, 1); types.splice(index, 1);
renderFeedbackTypes(types); renderFeedbackTypes(types);
@@ -665,7 +665,7 @@
// ========== 顶部导航(简化) ========== // ========== 顶部导航(简化) ==========
function renderHeaderNav(navs) { function renderHeaderNav(navs) {
const container = document.getElementById('headerNavList'); const container = document.getElementById('headerNavList');
if(!container) return; if (!container) return;
container.innerHTML = ''; container.innerHTML = '';
navs.forEach((nav, index) => { navs.forEach((nav, index) => {
const item = document.createElement('div'); const item = document.createElement('div');
@@ -706,20 +706,20 @@
// 保留原有的children // 保留原有的children
const orig = config.header_nav || []; const orig = config.header_nav || [];
navs.forEach((nav, i) => { navs.forEach((nav, i) => {
if(orig[i] && orig[i].children) { if (orig[i] && orig[i].children) {
nav.children = orig[i].children; nav.children = orig[i].children;
} }
}); });
return navs.filter(n => n); return navs.filter(n => n);
} }
window.addHeaderNav = function() { window.addHeaderNav = function () {
const navs = collectHeaderNav(); const navs = collectHeaderNav();
navs.push({ name: '', file_address: '', children: [] }); navs.push({ name: '', file_address: '', children: [] });
renderHeaderNav(navs); renderHeaderNav(navs);
}; };
window.removeHeaderNav = function(index) { window.removeHeaderNav = function (index) {
const navs = collectHeaderNav(); const navs = collectHeaderNav();
navs.splice(index, 1); navs.splice(index, 1);
renderHeaderNav(navs); renderHeaderNav(navs);
@@ -728,7 +728,7 @@
// ========== 底部导航(简化) ========== // ========== 底部导航(简化) ==========
function renderFooterNav(navs) { function renderFooterNav(navs) {
const container = document.getElementById('footerNavList'); const container = document.getElementById('footerNavList');
if(!container) return; if (!container) return;
container.innerHTML = ''; container.innerHTML = '';
navs.forEach((col, index) => { navs.forEach((col, index) => {
const item = document.createElement('div'); const item = document.createElement('div');
@@ -762,20 +762,20 @@
// 保留原有的children // 保留原有的children
const orig = config.footer_nav || []; const orig = config.footer_nav || [];
navs.forEach((nav, i) => { navs.forEach((nav, i) => {
if(orig[i] && orig[i].children) { if (orig[i] && orig[i].children) {
nav.children = orig[i].children; nav.children = orig[i].children;
} }
}); });
return navs.filter(n => n); return navs.filter(n => n);
} }
window.addFooterNav = function() { window.addFooterNav = function () {
const navs = collectFooterNav(); const navs = collectFooterNav();
navs.push({ name: '', children: [] }); navs.push({ name: '', children: [] });
renderFooterNav(navs); renderFooterNav(navs);
}; };
window.removeFooterNav = function(index) { window.removeFooterNav = function (index) {
const navs = collectFooterNav(); const navs = collectFooterNav();
navs.splice(index, 1); navs.splice(index, 1);
renderFooterNav(navs); renderFooterNav(navs);
@@ -855,6 +855,8 @@
alert(res.data.msg || '保存成功'); alert(res.data.msg || '保存成功');
// 使用服务器返回的数据更新config // 使用服务器返回的数据更新config
config = res.data.data || data; config = res.data.data || data;
// 清除前端缓存,确保下次访问时重新加载最新数据
sessionStorage.removeItem('commentData');
// 重新渲染界面 // 重新渲染界面
fillForm(config); fillForm(config);
}).catch(err => { }).catch(err => {