|
@@ -59,4 +59,52 @@ $(function () {
|
|
|
$(this).trigger('click')
|
|
|
});
|
|
|
|
|
|
-});
|
|
|
+ /*! 手机号验证码 */
|
|
|
+ var wait = 60;
|
|
|
+
|
|
|
+ function time(o) {
|
|
|
+ if (wait == 0) {
|
|
|
+ o.removeAttribute("disabled");
|
|
|
+ o.value = "获取验证码";
|
|
|
+ wait = 60;
|
|
|
+ } else {
|
|
|
+ o.setAttribute("disabled", true);
|
|
|
+ o.value = wait;
|
|
|
+ wait--;
|
|
|
+ setTimeout(function () {
|
|
|
+ time(o);
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $body.on('click', '#btnSendCode', function () {
|
|
|
+ $("#btnSendCode").attr("disabled", true).removeClass("layui-btn layui-btn-primary").addClass("layui-btn layui-btn-normal");
|
|
|
+ if (wait != 60) {
|
|
|
+ layer.msg("请" + wait + "秒后再试!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#smscode").val("");
|
|
|
+ var _this = this;
|
|
|
+ var url = "/admin/sms/send";
|
|
|
+ $.ajax({
|
|
|
+ type: "post",
|
|
|
+ url: url,
|
|
|
+ data: '',
|
|
|
+ dataType: "json",
|
|
|
+ async: false,
|
|
|
+ success: function (data) {
|
|
|
+ console.log(data)
|
|
|
+ if (data.code == '0') {
|
|
|
+ $("#btnSendCode").attr("disabled", false).removeClass("layui-btn layui-btn-primary").addClass("layui-btn layui-btn-normal");
|
|
|
+ layer.msg("发送失败," + data.info);
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ time(_this);
|
|
|
+ layer.msg("验证码已发送,5分钟内有效");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+});
|