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