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/uview-ui/libs/request/index.js |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/uview-ui/libs/request/index.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/uview-ui/libs/request/index.js"
index 1f5f471..c07f38a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/uview-ui/libs/request/index.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/uview-ui/libs/request/index.js"
@@ -15,7 +15,7 @@
 			let interceptorRequest = this.interceptor.request(options);
 			if (interceptorRequest === false) {
 				// 杩斿洖涓�涓浜巔ending鐘舵�佷腑鐨凱romise锛屾潵鍙栨秷鍘焢romise锛岄伩鍏嶈繘鍏hen()鍥炶皟
-				return new Promise(()=>{});
+				return new Promise(() => {});
 			}
 			this.options = interceptorRequest;
 		}
@@ -34,7 +34,7 @@
 				clearTimeout(this.config.timer);
 				this.config.timer = null;
 				// 鍒ゆ柇鐢ㄦ埛瀵规嫤鎴繑鍥炴暟鎹殑瑕佹眰锛屽鏋渙riginalData涓簍rue锛岃繑鍥炴墍鏈夌殑鏁版嵁(response)鍒版嫤鎴櫒锛屽惁鍒欏彧杩斿洖response.data
-				if(this.config.originalData) {
+				if (this.config.originalData) {
 					// 鍒ゆ柇鏄惁瀛樺湪鎷︽埅鍣�
 					if (this.interceptor.response && typeof this.interceptor.response === 'function') {
 						let resInterceptors = this.interceptor.response(response);
@@ -51,7 +51,8 @@
 					}
 				} else {
 					if (response.statusCode == 200) {
-						if (this.interceptor.response && typeof this.interceptor.response === 'function') {
+						if (this.interceptor.response && typeof this.interceptor.response ===
+							'function') {
 							let resInterceptors = this.interceptor.response(response.data);
 							if (resInterceptors !== false) {
 								resolve(resInterceptors);
@@ -74,14 +75,20 @@
 				}
 			}
 
-			// 鍒ゆ柇鐢ㄦ埛浼犻�掔殑URL鏄惁/寮�澶�,濡傛灉涓嶆槸,鍔犱笂/锛岃繖閲屼娇鐢ㄤ簡uView鐨則est.js楠岃瘉搴撶殑url()鏂规硶
-			options.url = validate.url(options.url) ? options.url : (this.config.baseUrl + (options.url.indexOf('/') == 0 ?
-				options.url : '/' + options.url));
-			
+			// 鍒ゆ柇鏄惁涓哄畬鏁� URL锛屽鏋滄槸鍒欎笉浣跨敤 baseUrl
+			if (options.url.includes('http://') || options.url.includes('https://')) {
+				options.url = options.url;
+			} else {
+				// 鍒ゆ柇鐢ㄦ埛浼犻�掔殑URL鏄惁/寮�澶�,濡傛灉涓嶆槸,鍔犱笂/锛岃繖閲屼娇鐢ㄤ簡uView鐨則est.js楠岃瘉搴撶殑url()鏂规硶
+				options.url = validate.url(options.url) ? options.url : (this.config.baseUrl + (options.url
+					.indexOf('/') == 0 ?
+					options.url : '/' + options.url));
+			}
+
 			// 鏄惁鏄剧ずloading
 			// 鍔犱竴涓槸鍚﹀凡鏈塼imer瀹氭椂鍣ㄧ殑鍒ゆ柇锛屽惁鍒欐湁涓や釜鍚屾椂璇锋眰鐨勬椂鍊欙紝鍚庤�呬細娓呴櫎鍓嶈�呯殑瀹氭椂鍣╥d
 			// 鑰屾病鏈夋竻闄ゅ墠鑰呯殑瀹氭椂鍣紝瀵艰嚧鍓嶈�呰秴鏃讹紝涓�鐩存樉绀簂oading
-			if(this.config.showLoading && !this.config.timer) {
+			if (this.config.showLoading && !this.config.timer) {
 				this.config.timer = setTimeout(() => {
 					uni.showLoading({
 						title: this.config.loadingText,
@@ -116,7 +123,7 @@
 			originalData: false, // 鏄惁鍦ㄦ嫤鎴櫒涓繑鍥炴湇鍔$鐨勫師濮嬫暟鎹紝瑙佹枃妗h鏄�
 			loadingMask: true, // 灞曠ずloading鐨勬椂鍊欙紝鏄惁缁欎竴涓�忔槑鐨勮挋灞傦紝闃叉瑙︽懜绌块��
 		}
-	
+
 		// 鎷︽埅鍣�
 		this.interceptor = {
 			// 璇锋眰鍓嶇殑鎷︽埅
@@ -144,7 +151,7 @@
 				data
 			})
 		}
-		
+
 		// put璇锋眰锛屼笉鏀寔鏀粯瀹濆皬绋嬪簭(HX2.6.15)
 		this.put = (url, data = {}, header = {}) => {
 			return this.request({
@@ -154,7 +161,7 @@
 				data
 			})
 		}
-		
+
 		// delete璇锋眰锛屼笉鏀寔鏀粯瀹濆拰澶存潯灏忕▼搴�(HX2.6.15)
 		this.delete = (url, data = {}, header = {}) => {
 			return this.request({
@@ -166,4 +173,4 @@
 		}
 	}
 }
-export default new Request
+export default new Request
\ No newline at end of file

--
Gitblit v1.9.3