From 205b92161eaeb386e0765280d01b621627ba02ed Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期三, 07 一月 2026 08:13:45 +0800
Subject: [PATCH] #
---
common/request2.js | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/common/request2.js b/common/request2.js
new file mode 100644
index 0000000..f374f63
--- /dev/null
+++ b/common/request2.js
@@ -0,0 +1,41 @@
+/**
+ * @param {string} url url鍦板潃
+ * @param {any} postData 鍙傛暟
+ * @param {string} method 璇锋眰鏂瑰紡
+ * @param {boolean} hideLoading 鏄惁load
+ * @description: 鏍煎紡鍖栨椂闂�
+ */
+export function request(url, postData, method = 'POST', hideLoading = 'false') {
+ if (!hideLoading) {
+ uni.showLoading({
+ title: '璇风◢鍊�...',
+ mask: true
+ })
+ }
+ return new Promise((resolve, reject) => {
+ const token = uni.getStorageSync('token');
+ // const URL = 'http://47.76.147.249:8080/rsf-server/pda' + url;
+ // const URL = 'http://test.zoneyung.net:8080/rsf-server/pda' + url;
+ const URL = 'http://127.0.0.1:8085/rsf-server' + url;
+ uni.request({
+ url: URL,
+ data: postData,
+ header: {
+ 'content-type': 'application/json',
+ 'authorization': token
+ },
+ method: method, //'GET','POST'
+ dataType: 'json',
+ success: (res) => {
+ !hideLoading && uni.hideLoading()
+ resolve(res.data)
+
+ },
+ fail: (res) => {
+ // !hideLoading && toast("缃戠粶涓嶇粰鍔涳紝璇风◢鍚庡啀璇晘")
+ //wx.hideLoading()
+ reject(res)
+ }
+ })
+ })
+}
\ No newline at end of file
--
Gitblit v1.9.1