Browse Source

邮箱校验

zhaoxiaohai 2 years ago
parent
commit
3931b339b8
1 changed files with 12 additions and 1 deletions
  1. 12 1
      utils/deleteMark.js

+ 12 - 1
utils/deleteMark.js

@@ -17,7 +17,18 @@ const CheckPhoneNumber = (num) => {
     })
     return isAllow;
 }
+/* 校验邮箱 */
+const CheckEmail = (num) => {
+    const reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
+    let isAllow = reg.test(num);
+    if (!isAllow) wx.showToast({
+        title: '请输入正确的邮箱格式!',
+        icon: "none"
+    })
+    return isAllow;
+}
 module.exports = {
     queryStr,
-    CheckPhoneNumber
+    CheckPhoneNumber,
+    CheckEmail
 }