From c80bc467a41daa6cbae4e5515a300a8ca98cfeaa Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 21 七月 2026 15:44:01 +0800
Subject: [PATCH] 维护

---
 pagesSub/ethicalReview/ethicalInfo.vue |  153 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 99 insertions(+), 54 deletions(-)

diff --git a/pagesSub/ethicalReview/ethicalInfo.vue b/pagesSub/ethicalReview/ethicalInfo.vue
index 5502338..e61d12c 100644
--- a/pagesSub/ethicalReview/ethicalInfo.vue
+++ b/pagesSub/ethicalReview/ethicalInfo.vue
@@ -156,7 +156,7 @@
             }}</text>
             <view class="signature-actions" v-if="!isReadonly">
               <button class="re-sign-btn" @tap="removeSignature">
-                <u-icon name="photo" size="16" />
+                <up-icon name="photo" size="16" />
                 <text>閲嶆柊绛惧悕</text>
               </button>
             </view>
@@ -317,7 +317,39 @@
 const id = ref(null);
 const fcid = ref(null);
 const materials = ref([]);
-const baseUrlHt = userStore.baseUrlHt;
+
+// ==================== 鏂板锛氭牴鎹幆澧冭幏鍙� baseUrlHt ====================
+const getBaseUrlHt = () => {
+  // #ifdef H5
+  // H5 鐜锛氭牴鎹祻瑙堝櫒鍦板潃鍔ㄦ�佹嫾鎺�
+  try {
+    const href = window.location.href;
+    
+    // 瑙勫垯 1锛�192.168.120.27:8091 鈫� 120.27 + :9095
+    if (href.startsWith('http://192.168.120.27:8091')) {
+      return 'http://192.168.120.27:9095';
+    }
+    
+    // 瑙勫垯 2锛�192.168.76.25:8091 鈫� 76.25 + :9095
+    if (href.startsWith('http://192.168.76.25:8091')) {
+      return 'http://192.168.76.25:9095';
+    }
+    
+    // 瑙勫垯 3锛氬叾浣欏叏閮ㄨ蛋鐢熶骇
+    return 'https://opo.qduh.cn';
+  } catch {
+    return 'https://opo.qduh.cn';
+  }
+  // #endif
+
+  // #ifdef MP-WEIXIN
+  // 灏忕▼搴忕幆澧冿細浣跨敤 userStore 涓殑 baseUrlHt
+  return userStore.baseUrlHt;
+  // #endif
+};
+
+const baseUrlHt = getBaseUrlHt();
+
 const form = ref({
   expertconclusion: "", // 涓撳缁撹
   expertopinion: "", // 涓撳鎰忚
@@ -511,17 +543,9 @@
         }
       }
 
-      // 璁剧疆绛惧悕
+      // 璁剧疆绛惧悕 - 浣跨敤 getFullUrl 澶勭悊
       if (data.sigin) {
-        // 妫�鏌ョ鍚峌RL鏄惁鏄畬鏁磋矾寰�
-        if (data.sigin.startsWith("http")) {
-          signatureData.signatureUrl = data.sigin;
-        } else {
-          // 濡傛灉涓嶆槸瀹屾暣璺緞锛屽彲鑳介渶瑕佹嫾鎺ュ熀纭�URL
-          signatureData.signatureUrl = `/api${
-            data.sigin.startsWith("/") ? "" : "/"
-          }${data.sigin}`;
-        }
+        signatureData.signatureUrl = getFullUrl(data.sigin);
         signatureData.signatureTime = data.conclusiontime || "";
       }
 
@@ -562,38 +586,50 @@
     // 鐘舵�佸凡缁忔槸瓒呮椂
     return;
   }
-
-  // 濡傛灉鏈夋埅姝㈡椂闂达紝妫�鏌ユ槸鍚﹁秴杩囧綋鍓嶆椂闂�
-  // if (data.endtime) {
-  //   const endTime = new Date(data.endtime);
-  //   const now = new Date();
-  //   if (now > endTime) {
-  //     // 鏍囪涓鸿秴鏃剁姸鎬�
-  //     caseInfo.value.receiveStatus = "3";
-  //     updateButtonStatus("3");
-  //   }
-  // }
 };
 
