feat:富文本问题

This commit is contained in:
dzc committed 2026-05-13 17:16:21 +08:00
1 parent 11389462df
commit 073797c3bf
4 files changed
+54 -26

No files matched your search

+5 -5
View File
@@ -24,17 +24,17 @@ VITE_OAUTH2_APP_CLIENT='mini:mini'
# VITE_ZZD_CORP_ID=
# --------------------------- 开发环境 api地址 ----------------------------------
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
#VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
; VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc # 邓-本地
VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
# VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc # 邓-本地
# VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
# VITE_APP_DEV_SERVICE = http://123.157.250.162:8089/api # 测试线上
# --------------------------- 开发环境 图片访问基础地址 ---------------------------
# VITE_IMAGE_DEV_PATH = https://stgl.pj.gov.cn/api # 域名线上
VITE_IMAGE_DEV_PATH = https://stgl.pj.gov.cn/api # 域名线上
#VITE_IMAGE_DEV_PATH = http://59.202.170.152:81/api # 信创线上
#VITE_IMAGE_DEV_PATH = https://dzc-test-1.fy.takin.cc # 邓-本地
VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
# VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
# VITE_IMAGE_DEV_PATH = http://123.157.250.162:8089/api # 测试线上
# --------------------------- 生产环境 api地址 ----------------------------------
+43
View File
@@ -8,6 +8,9 @@ importers:
.:
dependencies:
'@babel/runtime':
specifier: ^7.26.0
version: 7.26.7
'@dcloudio/uni-app':
specifier: 3.0.0-4020920240930001
version: 3.0.0-4020920240930001(@dcloudio/types@3.4.14)(postcss@8.5.1)(rollup@4.34.2)(vue@3.5.13(typescript@4.9.5))
@@ -65,6 +68,9 @@ importers:
dayjs:
specifier: ^1.11.13
version: 1.11.13
gdt-jsapi:
specifier: ^1.9.55-beta.14
version: 1.9.55-beta.14
luch-request:
specifier: ^3.1.1
version: 3.1.1
@@ -80,6 +86,9 @@ importers:
radash:
specifier: ^12.1.0
version: 12.1.0
vconsole:
specifier: ^3.15.1
version: 3.15.1
vue:
specifier: ^3.3.11
version: 3.5.13(typescript@4.9.5)
@@ -1304,6 +1313,9 @@ packages:
'@polka/url@1.0.0-next.28':
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
'@remax/mini-types@0.1.0':
resolution: {integrity: sha512-bVDcbUrp6p0PZwfS0xGVQS6k9f8B35BtZaYt/W/IGKh7VALYQ+tS2KcytLRmIJ/Vmohaw5ikIRN89I+frPdh4g==}
'@rollup/pluginutils@5.1.4':
resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==}
engines: {node: '>=14.0.0'}
@@ -2071,6 +2083,10 @@ packages:
copy-anything@2.0.6:
resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==}
copy-text-to-clipboard@3.2.2:
resolution: {integrity: sha512-T6SqyLd1iLuqPA90J5N4cTalrtovCySh58iiZDGJ6FGznbclKh4UI+FGacQSgFzwKG77W7XT5gwbVEbd9cIH1A==}
engines: {node: '>=12'}
core-js-compat@3.40.0:
resolution: {integrity: sha512-0XEDpr5y5mijvw8Lbc6E5AkjrHfp7eEoPlu36SWeAbcL8fn1G1ANe8DBlo2XoNN89oVpxWwOjYIPVzR4ZvsKCQ==}
@@ -2430,6 +2446,9 @@ packages:
function-bind@1.1.2:
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
gdt-jsapi@1.9.55-beta.14:
resolution: {integrity: sha512-OJ9EVvDGEVuBbV8LimUeMjjBgA2Fx9rChrzS1OyxZ1gKsc9pHp9T0hl1QeUfk2vZyOzK3EvAX4G8iUspy2XJRA==}
generic-names@4.0.0:
resolution: {integrity: sha512-ySFolZQfw9FoDb3ed9d80Cm9f0+r7qj+HJkWjeD9RBfpxEVTlVhol+gvaQB/78WbwYfbnNh8nWHHBSlg072y6A==}
@@ -3051,6 +3070,9 @@ packages:
muggle-string@0.3.1:
resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==}
mutation-observer@1.0.3:
resolution: {integrity: sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==}
nanoid@3.3.8:
resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -3872,6 +3894,9 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
vconsole@3.15.1:
resolution: {integrity: sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==}
vite@5.2.8:
resolution: {integrity: sha512-OyZR+c1CE8yeHw5V5t59aXsUPPVTHMDjEZz8MgguLL/Q7NblxhZUlTu9xSPqlsUO/y+X7dlU05jdhvyycD55DA==}
engines: {node: ^18.0.0 || >=20.0.0}
@@ -6066,6 +6091,8 @@ snapshots:
'@polka/url@1.0.0-next.28': {}
'@remax/mini-types@0.1.0': {}
'@rollup/pluginutils@5.1.4(rollup@4.34.2)':
dependencies:
'@types/estree': 1.0.6
@@ -6980,6 +7007,8 @@ snapshots:
dependencies:
is-what: 3.14.1
copy-text-to-clipboard@3.2.2: {}
core-js-compat@3.40.0:
dependencies:
browserslist: 4.24.4
@@ -7327,6 +7356,11 @@ snapshots:
function-bind@1.1.2: {}
gdt-jsapi@1.9.55-beta.14:
dependencies:
'@babel/runtime': 7.26.7
'@remax/mini-types': 0.1.0
generic-names@4.0.0:
dependencies:
loader-utils: 3.3.1
@@ -8151,6 +8185,8 @@ snapshots:
muggle-string@0.3.1: {}
mutation-observer@1.0.3: {}
nanoid@3.3.8: {}
natural-compare@1.4.0: {}
@@ -8981,6 +9017,13 @@ snapshots:
vary@1.1.2: {}
vconsole@3.15.1:
dependencies:
'@babel/runtime': 7.26.7
copy-text-to-clipboard: 3.2.2
core-js: 3.40.0
mutation-observer: 1.0.3
vite@5.2.8(@types/node@18.19.75)(less@4.3.0)(sass@1.71.1)(terser@5.37.0):
dependencies:
esbuild: 0.20.2
+5 -16
View File
@@ -13,14 +13,8 @@
</view>
<view v-if="imageList.length" class="image-list">
<image
v-for="(src, index) in imageList"
:key="index"
class="detail-image"
:src="src"
mode="aspectFill"
@tap="previewImage(index)"
/>
<image v-for="(src, index) in imageList" :key="index" class="detail-image" :src="src" mode="aspectFill"
@tap="previewImage(index)" />
</view>
<view class="detail-section">
@@ -95,8 +89,8 @@ const imageList = computed(() => {
const rawList = Array.isArray(imgs)
? imgs
: imgs
.split(',')
.map((item) => item.trim())
.split(',')
.map((item) => item.trim())
return rawList
.map((item) => toAbsoluteUrl(item))
@@ -106,11 +100,7 @@ const imageList = computed(() => {
const descriptionNodes = computed(() => {
const desc = detail.value?.description
if (!desc) return ''
return desc.replace(/<img\s+[^>]*src=["']([^"']+)["']/gi, (match, src) => {
const fullSrc = toAbsoluteUrl(src)
if (!fullSrc) return match
return match.replace(src, fullSrc)
})
return desc?.replaceAll(`<img src="/api`, `<img src="https://stgl.pj.gov.cn/api`)
})
const contactInfo = computed(() => {
@@ -274,4 +264,3 @@ onLoad((options: Record<string, any>) => {
white-space: pre-wrap;
}
</style>
+1 -5
View File
@@ -31,11 +31,7 @@ const toAbsoluteUrl = (url?: string | null) => {
const richTextNodes = computed(() => {
const html = detail.value.richTextContent
if (!html) return ""
return html.replace(/<img\s+[^>]*src=["']([^"']+)["']/gi, (match, src) => {
const fullSrc = toAbsoluteUrl(src)
if (!fullSrc) return match
return match.replace(src, fullSrc)
})
return html?.replaceAll(`<img src="/api`, `<img src="https://stgl.pj.gov.cn/api`)
})
onLoad(async (options: any) => {