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