diff --git a/src/main/resources/templates/admin/account_input.ftl b/src/main/resources/templates/admin/account_input.ftl index 6de4ed8..bdfdfd4 100644 --- a/src/main/resources/templates/admin/account_input.ftl +++ b/src/main/resources/templates/admin/account_input.ftl @@ -178,10 +178,10 @@
+ required placeholder="请输入正确的邮件地址"/>
@@ -260,11 +260,53 @@ } console.log("onInValid : " + $field.val()); $alert.html(msg).show(); + }, + //自定义验证 + validate: function (validity) { + var $field = $(validity.field); + var validityEmail = function(){ + var companyEmail = $("#companyEmail").val(); + if(!checkEmail(companyEmail)){ + $myField = $field; + myMsg = "邮件地址不合法!"; + validity.valid = false; + } + }; + var validityPhone = function(){ + var phoneNo = $("#telephone").val(); + if(!isPhoneNo(phoneNo)){ + $myField = $field; + myMsg = "电话号码不合法!"; + validity.valid = false; + } + }; + if ($(validity.field).is('#companyEmail')) { + validityEmail(); + }; + if ($(validity.field).is('#telephone')) { + validityPhone(); + }; } }); /*表单验证:end*/ }) + function isPhoneNo(card){ + var reg = /(^1[0-9][0-9]\d{8}$)/; + if(reg.test(card) === false){ + return false; + } + return true; + } + + function checkEmail(str){ + var re = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/; + if (re.test(str)) { + return true; + } else { + return false; + } + } var submit_function = function () { $("#tmpForm").submit(); } diff --git a/src/main/resources/templates/admin/account_list.ftl b/src/main/resources/templates/admin/account_list.ftl index 7c0fbc5..dcb2438 100644 --- a/src/main/resources/templates/admin/account_list.ftl +++ b/src/main/resources/templates/admin/account_list.ftl @@ -19,21 +19,21 @@ 姓名
-
手机号
-
工号
-
@@ -67,7 +67,7 @@ 常驻地
-