From 41d3b01c240d370abe6419abcbc57b5d93979767 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 17 Jun 2026 20:23:22 +0800 Subject: [PATCH] 11 --- src/pages/integrated/notice/detail.vue | 29 +++- src/pages/order/detail.vue | 41 +++--- src/pages/tabbar/~individualOrder.vue | 176 +++++++++++-------------- src/sheep/utils/request.ts | 3 +- 4 files changed, 124 insertions(+), 125 deletions(-) diff --git a/src/pages/integrated/notice/detail.vue b/src/pages/integrated/notice/detail.vue index 6f836d6..3c4cf33 100644 --- a/src/pages/integrated/notice/detail.vue +++ b/src/pages/integrated/notice/detail.vue @@ -60,9 +60,36 @@ const getActDetail = async () => { const goGetCoupon = () => { uni.navigateTo({ url: `/pages/merchant/merchant-activity?actId=${actDetail.value.actId}&actType=${actDetail.value.actType}` }) } +const normalizeRichText = (html: string) => { + const origin = "https://stgl.pj.gov.cn" + return html.replace(/]*>/gi, (imgTag) => { + let next = imgTag + + next = next.replace(/\bsrc\s*=\s*(['"])(.*?)\1/i, (_m, quote: string, src: string) => { + let resolved = src + if (resolved?.startsWith("/api")) resolved = `${origin}${resolved}` + if (resolved?.startsWith("//")) resolved = `https:${resolved}` + return `src=${quote}${resolved}${quote}` + }) + + const styleMatch = next.match(/\bstyle\s*=\s*(['"])([\s\S]*?)\1/i) + const required = "max-width: 100%; height: auto; display: block;" + if (styleMatch) { + const quote = styleMatch[1] + const styleValue = styleMatch[2] ?? "" + if (styleValue.includes("max-width") || styleValue.includes("width")) return next + const merged = styleValue.trim().length ? `${styleValue.replace(/;?\s*$/, "; ")}${required}` : required + return next.replace(/\bstyle\s*=\s*(['"])([\s\S]*?)\1/i, `style=${quote}${merged}${quote}`) + } + + return next.replace(/ { - return detail.value.description?.replaceAll(` {