From c9a8ff13b7c91916cf51da4ec1a811a4a48b7256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Tue, 19 May 2026 09:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E6=A0=8F=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/scientist.js | 59 +++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/js/scientist.js b/js/scientist.js index dcc551d..f2d9810 100644 --- a/js/scientist.js +++ b/js/scientist.js @@ -8667,6 +8667,7 @@ function afooter_content() { $('.new_art>h4').html(arr.footer_title); $('.new_art>div').html(arr.content); + } else { @@ -8680,8 +8681,28 @@ function afooter_content() { } +// afoor_text 页:切换栏目前移除注入的 DOM / 样式,避免来回点击叠加 +function teardownFooterTextInjections() { + $('#management-team-wrapper').remove(); + $('#inject-team-style, #init-partner-ships-style').remove(); +} + +function renderLegalFooterContent(footer) { + teardownFooterTextInjections(); + $('.legal_art>h4').html(footer.footer_title); + $('.legal_art>div').html(footer.content); + var fid = String(footer.footer_id); + if (fid === '20') { + insertManagementTeam(); + } else if (fid === '84') { + initPartnerships(); + } +} + // 底栏政策锚点部分 function afooter_text() { // 获取地址栏信息 + var footerTextXhr = null; + function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); @@ -8734,17 +8755,7 @@ function afooter_text() { // 获取地址栏信息 }, success: function (result) { if (result.code == 0) { - var arr = result.data.footer; - - $('.legal_art>h4').html(arr.footer_title); - $('.legal_art>div').html(arr.content); - if (arr.footer_id == '20') { - insertManagementTeam(); - } - if (arr.footer_id == '84') { - initPartnerships(); - } - + renderLegalFooterContent(result.data.footer); } else { ShowDanger("请求失败!"); } @@ -8758,24 +8769,25 @@ function afooter_text() { // 获取地址栏信息 $('.legal_list ul li').click(function () { $('.legal_list ul').find(".leli_chlik").removeClass("leli_chlik") $(this).addClass("leli_chlik") - $.ajax({ + if (footerTextXhr) { + footerTextXhr.abort(); + } + footerTextXhr = $.ajax({ type: 'post', url: apiUrl + 'api/Journal/getFooterAtrNew', data: { footer_id: this.id }, success: function (result) { if (result.code == 0) { - var arr = result.data.footer; - - $('.legal_art>h4').html(arr.footer_title); - $('.legal_art>div').html(arr.content); - + renderLegalFooterContent(result.data.footer); } else { ShowDanger("请求失败!"); } }, - error: function () { - ShowDanger("error!"); + error: function (xhr, status) { + if (status !== 'abort') { + ShowDanger("error!"); + } } }) }) @@ -8792,6 +8804,8 @@ function afooter_text() { // 获取地址栏信息 } function initPartnerships() { + const existingStyle1 = document.getElementById('inject-team-style'); + if (existingStyle1) existingStyle1.remove(); const existingStyle = document.getElementById('init-partner-ships-style'); if (existingStyle) existingStyle.remove(); @@ -8815,8 +8829,8 @@ margin-right: 10px; document.head.appendChild(style); } function insertManagementTeam() { - var teamHtml = '
'; - $('.legal_art>div').after(teamHtml); +$('#management-team-wrapper').remove(); +$('.legal_art>div').after(''); // 1. 核心管理团队数据(前5位使用官方线上路径,最后一位使用本地 img/tmrmember1.png) const teamData = [ { @@ -8879,7 +8893,8 @@ function insertManagementTeam() { // 重置清除旧样式 const existingStyle = document.getElementById('inject-team-style'); if (existingStyle) existingStyle.remove(); - + const existingStyle2 = document.getElementById('init-partner-ships-style'); + if (existingStyle2) existingStyle2.remove(); // 3. 强力防御型 UI 样式注入(精准锁定完美对齐和配色) const style = document.createElement('style'); style.id = 'inject-team-style';