-// URL鏇挎崲鍑芥暟
-const replaceUrlDomain = (url) => {
-  if (!url) return '';
+// ==================== 鏂板锛氳幏鍙栧畬鏁碪RL锛堝钩鍙板畨鍏ㄧ増锛� ====================
+const getFullUrl = (path) => {
+  if (!path) return '';
   
-  if (url.startsWith('http://') || url.startsWith('https://')) {
-    // 鎵惧埌绗笁涓枩鏉犲悗鐨勪綅缃紝鎻愬彇璺緞閮ㄥ垎
-    const thirdSlashIndex = url.indexOf('/', 8);
-    if (thirdSlashIndex !== -1) {
-      return `${baseUrlHt}${url.substring(thirdSlashIndex)}`;
+  // blob / file 鏈湴璺緞鐩存帴杩斿洖
+  if (path.startsWith('blob:') || path.startsWith('file://')) {
+    return path;
+  }
+  
+  // 宸茬粡鏄畬鏁� http/https
+  if (path.startsWith('http://') || path.startsWith('https://')) {
+    // #ifdef H5
+    // H5 鐜锛氫娇鐢� new URL 瑙f瀽
+    try {
+      const url = new URL(path);
+      return `${baseUrlHt}${url.pathname}${url.search}${url.hash}`;
+    } catch {
+      // 闄嶇骇锛氭墜鍔ㄦ埅璺緞
+      const idx = path.indexOf('/', 8);
+      return idx !== -1
+        ? `${baseUrlHt}${path.substring(idx)}`
+        : baseUrlHt;
     }
-    return baseUrlHt; // 濡傛灉娌℃湁璺緞閮ㄥ垎锛屽彧杩斿洖baseUrlHt
+    // #endif
+
+    // #ifdef MP-WEIXIN
+    // 灏忕▼搴忕幆澧冿細涓嶄娇鐢� new URL锛屾墜鍔ㄥ鐞�
+    const protoEnd = path.indexOf('://') + 3;
+    const pathStart = path.indexOf('/', protoEnd);
+    return pathStart !== -1
+      ? `${baseUrlHt}${path.substring(pathStart)}`
+      : baseUrlHt;
+    // #endif
   }
   
-  // 鐩稿璺緞澶勭悊
-  if (url.startsWith('/')) {
-    return `${baseUrlHt}${url}`;
-  }
-  
-  return `${baseUrlHt}/${url}`;
+  // 鐩稿璺緞
+  return `${baseUrlHt}${path.startsWith('/') ? '' : '/'}${path}`;
+};
+
+// ==================== 淇敼锛歳eplaceUrlDomain 浣跨敤 getFullUrl ====================
+const replaceUrlDomain = (url) => {
+  return getFullUrl(url);
 };
 
 // 瑙f瀽闄勪欢鏂囦欢
@@ -625,7 +661,8 @@
     // 杞崲涓洪渶瑕佺殑鏍煎紡
     materials.value = fileList.map((file, index) => {
       const fileName = file.fileName || `闄勪欢${index + 1}`;
-      const fileUrl = replaceUrlDomain(file.fileUrl || file.path || file.url || "");
+      // 浣跨敤 getFullUrl 澶勭悊URL
+      const fileUrl = getFullUrl(file.fileUrl || file.path || file.url || "");
       
       const ext = fileName.split(".").pop().toLowerCase();
       let icon = "file-text";
@@ -669,7 +706,8 @@
     const fileList = filePatch.split(";").filter((item) => item.trim());
     materials.value = fileList.map((file, index) => {
       const fileName = file.split("/").pop() || `闄勪欢${index + 1}`;
-      const fileUrl = replaceUrlDomain(file);
+      // 浣跨敤 getFullUrl 澶勭悊URL
+      const fileUrl = getFullUrl(file);
       
       const ext = fileName.split(".").pop().toLowerCase();
       let icon = "file-text";
@@ -870,8 +908,8 @@
     const uploadResult = await uploadSignature(tempSignatureData.value);
 
     if (uploadResult) {
-      // 鏇存柊绛惧悕鏁版嵁
-      signatureData.signatureUrl = uploadResult.url;
+      // 浣跨敤 getFullUrl 澶勭悊绛惧悕URL
+      signatureData.signatureUrl = getFullUrl(uploadResult.url);
       signatureData.signatureTime = new Date().toLocaleString("zh-CN");
       signatureData.fileName =
         uploadResult.originalFilename || `signature_${Date.now()}.png`;
@@ -1000,25 +1038,29 @@
   });
 };
 
-// 棰勮绛惧悕
-// 棰勮绛惧悕
+// ==================== 淇敼锛氶瑙堢鍚� ====================
 const previewSignature = () => {
   if (signatureData.signatureUrl) {
-    // 妫�鏌RL鏄惁闇�瑕佹嫾鎺ュ熀纭�璺緞
-    let previewUrl = signatureData.signatureUrl;
-    if (!previewUrl.startsWith("http")) {
-      // 鍙兘闇�瑕佹嫾鎺ユ湇鍔″櫒鍩虹URL
-      previewUrl = `${userStore?.baseUrlHt || ""}${previewUrl}`;
-    }
+    // 浣跨敤 getFullUrl 澶勭悊URL
+    let previewUrl = getFullUrl(signatureData.signatureUrl);
 
     uni.previewImage({
       urls: [previewUrl],
+      success: () => {
+        console.log("绛惧悕棰勮鎴愬姛");
+      },
+      fail: (err) => {
+        console.error("绛惧悕棰勮澶辫触:", err);
+        uni.showToast({
+          title: "绛惧悕鍔犺浇澶辫触",
+          icon: "none",
+        });
+      },
     });
   }
 };
 
-// 棰勮鏉愭枡
-// 棰勮鏉愭枡
+// ==================== 淇敼锛氶瑙堟潗鏂� ====================
 const previewMaterial = (material) => {
   if (material.url) {
     uni.showLoading({ title: "鍔犺浇涓�..." });
@@ -1026,11 +1068,14 @@
     const fileExt =
       material.type || material.url.split(".").pop().toLowerCase();
 
+    // 浣跨敤 getFullUrl 澶勭悊URL
+    const fileUrl = getFullUrl(material.url);
+
     // 鍒ゆ柇鏂囦欢绫诲瀷
     if (["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(fileExt)) {
       // 鍥剧墖鐩存帴棰勮
       uni.previewImage({
-        urls: [material.url],
+        urls: [fileUrl],
         current: 0,
         success: () => {
           console.log("鍥剧墖棰勮鎴愬姛");
@@ -1053,7 +1098,7 @@
     ) {
       // 鏂囨。鏂囦欢涓嬭浇鍚庢墦寮�
       uni.downloadFile({
-        url: material.url,
+        url: fileUrl,
         success: (res) => {
           if (res.statusCode == 200) {
             const filePath = res.tempFilePath;

--
Gitblit v1.9.3