zrg
2025-09-05 46cc7a29dc1f9b3dffee5cdcb9b7f9dfdac3b16d
utils/common.js
@@ -277,7 +277,7 @@
              }
      
          },
          complete() {
          complete: () => {
              setTimeout(() => {
                  uni.hideLoading()
                  if (errorTip != null) {
@@ -286,6 +286,11 @@
              }, 1000)
          }
      })
   }
   stringToBoolean(str) {
     // 忽略大小写的转换
     return str?.toLowerCase() === "true";
   }
    // uni-app 播放音频封装
@@ -298,6 +303,13 @@
        }
        innerAudioContext.play(); // 播放音频
    }
    replaceWithFunction(str, handler) {
      return str.replace(/\{(.+?)\}/g, (match, key) => {
        // 调用处理函数,传入匹配到的键
        return handler(key, match);
      });
    }
}
export const CommonUtils = new commonUtils()