From 6a972c54fe99a186b5885db1b1319643ce9679dd Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期三, 26 八月 2026 18:43:38 +0800
Subject: [PATCH] 又又更新

---
 rencaika/pages/product-detail/product-detail.uvue |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/rencaika/pages/product-detail/product-detail.uvue b/rencaika/pages/product-detail/product-detail.uvue
index be1eab1..44bdc77 100644
--- a/rencaika/pages/product-detail/product-detail.uvue
+++ b/rencaika/pages/product-detail/product-detail.uvue
@@ -24,7 +24,7 @@
 
 			<view v-if="detailText.length > 0" class="detail-card">
 				<text class="card-title">商品详情</text>
-				<text class="detail-description">{{detailText}}</text>
+				<rich-text class="detail-description" :nodes="detailText"></rich-text>
 			</view>
 
 			<view class="notice-card">
@@ -47,6 +47,7 @@
 <script setup lang="uts">
 	import { isApiConfigured } from '../../config/api.uts'
 	import { getProductDetail } from '../../services/portal.uts'
+	import { sanitizeRichText } from '../../services/business.uts'
 	import { resolveApiUrl } from '../../services/http.uts'
 	import { getSession } from '../../services/session.uts'
 	import { safeBack } from '../../utils/navigation.uts'
@@ -70,7 +71,7 @@
 	const productAvailable = ref(true)
 	const productSoldOut = ref(false)
 
-	// 后台分别返回图片数组与文字结构,不使用富文本 HTML。
+	// Sanitize and render backend-configured product details as rich text.
 	const detailText = ref('')
 
 	// 购买须知固定只有四项,后台只返回四项各自的内容文本。
@@ -130,7 +131,7 @@
 			productAvailable.value = data == null || data.available !== false
 			productSoldOut.value = data != null && (data.soldOut === true || Number(data.stock) == 0)
 			const rawDetailText = data != null && data.detailText != null ? data.detailText as string : ''
-			detailText.value = stripDetailMarkup(rawDetailText)
+			detailText.value = sanitizeRichText(rawDetailText)
 			purchaseNotices.value = buildPurchaseNotices(data != null ? data.purchaseNotice : null)
 		}, () => {})
 	}
@@ -161,12 +162,6 @@
 		return next
 	}
 
-	const stripDetailMarkup = (value: string): string => {
-		if (value == '') return ''
-		let text = value.replace(/<img[^>]*>/gi, '')
-		text = text.replace(/<br\s*\/?>/gi, '\n').replace(/<\/p>/gi, '\n').replace(/<[^>]+>/g, '')
-		return text.replace(/&nbsp;/gi, ' ').replace(/&amp;/gi, '&').replace(/&lt;/gi, '<').replace(/&gt;/gi, '>').trim()
-	}
 	const goBack = () => safeBack('/pages/benefits/benefits')
 	const handleScroll = (event: any) => {
 		const shouldShow = event.detail.scrollTop > 64

--
Gitblit v1.7.1