zhangwencui
8 天以前 b34c02590a3253955c3f44a1cbbbf8ba2a786893
src/pages/inspectionUpload/index.vue
@@ -153,7 +153,7 @@
                          style="margin-right: 5px;"></u-icon>
                  {{ uploading ? '上传中...' : '拍照' }}
                </u-button>
                <u-button type="success"
                <!-- <u-button type="success"
                          @click="chooseMedia('video')"
                          :loading="uploading"
                          :disabled="getCurrentFiles().length >= uploadConfig.limit"
@@ -164,7 +164,7 @@
                             color="#fff"
                             style="margin-right: 5px;"></uni-icons>
                  {{ uploading ? '上传中...' : '拍视频' }}
                </u-button>
                </u-button> -->
              </view>
              <!-- 上传进度 -->
              <view v-if="uploading"
@@ -210,7 +210,7 @@
              </view>
              <view v-if="getCurrentFiles().length === 0"
                    class="empty-state">
                <text>请选择要上传的{{ getUploadTypeText() }}图片或视频</text>
                <text>请选择要上传的{{ getUploadTypeText() }}图片</text>
              </view>
              <!-- 统计信息 -->
              <!-- <view class="upload-summary">
@@ -281,8 +281,9 @@
                      class="attachment-item"
                      @click="previewAttachment(file)">
                  <view class="attachment-preview-container">
                    {{formatFileUrl(file.url || file.downloadUrl)}}
                    <image v-if="file.type === 'image' || isImageFile(file)"
                           :src="file.url || file.downloadUrl"
                           :src="formatFileUrl(file.url || file.downloadUrl)"
                           class="attachment-preview"
                           mode="aspectFill" />
                    <view v-else
@@ -1589,7 +1590,19 @@
  const uploadedSuccessfully = () => {
    // 此函数已不再使用,文件上传成功后立即添加到对应分类
  };
  // 格式化文件URL
  const formatFileUrl = url => {
    if (!url) return "";
    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 formatFileSize = size => {
    if (!size) return "";