From 461aa0c691cac4f32254e6f7eafa45ec949f81d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E5=85=89=E5=AD=9F?= Date: Tue, 10 Mar 2026 10:36:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(article):=20=E6=B7=BB=E5=8A=A0=E6=9C=AA?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=96=87=E7=AB=A0=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=B9=B6=E6=8F=92=E5=85=A5=E6=9D=A5=E6=BA=90=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/article/indexNewsInfo.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/article/indexNewsInfo.vue b/src/components/article/indexNewsInfo.vue index 598834c..fc9d2af 100644 --- a/src/components/article/indexNewsInfo.vue +++ b/src/components/article/indexNewsInfo.vue @@ -234,8 +234,13 @@ function getFirstTextNode(node: any): any { const content = computed(() => { const content = props.data.content; + // 未发布文章直接返回 status = 2 已发布 + if(!content || props.data.status !== 2) { + return content; + } + + // 插入文案 const insertText = `中证参考海外资讯${dayjs(props.data.publishTime).format('MM月DD日')}援引${props.data.source}`; - if (!content) return; const dom = new DOMParser().parseFromString(content, "text/html"); const body = dom.querySelector("body"); const p = body?.childNodes; @@ -246,7 +251,7 @@ const content = computed(() => { textNode.textContent = insertText + textNode.textContent; break; } - } + } return body?.innerHTML; });