From ba04983aaf5cbb0d57c4ec3530ee1663f0f83115 Mon Sep 17 00:00:00 2001
From: qq_41295110 <qq_41295110@noreply.gitcode.com>
Date: 星期二, 15 七月 2025 17:16:02 +0800
Subject: [PATCH] 生产领料更新
---
utils/common.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 48 insertions(+), 7 deletions(-)
diff --git a/utils/common.js b/utils/common.js
index 011f958..8846e12 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -87,7 +87,45 @@
isAllDigits(str) {
return /^\d+$/.test(str);
}
-
+
+ isJson(str) {
+ try{
+ JSON.parse(str)
+ return true
+ }catch{
+ return false
+ }
+ }
+
+ timeClock(callback, delay) {
+ let timeoutId;
+ let isRunning = false;
+
+ function interval() {
+ timeoutId = setTimeout(() => {
+ callback();
+ clearTimeout(timeoutId); // 绔嬪嵆娓呴櫎褰撳墠瀹氭椂鍣↖D
+ if (isRunning) {
+ interval();
+ }
+ }, delay);
+ }
+
+ return {
+ start() {
+ if (!isRunning) {
+ isRunning = true;
+ interval();
+ }
+ },
+ stop() {
+ if (isRunning) {
+ isRunning = false;
+ clearTimeout(timeoutId);
+ }
+ }
+ };
+ }
// uni-app 浣跨敤 灏佽璇锋眰鍑芥暟 浣跨敤浼犵粺鍑芥暟褰撲綔鍥炶皟闇�瑕佷紶that锛岀澶村嚱鏁颁笉闇�瑕�
doRequest(url, data, resFunction, errFunction, method, that) {
that = that || this;
@@ -124,14 +162,17 @@
} else {
throw new TypeError("璁块棶澶辫触鍥炶皟鍑芥暟绫诲瀷涓嶄负鍑芥暟鎴栬�呯┖!")
}
+
+ },complete() {
+ setTimeout(() => {
+ uni.hideLoading()
+ if (errorTip != null) {
+ errorTip()
+ }
+ }, 1000)
}
})
- setTimeout(() => {
- uni.hideLoading()
- if (errorTip != null) {
- errorTip()
- }
- }, 1000)
+
}
}
--
Gitblit v1.9.1