From 2140c5aae2032673cef7055df9738b9bacf37816 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 23 九月 2026 16:46:20 +0800
Subject: [PATCH] 青岛维护

---
 pagesSub/ethicalReview/index.vue |  132 +++++++++++++++++++++++++++-----------------
 1 files changed, 81 insertions(+), 51 deletions(-)

diff --git a/pagesSub/ethicalReview/index.vue b/pagesSub/ethicalReview/index.vue
index 1cd088b..0a537df 100644
--- a/pagesSub/ethicalReview/index.vue
+++ b/pagesSub/ethicalReview/index.vue
@@ -14,12 +14,12 @@
       <view class="divider"></view>
       <view class="stat-item">
         <text class="count">{{ stats.rejectCount }}</text>
-        <text class="label">瀹℃煡椹冲洖</text>
+        <text class="label">涓嶅悓鎰�</text>
       </view>
       <view class="divider"></view>
       <view class="stat-item">
         <text class="count">{{ stats.waiveCount }}</text>
-        <text class="label">宸叉斁寮�</text>
+        <text class="label">寮冩潈</text>
       </view>
     </view>
 
@@ -132,7 +132,7 @@
         <!-- 瀹℃煡缁撹 -->
         <view
           class="conclusion-section"
-          v-if="review.expertconclusion && review.expertconclusion !== 2"
+          v-if="review.expertconclusion !== '' && review.expertconclusion != null && review.expertconclusion != 2"
         >
           <text class="conclusion-label">瀹℃煡缁撹锛�</text>
           <text class="conclusion-content">{{
@@ -163,7 +163,7 @@
           </button>
 
           <button
-            v-if="review.expertconclusion == 2"
+            v-if="review.expertconclusion == 0"
             class="action-btn appeal-btn"
             @tap.stop="submitAppeal(review)"
           >
@@ -172,7 +172,7 @@
           </button>
 
           <button
-            v-if="review.expertconclusion == 2 || review.expertconclusion == 3"
+            v-if="review.expertconclusion == 0 || review.expertconclusion == 3"
             class="action-btn restart-btn"
             @tap.stop="restartReview(review)"
           >
@@ -212,6 +212,7 @@
   onReachBottom,
 } from "@dcloudio/uni-app";
 import { useDict } from "@/utils/dict";
+import { useUserStore } from "@/stores/user";
 
 // 鍝嶅簲寮忔暟鎹�
 const loading = ref(false);
@@ -220,6 +221,7 @@
 const pageNum = ref(1);
 const pageSize = ref(10);
 const dict = ref({});
+const userStore = useUserStore();
 
 // 绛涢�夋潯浠�
 const currentStatus = ref("all");
@@ -242,24 +244,24 @@
   { label: "鍏ㄩ儴", value: "all" },
   { label: "寰呭鏌�", value: "pending" },
   { label: "瀹℃煡閫氳繃", value: "approved" },
-  { label: "瀹℃煡椹冲洖", value: "rejected" },
-  { label: "宸叉斁寮�", value: "abandoned" },
+  { label: "涓嶅悓鎰�", value: "rejected" },
+  { label: "寮冩潈", value: "abandoned" },
 ]);
 
 // 瀛楀吀鏄犲皠
 const statusDict = {
   pending: "寰呭鏌�",
   approved: "瀹℃煡閫氳繃",
-  rejected: "瀹℃煡椹冲洖",
-  abandoned: "宸叉斁寮�",
+  rejected: "涓嶅悓鎰�",
+  abandoned: "寮冩潈",
 };
 
 // 缁撹鏄犲皠
 const conclusionDict = {
-  0: "鏈鏍�",
-  1: "瀹℃煡閫氳繃",
-  2: "瀹℃煡椹冲洖",
-  3: "鏀惧純",
+  0: "涓嶅悓鎰�",
+  1: "鍚屾剰",
+  2: "瀹℃煡涓�",
+  3: "寮冩潈",
   4: "淇敼鍚庡悓鎰�",
 };
 
@@ -360,10 +362,10 @@
         params.expertconclusion = 1; // 鍚屾剰
         break;
       case "rejected":
-        params.expertconclusion = 2; // 涓嶅悓鎰�
+        params.expertconclusion = 0; // 涓嶅悓鎰�
         break;
       case "abandoned":
-        params.expertconclusion = 3; // 鏀惧純
+        params.expertconclusion = 3; // 寮冩潈
         break;
     }
   }
@@ -459,45 +461,75 @@
   });
 };
 
