$(".send").click(function () {
if ($("#UsersPhone").val() == "") {
layer.msg("请输入手机号码!", { icon: 5 });
return false;
}
var param = /^1[34578]\d{9}$/;
if (!param.test($("#UsersPhone").val())) {
layer.msg("请输入正确的手机号码!", { icon: 5 });
return false;
}
if ($(this).html() == "发送验证码") {
SenMsgTime();
}
})
var time = 60;
///倒计时
var SenMsgTime = function () {
if (time == 0) {
$("#senMsg").html("发送验证码");
$("#senMsg").attr("disabled", "");
time = 60;
} else {
if (time == 60) {
var Phone = $("#UsersPhone").val();
//$.ajax({
// url: "/Account/SenCode",
// data: { Phone: Phone },
// type: "POST",
// dataType: "json",
// success: function (result) {
// if (result) {
// layer.msg("短信已经发送!", { icon: 1 });
// } else {
// layer.msg(result.Msg, { icon: 5 });
// }
// }, complete: function () {
// }
//})
}
$("#senMsg").attr("disabled", "disabled");
time--;
$("#senMsg").html(time);
setTimeout(function () { SenMsgTime(); }, 1000);
}
}