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 | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletions(-) diff --git a/minipro_standard/util/utils.js b/minipro_standard/util/utils.js index db2d308..95f672f 100644 --- a/minipro_standard/util/utils.js +++ b/minipro_standard/util/utils.js @@ -42,4 +42,37 @@ return [year, Sign, month , Sign, day, ' ', hour , ':', minute, ':', '00' ].join(''); } -export { gsdate, setTime, setTimeO } +/*** + * 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