/**
* 参数较验
*
* */
var verification = {
stop : false, //倒计时
//验证手机号
phone : function (tel, id) {
if ("" == tel || !tel) {
mui.toast('手机号不可以为空!');
} else {
var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
//验证规则
if (reg.test(tel)) return true;
mui.toast("手机号错误!");
}
document.getElementById(id).focus();
return false;
},
//验证密码(密码只能由数字和字母组成)
password : function (w, id) {
if ("" == w || !w) {
mui.toast('请输入密码!');
} else if (w.length < 6) {
mui.toast('密码至少大于等于6位!');
} else if (w.length > 20) {
mui.toast('密码不能超过20位!');
} else if (w) {
var reg = /^[0-9a-zA-Z]+$/;
if (reg.test(w)) return true;
mui.toast("密码只能由数字和字母组成");
}
document.getElementById(id).focus();
return false;
},
//验证码倒计时
code : function (tel, btn, type) {
var that = this,
tel = $.trim(tel);
if (!this.phone(tel, 'userTel')) return false;
if (true == that.stop) return false; //防止重复点击
that.stop = true;
var btn = $("#"+btn);
btn.attr("disabled", true).text("正在发送");
var _no = 60;
var time = setInterval(function () {
_no--;
btn.text(_no + "秒后重发");
if (_no == 0) {
//btn.attr("disabled", false).text("获取验证码");
btn.removeAttr('disabled').text("重新获取验证码");
that.stop = false;
_no = 60;
clearInterval(time);
}
}, 1000);
var url = "/Home/User/sendVerifyCode.html";
$.post(url, {
toNumber: tel,
type:type
}, function (result) {
mui.toast(result.info);
if (200 != result.status) {
btn.removeAttr('disabled').text("获取验证码");
that.stop = false;
_no = 60;
clearInterval(time);
}
}, 'json');
}
};
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有