| | |
| | | // 应用全局配置 |
| | | const config = { |
| | | baseUrl: "http://1.15.17.182:9011", |
| | | fileUrl: "http://1.15.17.182:9010", |
| | | // 应用信息 |
| | | appInfo: { |
| | | // 应用名称 |
| | |
| | | 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}/${relativePath}`; |
| | | } |
| | | return `${config.baseUrl}/${url}`; |
| | | // const uploadsIndex = url.indexOf("uploads"); |
| | | // if (uploadsIndex !== -1) { |
| | | // const relativePath = url.substring(uploadsIndex); |
| | | // return `${config.fileUrl}/${relativePath}`; |
| | | // } |
| | | return `${config.fileUrl}/${url}`; |
| | | }; |
| | | |
| | | // 判断是否为图片文件 |
| | |
| | | |
| | | // 预览文件 |
| | | const previewFile = file => { |
| | | if (file.type.includes("image")) { |
| | | uni.previewImage({ |
| | | urls: [file.url], |
| | | current: file.url, |
| | | }); |
| | | } else { |
| | | // 视频预览 |
| | | const videoUrl = formatFileUrl(file.url || file.downloadUrl); |
| | | uni.navigateTo({ |
| | | url: `/pages/common/videoPreview?url=${encodeURIComponent(videoUrl)}`, |
| | | }); |
| | | } |
| | | // if (file.type.includes("image")) { |
| | | uni.previewImage({ |
| | | urls: [formatFileUrl(file.url)], |
| | | current: formatFileUrl(file.url), |
| | | }); |
| | | // } else { |
| | | // // 视频预览 |
| | | // const videoUrl = formatFileUrl(file.url || file.downloadUrl); |
| | | // uni.navigateTo({ |
| | | // url: `/pages/common/videoPreview?url=${encodeURIComponent(videoUrl)}`, |
| | | // }); |
| | | // } |
| | | }; |
| | | |
| | | // 获取详情数据 |
| | |
| | | // 处理附件数据 - 支持多种数据结构 |
| | | console.log(data.imagesFile); |
| | | fileList.value = data.imagesFile; |
| | | console.log(formatFileUrl(fileList.value[0].url)); |
| | | }; |
| | | |
| | | // 返回上一页 |
| | |
| | | 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}/${relativePath}`; |
| | | } |
| | | return `${config.baseUrl}/${url}`; |
| | | // const uploadsIndex = url.indexOf("uploads"); |
| | | // if (uploadsIndex !== -1) { |
| | | // const relativePath = url.substring(uploadsIndex); |
| | | // return `${config.fileUrl}/${relativePath}`; |
| | | // } |
| | | return `${config.fileUrl}/${url}`; |
| | | }; |
| | | |
| | | // 上传成功处理 |
| | |
| | | class="attachment-item" |
| | | @click="previewAttachment(file)"> |
| | | <view class="attachment-preview-container"> |
| | | {{formatFileUrl(file.url || file.downloadUrl)}} |
| | | <!-- {{formatFileUrl(file.url || file.downloadUrl)}} --> |
| | | <image v-if="file.type === 'image' || isImageFile(file)" |
| | | :src="formatFileUrl(file.url || file.downloadUrl)" |
| | | class="attachment-preview" |
| | |
| | | }; |
| | | |
| | | // 文件访问基础域(后端要求前缀) |
| | | const filePreviewBase = config.baseUrl; |
| | | const filePreviewBase = config.fileUrl; |
| | | |
| | | // 将后端返回的文件地址规范成可访问URL |
| | | // 兼容场景: |
| | |
| | | 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}/${relativePath}`; |
| | | } |
| | | return `${config.baseUrl}/${url}`; |
| | | // const uploadsIndex = url.indexOf("uploads"); |
| | | // if (uploadsIndex !== -1) { |
| | | // const relativePath = url.substring(uploadsIndex); |
| | | // return `${config.fileUrl}/${relativePath}`; |
| | | // } |
| | | return `${config.fileUrl}/${url}`; |
| | | }; |
| | | // 格式化文件大小 |
| | | const formatFileSize = size => { |
| | |
| | | <u-button type="warning" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="item.isRectify" |
| | | :disabled="item.isRectify || item.rectifyActualTime" |
| | | @click="rectifyVisit(item)"> |
| | | 整改 |
| | | </u-button> |
| | | <u-button type="success" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="!item.rectifyActualTime" |
| | | :disabled="!item.rectifyActualTime || item.verifyTime" |
| | | @click="acceptanceVisit(item)"> |
| | | 验收 |
| | | </u-button> |
| | |
| | | <u-button type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="item.rectifyActualTime || item.verifyTime" |
| | | @click="editVisit(item)"> |
| | | 编辑 |
| | | </u-button> |
| | |
| | | <u-button type="error" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="item.rectifyActualTime || item.verifyTime" |
| | | @click="deleteVisit(item)"> |
| | | 删除 |
| | | </u-button> |