From 112bb1d3ca7e5c813adc9514f6b56b5e4886f49b Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 12 八月 2025 10:26:29 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

---
 utils/common.js |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/utils/common.js b/utils/common.js
index 2ba726f..09e4494 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -239,6 +239,59 @@
             }
         })
     }
+	
+	doRequest2({url, data, resFunction, errFunction, method, that}){
+		that = that || this;
+		let errorTip = null;
+		uni.showLoading({
+		    title: '鍔犺浇涓�...'
+		})
+		uni.request({
+		    method: method || "GET",
+		    url: this.serverUrl + url,
+		    data: data || "",
+		    success: (res) => {
+		        if (typeof resFunction === 'function') {
+		            resFunction.call(that, res)
+		        } else if (typeof errFunction === 'undefined' || errFunction === null) {
+		            return
+		        } else {
+		            throw new TypeError("璁块棶鎴愬姛鍥炶皟鍑芥暟绫诲瀷涓嶄负鍑芥暟鎴栬�呯┖!")
+		        }
+		    },
+		    fail: (err) => {
+		        console.error(err)
+		        errorTip = () => {
+		            uni.showToast({
+		                icon: "none",
+		                title: err.errMsg || err.data.message || "鎺ュ彛寮傚父!",
+		                duration: 2000
+		            })
+		        }
+		        if (typeof errFunction === 'function') {
+		            errFunction.call(that, err)
+		        } else if (typeof errFunction === 'undefined' || errFunction === null) {
+		            return
+		        } else {
+		            throw new TypeError("璁块棶澶辫触鍥炶皟鍑芥暟绫诲瀷涓嶄负鍑芥暟鎴栬�呯┖!")
+		        }
+		
+		    },
+		    complete() {
+		        setTimeout(() => {
+		            uni.hideLoading()
+		            if (errorTip != null) {
+		                errorTip()
+		            }
+		        }, 1000)
+		    }
+		})
+	}
+	
+	stringToBoolean(str) {
+	  // 蹇界暐澶у皬鍐欑殑杞崲
+	  return str?.toLowerCase() === "true";
+	}
 
     // uni-app 鎾斁闊抽灏佽
     playSound(e) {

--
Gitblit v1.9.1