给注册的账户限制为只能用手机号码

This commit is contained in:
季圣华
2019-11-02 09:49:01 +08:00
parent 8937235726
commit 15a431e77f
2 changed files with 22 additions and 5 deletions

View File

@@ -335,3 +335,17 @@
function turnBillDetailPage(number, type) { function turnBillDetailPage(number, type) {
js.addTabPage(null, "单据明细", "/pages/materials/bill_detail.html?n="+ number + "&type=" + type); js.addTabPage(null, "单据明细", "/pages/materials/bill_detail.html?n="+ number + "&type=" + type);
} }
/**
* 验证手机号码
* @param phoneInput
* @returns {boolean}
*/
function isPhoneAvailable(phoneInput) {
var myreg=/^[1][3,4,5,7,8,9][0-9]{9}$/;
if (!myreg.test(phoneInput.val())) {
return false;
} else {
return true;
}
}

View File

@@ -48,9 +48,9 @@
</div> </div>
<div class="register-box-body"> <div class="register-box-body">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<span class="glyphicon glyphicon-user form-control-feedback" title="登录账"></span> <span class="glyphicon glyphicon-user form-control-feedback" title="登录账"></span>
<input type="text" id="username" name="username" class="form-control required" <input type="text" id="username" name="username" class="form-control required"
data-msg-required="请填写登录账号." placeholder="登录账"/> data-msg-required="请填写登录账号." placeholder="登录账(请输入手机号码"/>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<span class="glyphicon glyphicon-lock form-control-feedback" <span class="glyphicon glyphicon-lock form-control-feedback"
@@ -127,10 +127,13 @@
if($("#validCode").val()) { if($("#validCode").val()) {
var res = verifyCode.validate($("#validCode").val()); var res = verifyCode.validate($("#validCode").val());
if(res){ if(res){
if(!$("#username").val()) { var userName = $("#username");
alert("用户名不能为空!"); if(!userName.val()) {
alert("登录账户不能为空!");
} else if(!isPhoneAvailable(userName)) {
alert("请输入正确的手机号码!");
} else if(!$("#password").val()) { } else if(!$("#password").val()) {
alert("密码不能为空!"); alert("登录密码不能为空!");
} else if(!$("#confirmPassword").val()) { } else if(!$("#confirmPassword").val()) {
alert("确认密码不能为空!"); alert("确认密码不能为空!");
} else if($("#password").val()!=$("#confirmPassword").val()) { } else if($("#password").val()!=$("#confirmPassword").val()) {