From 517fb253f39bf8120f9bed693d35349727ae650c Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 08 四月 2025 09:35:18 +0800
Subject: [PATCH] PDA添加完整URL判断

---
 代码管理/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js |   59 ++++++++---------------------------------------------------
 1 files changed, 8 insertions(+), 51 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 1c5f2b4..186e70a 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,7 +1,6 @@
-//let baseUrl ='http://192.168.1.54:8098' //'http://192.168.11.58:8098'
- // let baseUrl = 'http://192.168.12.240:8098'
 let baseUrl = 'http://127.0.0.1:9291'
 const install = (Vue, vm) => {
+
 	// 姝や负鑷畾涔夐厤缃弬鏁帮紝鍏蜂綋鍙傛暟瑙佷笂鏂硅鏄�
 	Vue.prototype.$u.http.setConfig({
 		baseUrl: baseUrl,
@@ -13,22 +12,13 @@
 
 	// 璇锋眰鎷︽埅锛岄厤缃甌oken绛夊弬鏁�
 	Vue.prototype.$u.http.interceptor.request = (config) => {
-		// 寮曠敤token
-		// 鏂瑰紡涓�锛屽瓨鏀惧湪vuex鐨則oken锛屽亣璁句娇鐢ㄤ簡uView灏佽鐨剉uex鏂瑰紡
-		// 瑙侊細https://uviewui.com/components/globalVariable.html 
-		// config.header.token = vm.token;
+		// 鍒ゆ柇鏄惁涓哄畬鏁� URL锛屽鏋滄槸鍒欎笉浣跨敤 baseUrl
+		if (config.url.includes('http://') || config.url.includes('https://')) {
+			config.baseURL = '';
+		} else {
+			config.baseURL = baseUrl;
+		}
 
-		// 鏂瑰紡浜岋紝濡傛灉娌℃湁浣跨敤uView灏佽鐨剉uex鏂规硶锛岄偅涔堥渶瑕佷娇鐢�$store.state鑾峰彇
-		// config.header.token = vm.$store.state.token;
-
-		// 鏂瑰紡涓夛紝濡傛灉token鏀惧湪浜唃lobalData锛岄�氳繃getApp().globalData鑾峰彇
-		// config.header.token = getApp().globalData.username;
-
-		// 鏂瑰紡鍥涳紝濡傛灉token鏀惧湪浜哠torage鏈湴瀛樺偍涓紝鎷︽埅鏄瘡娆¤姹傞兘鎵ц鐨�
-		// 鎵�浠ュ摢鎬曟偍閲嶆柊鐧诲綍淇敼浜哠torage锛屼笅涓�娆$殑璇锋眰灏嗕細鏄渶鏂板��
-		// const token = uni.getStorageSync('token');
-		// config.header.token = token;
-		console.log(2)
 		config.header.Token = 'xxxxxx';
 		config.header.Authorization = "Bearer " + uni.getStorageSync('jo_id_token');
 		// 鍙互瀵规煇涓猽rl杩涜鐗瑰埆澶勭悊锛屾url鍙傛暟涓簍his.$u.get(url)涓殑url鍊� 
@@ -41,9 +31,7 @@
 
 	// 鍝嶅簲鎷︽埅锛屽垽鏂姸鎬佺爜鏄惁閫氳繃
 	Vue.prototype.$u.http.interceptor.response = (res) => {
-		console.log(1)
 		if (res.statusCode == 200) {
-			console.log(0)
 			// res涓烘湇鍔$杩斿洖鍊硷紝鍙兘鏈塩ode锛宺esult绛夊瓧娈�
 			// 杩欓噷瀵箁es.result杩涜杩斿洖锛屽皢浼氬湪this.$u.post(url).then(res => {})鐨則hen鍥炶皟涓殑res鐨勫埌
 			// 濡傛灉閰嶇疆浜唎riginalData涓簍rue锛岃鐣欐剰杩欓噷鐨勮繑鍥炲��
@@ -79,38 +67,7 @@
 					url: '/pages/login/login'
 				});
 			})
-			// uni.request({
-			// 	url: "http://192.168.12.245:8099/api/User/replaceToken",
-			// 	param: {},
-			// 	method: 'POST',
-			// 	responseType: "text",
-			// 	header: {
-			// 		Authorization: "Bearer " + vm.vuex_token
-			// 	},
-			// 	async: false,
-			// 	success: function(x) {
-			// 		if (x.data.status) {
-			// 			vm.$u.vuex('vuex_token',x.data.data)
-			// 			vm.$u.route({
-			// 				type: "navigateBack",
-			// 				delta: -1
-			// 			})
-			// 		} else {
-			// 			console.log(x.data.message);
-			// 			vm.$u.toast('楠岃瘉杩囨湡锛岃閲嶆柊鐧诲綍');
-			// 			setTimeout(() => {
-			// 				// 姝や负uView鐨勬柟娉曪紝璇﹁璺敱鐩稿叧鏂囨。
-			// 				vm.$u.route('/pages/user/login')
-			// 			}, 1500)
-			// 		}
-			// 	},
-			// 	errror: function(ex) {
-			// 		console.log(ex);
-			// 		uni.reLaunch({
-			// 			url: '/pages/user/login'
-			// 		});
-			// 	},
-			// });
+			// return false; // return false鍚庝笉鍐嶈繘鍏hen鍥炶皟锛屼絾浼氳繘鍏atch鍥炶皟
 			return false;
 		}
 	}

--
Gitblit v1.9.3