gaoluyang
2 天以前 8e385abb4b37788100feb6dce50f1ccf60b6a90b
src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue
@@ -114,6 +114,7 @@
<script setup>
import { ref } from 'vue';
import VueEasyLightbox from 'vue-easy-lightbox';
const { proxy } = getCurrentInstance();
// 控制弹窗显示
const dialogVisitable = ref(false);
@@ -133,12 +134,11 @@
const currentMediaIndex = ref(0);
const mediaList = ref([]); // 存储当前要查看的媒体列表(含图片和视频对象)
const mediaType = ref('image'); // image | video
const javaApi = proxy.javaApi;
// 处理 URL:将 Windows 路径转换为可访问的 URL
function processFileUrl(fileUrl) {
  if (!fileUrl) return '';
  const baseUrl = import.meta.env.VITE_APP_BASE_API;
  
  // 如果 URL 是 Windows 路径格式(包含反斜杠),需要转换
  if (fileUrl && fileUrl.indexOf('\\') > -1) {
@@ -163,7 +163,7 @@
      fileUrl = '/' + fileUrl;
    }
    // 拼接 baseUrl
    fileUrl = baseUrl + fileUrl;
    fileUrl = javaApi + fileUrl;
  }
  
  return fileUrl;