-// 涓嬭浇鎶ュ憡
-const downloadReport = async (review) => {
-  if (!review.conclusionannex) {
-    uni.showToast({
-      title: "鏆傛棤鎶ュ憡鍙笅杞�",
-      icon: "none",
-    });
-    return;
-  }
-
+// 鑾峰彇鏂囦欢涓嬭浇鐨勫熀纭�鍦板潃锛�
+// H5 绔蛋鍚屾簮鍦板潃锛堢敱閮ㄧ讲璇ラ〉闈㈢殑 nginx 鍙嶅悜浠g悊 /profile/ 鍒板悗绔紝瑙勯伩璺ㄥ煙锛夛紱
+// 灏忕▼搴� / App 绔娇鐢� userStore 涓殑鏂囦欢鏈嶅姟鍣ㄥ湴鍧�
+const getDownloadBaseUrl = () => {
+  // #ifdef H5
   try {
-    const annexes = review.conclusionannex
-      .split(";")
-      .filter((item) => item.trim());
+    return window.location.origin;
+  } catch {
+    return userStore.baseUrlHt;
+  }
+  // #endif
+  // #ifndef H5
+  return userStore.baseUrlHt;
+  // #endif
+};
 
-    if (annexes.length == 0) {
+// 涓嬭浇鎶ュ憡锛氳皟鐢ㄥ悗绔。妗堜笅杞芥帴鍙h幏鍙栦笅杞藉湴鍧�锛屽啀涓嬭浇鏂囦欢
+const downloadReport = async (review) => {
+  try {
+    // 鍏堣皟鐢ㄥ悗绔帴鍙h幏鍙栨。妗堜笅杞藉湴鍧�锛堜笌 web 绔竴鑷达細鍙傛暟 nitiateId 瀵瑰簲浼︾悊瀹℃煡鍙戣捣 id锛�
+    const res = await uni.$uapi.get(
+      "/project/ethicalreviewopinions/download",
+      { nitiateId: review.nitiateId || review.fcid || review.id },
+    );
+
+    if (res.code != 200 || !res.data || !res.data.downloadUrl) {
       uni.showToast({
-        title: "鏆傛棤鎶ュ憡鍙笅杞�",
+        title: res.msg || "鏆傛棤鎶ュ憡鍙笅杞�",
         icon: "none",
       });
       return;
     }
 
+    const downloadUrl = res.data.downloadUrl;
+    const downloadName =
+      res.data.downloadName || downloadUrl.split("/").pop() || "浼︾悊瀹℃煡鎶ュ憡.doc";
+
+    // 鎷兼帴瀹屾暣涓嬭浇鍦板潃锛歜ase + /profile + downloadUrl锛堝悗绔� downloadUrl 缂哄皯 /profile 鍓嶇紑锛�
+    const fullUrl = getDownloadBaseUrl() + "/profile" + downloadUrl;
+
+    // #ifdef H5
+    // H5 绔細鐩存帴瑙﹀彂娴忚鍣ㄤ笅杞�
+    const link = document.createElement("a");
+    link.href = fullUrl;
+    link.download = downloadName;
+    link.target = "_blank";
+    document.body.appendChild(link);
+    link.click();
+    document.body.removeChild(link);
+    return;
+    // #endif
+
+    // #ifndef H5
+    // 灏忕▼搴� / App 绔細涓嬭浇鍚庝繚瀛樺苟鎵撳紑
     uni.showLoading({
       title: "涓嬭浇涓�...",
       mask: true,
     });
 
-    // 涓嬭浇绗竴涓檮浠�
-    const fileUrl = annexes[0];
+    const token = uni.getStorageSync("token") || "";
     const downloadTask = uni.downloadFile({
-      url: fileUrl,
+      url: fullUrl,
+      header: {
+        Authorization: token ? `Bearer ${token}` : "",
+      },
       success: (downloadRes) => {
         if (downloadRes.statusCode == 200) {
-          const tempFilePath = downloadRes.tempFilePath;
-
-          // 淇濆瓨鍒版湰鍦�
           uni.saveFile({
-            tempFilePath: tempFilePath,
+            tempFilePath: downloadRes.tempFilePath,
             success: (saveRes) => {
               uni.hideLoading();
               uni.showToast({
@@ -506,21 +538,18 @@
                 duration: 2000,
               });
 
-              // 鍦ㄥ井淇″皬绋嬪簭涓彲浠ユ墦寮�鏂囦欢
-              if (uni.getSystemInfoSync().platform == "weixin") {
-                uni.openDocument({
-                  filePath: saveRes.savedFilePath,
-                  showMenu: true,
-                  success: () => {
-                    console.log("鎵撳紑鏂囨。鎴愬姛");
-                  },
-                  fail: (err) => {
-                    console.error("鎵撳紑鏂囨。澶辫触", err);
-                  },
-                });
-              }
+              uni.openDocument({
+                filePath: saveRes.savedFilePath,
+                showMenu: true,
+                success: () => {
+                  console.log("鎵撳紑鏂囨。鎴愬姛");
+                },
+                fail: (err) => {
+                  console.error("鎵撳紑鏂囨。澶辫触", err);
+                },
+              });
             },
-            fail: (saveErr) => {
+            fail: () => {
               uni.hideLoading();
               uni.showToast({
                 title: "淇濆瓨鏂囦欢澶辫触",
@@ -553,6 +582,7 @@
     downloadTask.onProgressUpdate((res) => {
       console.log("涓嬭浇杩涘害:", res.progress);
     });
+    // #endif
   } catch (error) {
     uni.hideLoading();
     console.error("涓嬭浇鎶ュ憡澶辫触:", error);

--
Gitblit v1.9.3