From d5e466a233f8b402d67043c823045799c5bd0fbd Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Sat, 16 Jul 2022 09:57:10 +0800
Subject: [PATCH] 优化表单验证,修复动态变更验证规则不生效的问题

---
 common/Tools.js |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/common/Tools.js b/common/Tools.js
index 9ef30a2..2f36e53 100644
--- a/common/Tools.js
+++ b/common/Tools.js
@@ -12,12 +12,13 @@
      * 显示消息
      * @param msg
      * @param [duration=2000]
+     * @param [mask=false]
      */
-    static toast(msg, duration = 2000) {
+    static toast(msg, duration = 2000, mask = false) {
         Taro.showToast({
             title: msg,
             icon: 'none',
-            mask: true,
+            mask,
             duration,
         });
     }
@@ -69,6 +70,22 @@
     }
 
     /**
+     * 获取随机字符串
+     * @param {number} long
+     * @return {string}
+     */
+    static getRandomString(long) {
+        long = long || 32;
+        const template = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
+        const count = template.length;
+        let result = '';
+        for (let i = 0; i < long; i++) {
+            result += template.charAt(Math.floor(Math.random() * count));
+        }
+        return result;
+    }
+
+    /**
      * 检查网络状态
      */
     static checkOnlineState(callback) {

--
Gitblit v1.9.1