From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 七月 2025 11:46:57 +0800
Subject: [PATCH] 项目初始化

---
 utils/verify.js |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/utils/verify.js b/utils/verify.js
new file mode 100644
index 0000000..df83913
--- /dev/null
+++ b/utils/verify.js
@@ -0,0 +1,69 @@
+/**
+ * 鐢ㄦ埛杈撳叆鍐呭楠岃瘉绫�
+ */
+
+// 鏄惁涓虹┖
+export const isEmpty = (str) => {
+  return !str || str.trim() == ''
+}
+
+/**
+ * 鍖归厤phone
+ */
+export const isPhone = (str) => {
+  const reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/
+  return reg.test(str)
+}
+
+/**
+ * 鍖归厤phone
+ */
+export const isMobile = (str) => {
+  const reg = /^(1[3456789]\d{9})$/
+  return reg.test(str)
+}
+
+/**
+ * 鍖归厤Email鍦板潃
+ */
+export const isEmail = (str) => {
+  if (str == null || str == "") return false
+  var result = str.match(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/)
+  if (result == null) return false
+  return true
+}
+
+/**
+ * 鍒ゆ柇鏁板�肩被鍨嬶紝鍖呮嫭鏁存暟鍜屾诞鐐规暟
+ */
+export const isNumber = (str) => {
+  if (isDouble(str) || isInteger(str)) return true
+  return false
+}
+
+/**
+ * 鍒ゆ柇鏄惁涓烘鏁存暟(鍙兘杈撳叆鏁板瓧[0-9])
+ */
+export const isPositiveInteger = (str) => {
+  return /(^[0-9]\d*$)/.test(str)
+}
+
+/**
+ * 鍖归厤integer
+ */
+export const isInteger = (str) => {
+  if (str == null || str == "") return false
+  var result = str.match(/^[-\+]?\d+$/)
+  if (result == null) return false
+  return true
+}
+
+/**
+ * 鍖归厤double鎴杅loat
+ */
+export const isDouble = (str) => {
+  if (str == null || str == "") return false
+  var result = str.match(/^[-\+]?\d+(\.\d+)?$/)
+  if (result == null) return false
+  return true
+}

--
Gitblit v1.9.3