From 751dfe21d19a22bb130a6a14857470868d7be53a Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期一, 08 九月 2025 18:04:51 +0800 Subject: [PATCH] 修复预览,提交审核获取不到用户的问题 --- .env.development | 1 + src/views/tradeManage/upload/index.vue | 2 +- src/views/approveManage/tradeApproval/approve.vue | 22 ++++++++++++++++++++-- .env.production | 1 + src/views/tradeManage/confirm/index.vue | 2 +- src/views/tradeManage/detail/index.vue | 3 ++- src/utils/axios.ts | 4 ++++ 7 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.env.development b/.env.development index a1778ae..2cb7231 100644 --- a/.env.development +++ b/.env.development @@ -8,6 +8,7 @@ # 鏈湴鐜鎺ュ彛鍦板潃 - 灏鹃儴鏃犻渶甯�'/' VITE_AXIOS_BASE_URL = 'http://36.133.126.111:7099' +VITE_FILE_PREVIEW_URL = 'http://36.133.126.111:7098' # VITE_AXIOS_BASE_URL = 'http://36.139.126.109:7088' # 寮�鍙戠幆澧冧笅璺ㄥ煙浠g悊锛岃杈撳叆瑕佽法鍩熺殑api鍦板潃 - 灏鹃儴鏃犻渶甯�'/' diff --git a/.env.production b/.env.production index 83e72cc..5eb962a 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_BASE_PATH = '/trade-api' # 寮�鍙戠幆澧冧笅璺ㄥ煙浠g悊锛岃杈撳叆瑕佽法鍩熺殑api鍦板潃 - 灏鹃儴鏃犻渶甯�'/' VITE_AXIOS_BASE_URL = 'http://36.133.126.111:7099' +VITE_FILE_PREVIEW_URL = 'http://36.133.126.111:7098' #VITE_BI_URL = 'https://zynlpt.ccccltd.cn' VITE_BI_URL = 'http://36.133.126.111:7099' #璺宠浆iframe鍦板潃 diff --git a/src/utils/axios.ts b/src/utils/axios.ts index c4cacaf..784aefe 100644 --- a/src/utils/axios.ts +++ b/src/utils/axios.ts @@ -98,6 +98,10 @@ if (config.url?.includes('common/filePreview')) { return response } + const isFile = response.headers['content-type'] === 'application/octet-stream' + if(isFile) { + return response + } if (response.data && response.data.code == 200) { return response.data } else { diff --git a/src/views/approveManage/tradeApproval/approve.vue b/src/views/approveManage/tradeApproval/approve.vue index d79abd3..461641e 100644 --- a/src/views/approveManage/tradeApproval/approve.vue +++ b/src/views/approveManage/tradeApproval/approve.vue @@ -272,6 +272,7 @@ import productApi from '@/api/productApi' import sysUserService from "@/api/sysUser"; import workFlowApi from "@/api/workFlowApi"; +import {queryUserDetail} from "@/api/userInfo"; const route = useRoute() const router = useRouter() @@ -340,7 +341,24 @@ const orderId = String(route.params.id || '') console.log(route.params.taskId) if (!orderId) return - + + // 鑾峰彇鐢ㄦ埛淇℃伅 + if (!userStore.getUserId) { + try { + const res: any = await queryUserDetail() + if (res?.code === 200 && res.data) { + userStore.updateUserDetail(res.data) + } else { + ElMessage.error(res?.msg || '鏃犳硶鑾峰彇鐢ㄦ埛淇℃伅锛岃鍏堢櫥褰�') + return + } + } catch (e) { + console.error('鑾峰彇鐢ㄦ埛璇︽儏澶辫触:', e) + ElMessage.error('鑾峰彇鐢ㄦ埛淇℃伅澶辫触锛岃绋嶅悗閲嶈瘯') + return + } + } + try { // 骞惰鑾峰彇璁㈠崟璇︽儏鍜屽崗璁被鍨嬫鏌� const [orderRes, agreementRes] = await Promise.all([ @@ -772,7 +790,7 @@ // 妫�鏌ュ搷搴旀牸寮� const responseData = previewResponse as any if (responseData && responseData.code === 200 && responseData.data) { - previewUrl = responseData.data + previewUrl = responseData.data.replaceAll('http://192.168.20.52:9000',import.meta.env.VITE_FILE_PREVIEW_URL) console.log('浣跨敤棰勮URL:', previewUrl) } else { console.log('棰勮URL鑾峰彇澶辫触锛屼娇鐢ㄤ笅杞芥柟寮�') diff --git a/src/views/tradeManage/confirm/index.vue b/src/views/tradeManage/confirm/index.vue index d893c4b..2a25398 100644 --- a/src/views/tradeManage/confirm/index.vue +++ b/src/views/tradeManage/confirm/index.vue @@ -449,7 +449,7 @@ const submit = async () => { try { const orderId = String(route.params.id || '') - const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined + const userId = userStore.getUserId ? userStore.getUserId : undefined console.log(userId) if (!orderId || !userId) { diff --git a/src/views/tradeManage/detail/index.vue b/src/views/tradeManage/detail/index.vue index 0189854..0f0b99d 100644 --- a/src/views/tradeManage/detail/index.vue +++ b/src/views/tradeManage/detail/index.vue @@ -693,7 +693,8 @@ // 妫�鏌ュ搷搴旀牸寮� const responseData = previewResponse as any if (responseData && responseData.code === 200 && responseData.data) { - previewUrl = responseData.data + previewUrl = responseData.data.replaceAll("http://192.168.20.52:9000", import.meta.env.VITE_FILE_PREVIEW_URL) + // previewUrl = responseData.data console.log('浣跨敤棰勮URL:', previewUrl) } else { console.log('棰勮URL鑾峰彇澶辫触锛屼娇鐢ㄤ笅杞芥柟寮�') diff --git a/src/views/tradeManage/upload/index.vue b/src/views/tradeManage/upload/index.vue index 3f34ba1..26b0a33 100644 --- a/src/views/tradeManage/upload/index.vue +++ b/src/views/tradeManage/upload/index.vue @@ -809,7 +809,7 @@ // 妫�鏌ュ搷搴旀牸寮� const responseData = previewResponse as any if (responseData && responseData.code === 200 && responseData.data) { - // previewUrl = responseData.data.replaceAll("192.168.20.52", import.meta.env.) + previewUrl = responseData.data.replaceAll("http://192.168.20.52:9000", import.meta.env.VITE_FILE_PREVIEW_URL) console.log('浣跨敤棰勮URL:', previewUrl) } else { console.log('棰勮URL鑾峰彇澶辫触锛屼娇鐢ㄤ笅杞芥柟寮�') -- Gitblit v1.8.0