From a1ea5c67521cf8b0fb05bfaa26a625b3c8268b39 Mon Sep 17 00:00:00 2001 From: liangjiami <2249412933@qq.com> Date: Fri, 18 Jul 2025 15:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=8F=90=E5=8F=96=E7=A9=BA?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=20=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/pc/topic_nas/help_detail.html | 32 +++++++++++-------- .../index/pc/css/topic_nas_help-detail.css | 1 + 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/app/index/view/pc/topic_nas/help_detail.html b/app/index/view/pc/topic_nas/help_detail.html index a703738e..e3840970 100644 --- a/app/index/view/pc/topic_nas/help_detail.html +++ b/app/index/view/pc/topic_nas/help_detail.html @@ -121,21 +121,27 @@ // 内容 // 清空标题列表 $("#title-list ul").empty(); - // 提取 h1 标题 + // 提取 h3 标题 var h1Titles = $("#rendered-content").find("h3"); - h1Titles.each(function (index) { - var title = $(this); - var titleText = title.text(); - var titleId = "title-" + index; - title.attr("id", titleId); - var listItem = $("
  • "); - var link = $("", { - href: "#" + titleId, - text: titleText + // 只有当找到h3标题且内容不为空时才进行处理 + if (h1Titles.length > 0) { + h1Titles.each(function (index) { + var title = $(this); + var titleText = title.text().trim(); // 使用trim()去除空白字符 + // 只有当标题文本不为空时才添加到列表 + if (titleText) { + var titleId = "title-" + index; + title.attr("id", titleId); + var listItem = $("
  • "); + var link = $("", { + href: "#" + titleId, + text: titleText + }); + listItem.append(link); + $("#title-list ul").append(listItem); + } }); - listItem.append(link); - $("#title-list ul").append(listItem); - }); + } }); {/block} \ No newline at end of file diff --git a/public/static/index/pc/css/topic_nas_help-detail.css b/public/static/index/pc/css/topic_nas_help-detail.css index 9f4afebc..9b95914f 100755 --- a/public/static/index/pc/css/topic_nas_help-detail.css +++ b/public/static/index/pc/css/topic_nas_help-detail.css @@ -173,6 +173,7 @@ .narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list li a.active { color: #1f2635; border-bottom: 1px solid #1f2635; + font-weight: bold; } .narshelpdetailPc .nars-help-content .nars-hlpdt-mm {