| | |
| | | <view v-for="(file, index) in repairImageList" |
| | | :key="file.id || index" |
| | | class="repair-image-item"> |
| | | <image :src="normalizeFileUrl(file.url || file.tempFilePath)" |
| | | <image :src="getFileAccessUrl(file)" |
| | | mode="aspectFill" |
| | | class="repair-image-preview" |
| | | @click="previewRepairImage(index)" /> |
| | |
| | | return fileUrl; |
| | | }; |
| | | |
| | | const getFileAccessUrl = (file = {}) => { |
| | | if (file?.link) { |
| | | if (String(file.link).startsWith("http")) return file.link; |
| | | return normalizeFileUrl(file.link); |
| | | } |
| | | return normalizeFileUrl(file?.url || file?.tempFilePath || ""); |
| | | }; |
| | | |
| | | const normalizeId = raw => { |
| | | if (raw === null || raw === undefined) return undefined; |
| | | const val = String(raw).trim(); |
| | |
| | | |
| | | const previewRepairImage = index => { |
| | | const urls = repairImageList.value |
| | | .map(item => normalizeFileUrl(item.url || item.tempFilePath)) |
| | | .map(item => getFileAccessUrl(item)) |
| | | .filter(Boolean); |
| | | if (!urls.length) return; |
| | | uni.previewImage({ |