From abd2e1dd7dfdf1ad50cce74c4e72edfd94fecf85 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 15 十二月 2025 12:56:48 +0800
Subject: [PATCH] 1

---
 utils/common.js |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/utils/common.js b/utils/common.js
index b70b133..5898bb7 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -311,11 +311,10 @@
         data,
         method,
     }) {
-        if(this.requestLock){
-            console.warn("璇ヨ姹傝閿佸畾锛屽凡閫�鍑鸿姹�!")
+        if (this.requestLock) {
+            console.log("璇ヨ姹傝閿佸畾,涓嶈兘閲嶅璇锋眰!!!")
             return
         }
-        
         this.requestLock = true
         return new Promise((resolve, reject) => {
             // that = that || this;
@@ -341,6 +340,35 @@
             })
         })
     }
+
+    async doRequest2Async({
+        url,
+        data,
+        method,
+    }) {
+        return new Promise((resolve, reject) => {
+            // that = that || this;
+            let errorTip = null;
+            uni.showLoading({
+                title: '鍔犺浇涓�...'
+            })
+            uni.request({
+                method: method || "GET",
+                url: this.serverUrl + url,
+                data: data || "",
+                success: (res) => {
+                    resolve(res)
+                },
+                fail: (err) => {
+                    reject(err)
+                },
+                complete: () => {
+                    uni.hideLoading()
+                }
+            })
+        })
+    }
+
     stringToBoolean(str) {
         // 蹇界暐澶у皬鍐欑殑杞崲
         return str?.toLowerCase() === "true";
@@ -357,14 +385,14 @@
         innerAudioContext.play(); // 鎾斁闊抽
 
         innerAudioContext.onPlay(() => {
-            console.log('寮�濮嬫挱鏀�');
+            //console.log('寮�濮嬫挱鏀�');
         });
         innerAudioContext.onError((res) => {
             console.log(res.errMsg);
             console.log(res.errCode);
         });
         innerAudioContext.onPause(function() {
-            console.log('鎾斁鍑虹幇閿欒锛岄攢姣�');
+            //console.log('鎾斁鏆傚仠锛岄攢姣�');
             innerAudioContext.destroy();
         })
     }
@@ -400,6 +428,29 @@
     // }
 
 
+    showTips({
+        type,
+        message,
+        title,
+        duration
+    }) {
+        if (!message) {
+            return
+        }
+
+        if (message.length < 20) {
+            return uni.showToast({
+                icon: type || 'none',
+                title: message
+            })
+        }
+
+        return uni.showModal({
+            title: title,
+            content: message,
+            showCancel: false
+        })
+    }
 
     replaceWithFunction(str, handler) {
         return str.replace(/\{(.+?)\}/g, (match, key) => {

--
Gitblit v1.9.1