From a89fe32c353040bbb95d7519cf7bafc4b5934f10 Mon Sep 17 00:00:00 2001
From: Mr.Zhang <710666463@qq.com>
Date: 星期三, 06 九月 2023 09:54:14 +0800
Subject: [PATCH] 小程序
---
minipro_standard/util/utils.js | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/minipro_standard/util/utils.js b/minipro_standard/util/utils.js
index 76809d9..f30d0dc 100644
--- a/minipro_standard/util/utils.js
+++ b/minipro_standard/util/utils.js
@@ -27,4 +27,36 @@
return [year, Sign, month , Sign, day, ' ', hour , ':', minute, ':', second ].join('');
}
-export { gsdate, setTime }
+/***
+ *
+ * @param time 鏃ユ湡 骞存湀鏃ユ椂鍒嗙
+ * @param Sign 闂撮殧
+ */
+function setTimeO (time, Sign) {
+ let year = time.getFullYear();
+ let month = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : `0${time.getMonth() + 1}`;
+ let day = time.getDate() >= 10 ? time.getDate() : `0${time.getDate()}`;
+ let hour = time.getHours() >= 10 ? time.getHours() : `0${time.getHours()}`;
+ let minute = time.getMinutes() >= 10 ? time.getMinutes() : `0${time.getMinutes()}`;
+ let second = time.getSeconds() >= 10 ? time.getSeconds() : `0${time.getSeconds()}`;
+ return [year, Sign, month , Sign, day, ' ', hour , ':', minute, ':', '00' ].join('');
+}
+
+/***
+ * phoneRegular: 鎵嬫満鍙烽獙璇�
+ * mailboxRegular: 閭楠岃瘉
+ * positiveInteger: 姝f暣鏁�
+ * decimal: 灏忔暟锛堝彧鏀寔鍥涗綅灏忔暟锛�
+ * positiveIntegerDecimal: 姝f暣鏁板皬鏁帮紙鏈�澶氬洓浣嶅皬鏁帮級
+ * number锛氭暟瀛楁渶澶氫繚鐣欏洓浣嶅皬鏁�
+ */
+const REGULAR = {
+ phoneRegular: /^1[3456789]\d{9}$/,
+ mailboxRegular: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
+ positiveInteger: /^[0-9]*[1-9][0-9]*$/,
+ decimal: /^0$|^[1-9]\d{0,15}$|^[1-9]\d{0,15}\.{1}\d{1,4}$|^0\.{1}\d{1,4}$/g,
+ positiveIntegerDecimal: /^([1-9][0-9]*|0)(\.[0-9]?[1-9][1-9][1-9])?$/,
+ number: /^\d+(?:\.\d{1,4})?$/
+}
+
+export { gsdate, setTime, setTimeO, REGULAR }
--
Gitblit v1.9.3