From 6cef231473609e66ef3ab2760b73dfdc461ae378 Mon Sep 17 00:00:00 2001 From: jacobxu666 Date: Fri, 4 Sep 2026 16:17:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=99=AF=E5=8C=BA=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=85=AC=E5=91=8A=E5=BC=B9=E7=AA=97=E5=86=85=E5=AE=B9=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E6=8D=A2=E8=A1=8C=E6=A0=BC=E5=BC=8F=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E6=AD=A3=E6=96=87=E5=9B=BA=E5=AE=9A=E9=AB=98=E5=BA=A6?= =?UTF-8?q?45vh=E5=8F=AF=E6=BB=91=E5=8A=A8=E4=B8=8D=E8=A2=AB=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E9=81=AE=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/content/pages/scenic-detail.vue | 25 +++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/packages/content/pages/scenic-detail.vue b/src/packages/content/pages/scenic-detail.vue index ab58a58..e3687a5 100644 --- a/src/packages/content/pages/scenic-detail.vue +++ b/src/packages/content/pages/scenic-detail.vue @@ -193,7 +193,25 @@ function fixRichHtml(html: string): string { const introductionHtml = computed(() => fixRichHtml(scenic.value.introduction)) const bookingNoticeHtml = computed(() => fixRichHtml(scenic.value.bookingNoticeHtml)) -const storeNoticeHtml = computed(() => fixRichHtml(storeNotice.value.content)) + +/** 富文本标签特征(管理端公告内容为 textarea 纯文本,含标签才视为 HTML) */ +// xuchao: 判断公告正文是否为编辑器产出的 HTML +const HTML_TAG_RE = /<(?:p|br|div|span|strong|em|i|b|u|h[1-6]|img|ul|ol|li|a|table|tr|td|video|section)[^>]*>/i + +// xuchao: 纯文本转 rich-text 可渲染的 HTML:转义特殊字符 + 换行转
,保留后台录入的段落格式 +function plainTextToHtml(text: string): string { + return text + .replace(/&(?!(?:#\d+|#x[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);)/g, '&') + .replace(//g, '>') + .replace(/\n/g, '
') +} + +const storeNoticeHtml = computed(() => { + const content = storeNotice.value.content + if (!content) return '' + return HTML_TAG_RE.test(content) ? fixRichHtml(content) : plainTextToHtml(content) +}) const activeTab = ref<'notice' | 'intro'>('notice') const currentSlide = ref(0) @@ -862,13 +880,14 @@ $icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' w text-align: center; } +/* xuchao: 正文区固定 45vh 高度——微信要求 scroll-view 有确定高度才能竖向滚动;flex-shrink:0 防止被弹窗整体高度压缩 */ .notice-popup-body { + height: 45vh; + flex-shrink: 0; padding: $spacing-3 $spacing-5 $spacing-3; font-size: $font-size-sm; color: $uv-tips-color; line-height: 1.9; - max-height: 45vh; - overflow-y: auto; } .notice-popup-footer {