From 6cc35000a6e138cfad96e7b02f8aeddcdb4ba6bf Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 24 六月 2025 09:57:25 +0800
Subject: [PATCH] 代码提交

---
 代码管理/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js"
index 9b5c711..5f5376b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js"
@@ -1,9 +1,10 @@
-let baseUrl = 'http://192.168.0.191:9291'
+let baseUrl = ''
+const value = uni.getStorageSync('storage_key_ipAddress');
 const install = (Vue, vm) => {
-
+	let resolvedBaseUrl = baseUrl === '' ? (value && value.WCSIP ? value.WCSIP : "") : baseUrl;
 	// 姝や负鑷畾涔夐厤缃弬鏁帮紝鍏蜂綋鍙傛暟瑙佷笂鏂硅鏄�
 	Vue.prototype.$u.http.setConfig({
-		baseUrl: baseUrl,
+		baseUrl: resolvedBaseUrl,
 		loadingText: '鍔姏鍔犺浇涓瓇',
 		loadingTime: 5000,
 		originalData: true,
@@ -13,21 +14,35 @@
 	// 璇锋眰鎷︽埅锛岄厤缃甌oken绛夊弬鏁�
 	Vue.prototype.$u.http.interceptor.request = (config) => {
 		// 鍒ゆ柇鏄惁涓哄畬鏁� URL锛屽鏋滄槸鍒欎笉浣跨敤 baseUrl
-		if (config.url.includes('http://') || config.url.includes('https://')) {
-			config.baseURL = '';
+		if (resolvedBaseUrl === '') {
+			if (config.url.includes('http://') || config.url.includes('https://')) {
+				config.baseURL = '';
+				resolve(config);
+			} else {
+				const storedValue = uni.getStorageSync('storage_key_ipAddress');
+				if (storedValue && storedValue.WCSIP) {
+					config.baseURL = storedValue.WCSIP;
+					baseUrl = storedValue.WCSIP;
+				} else {
+					vm.$u.toast('璇峰厛娣诲姞鍚庡彴IP鍦板潃');
+					return false; // 鍙栨秷鏈璇锋眰
+				}
+				// uni.getStorage({
+				// 	key: 'storage_key_ipAddress',
+				// 	success: (res) => {
+				// 		debugger;
+				// 		console.log(res.data.WCSIP);
+				// 		config.baseURL = res.data.WCSIP;
+				// 		baseUrl = res.data.WCSIP
+				// 	},
+				// 	fail: (err) => {
+				// 		debugger;
+				// 		vm.$u.toast('璇峰厛娣诲姞鍚庡彴IP鍦板潃');
+				// 	},
+				// });
+			}
 		} else {
-			uni.getStorage({
-				key: 'storage_key_ipAddress',
-				success: (res) => {
-					debugger;
-					console.log(res.data.WCSIP);
-					config.baseURL = res.data.WCSIP;
-				},
-				fail: (err) => {
-					console.log("娌℃湁鎵惧埌瀛樺偍鐨処P鍦板潃,浣跨敤榛樿BaseURL")
-					config.baseURL = baseUrl;
-				},
-			});
+            config.baseURL = resolvedBaseUrl;
 		}
 
 		config.header.Token = 'xxxxxx';

--
Gitblit v1.9.3