Commit 523a85c2 by cen

fix:多图片

1 parent 9b71faa4
...@@ -109,9 +109,17 @@ ...@@ -109,9 +109,17 @@
{{ field.label }} {{ field.label }}
</view> </view>
<view class="upload-images-wrapper" v-if="getImageBySubtype(field.key)"> <view class="upload-images-wrapper" v-if="getImageBySubtype(field.key)">
<template v-if="field.key === 41 && Array.isArray(getImageBySubtype(field.key))">
<view class="uploaded-media-container" v-for="(img, index) in getImageBySubtype(field.key)" :key="index">
<image :src="img.fileUrl" @click.stop="previewMedia(img.fileUrl, 1)" mode="aspectFill" class="uploaded-media"></image>
</view>
</template>
<!-- 对于其他类型的图片,保持原有显示方式 -->
<template v-else-if="!Array.isArray(getImageBySubtype(field.key))">
<view class="uploaded-media-container"> <view class="uploaded-media-container">
<image :src="getImageBySubtype(field.key).fileUrl" @click.stop="previewMedia(getImageBySubtype(field.key).fileUrl, 1)" mode="aspectFill" class="uploaded-media"></image> <image :src="getImageBySubtype(field.key).fileUrl" @click.stop="previewMedia(getImageBySubtype(field.key).fileUrl, 1)" mode="aspectFill" class="uploaded-media"></image>
</view> </view>
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -655,7 +663,12 @@ export default { ...@@ -655,7 +663,12 @@ export default {
}, },
// 根据fileSubtype获取图片 // 根据fileSubtype获取图片
getImageBySubtype(subtype) { getImageBySubtype(subtype) {
if (!this.detailsInfo.images) return null if (!this.detailsInfo.images) return []
// 对于fileSubtype=41,返回所有匹配的图片数组
if (subtype === 41) {
return this.detailsInfo.images.filter(img => img.fileSubtype === subtype)
}
// 对于其他subtype,保持原有行为返回第一个匹配的图片
const obj = this.detailsInfo.images.find(img => img.fileSubtype === subtype) || null const obj = this.detailsInfo.images.find(img => img.fileSubtype === subtype) || null
return obj return obj
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!