From 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 06 十二月 2023 08:41:32 +0800
Subject: [PATCH] bug
---
minipro_standard/util/utils.js | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/minipro_standard/util/utils.js b/minipro_standard/util/utils.js
index 76809d9..95f672f 100644
--- a/minipro_standard/util/utils.js
+++ b/minipro_standard/util/utils.js
@@ -27,4 +27,52 @@
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})?$/
+}
+
+/***
+ *
+ * @param type 鏂囦欢绫诲瀷
+ */
+function judgmentType (type) {
+ let arr = ['jpg', 'jpeg', 'png']
+ // arr.includes(type)
+ let open = false
+ arr.forEach(item => {
+ if (type === item) {
+ open = true
+ }
+ })
+ return open;
+}
+
+export { gsdate, setTime, setTimeO, REGULAR, judgmentType }
--
Gitblit v1.9.3