| | |
| | | class="file-item" |
| | | @click="previewFile(file)"> |
| | | <image v-if="file.type.includes('image')" |
| | | :src="file.url" |
| | | :src="formatFileUrl(file.url)" |
| | | class="file-preview" |
| | | mode="aspectFill" /> |
| | | <view v-else |
| | |
| | | if (url.startsWith("http://") || url.startsWith("https://")) { |
| | | return url; |
| | | } |
| | | const uploadsIndex = url.indexOf("uploads"); |
| | | if (uploadsIndex !== -1) { |
| | | const relativePath = url.substring(uploadsIndex); |
| | | return `${config.baseUrl}/profile/${relativePath}`; |
| | | } |
| | | return `${config.baseUrl}/profile/${url}`; |
| | | // const uploadsIndex = url.indexOf("uploads"); |
| | | // if (uploadsIndex !== -1) { |
| | | // const relativePath = url.substring(uploadsIndex); |
| | | // return `${config.fileUrl}/${relativePath}`; |
| | | // } |
| | | return `${config.fileUrl}/${url}`; |
| | | }; |
| | | |
| | | // 判断是否为图片文件 |
| | |
| | | // 处理附件数据 - 支持多种数据结构 |
| | | console.log(data.imagesFile); |
| | | fileList.value = data.imagesFile; |
| | | console.log(formatFileUrl(fileList.value[0].url)); |
| | | }; |
| | | |
| | | // 返回上一页 |