Commit 8aa1f4d2 by 梁建民

js

parent dcefbeb0
...@@ -76,7 +76,15 @@ ...@@ -76,7 +76,15 @@
} }
}); });
}); });
} else if (res.errcode == 110001) { } else if(res.errcode === 501){
layer.msg(res.errmsg,function () {
window.location.href = home_url + '/login';
});
}else if (res.errcode == 110001) {
layui.laytpl(getTpl).render([], function (html) { layui.laytpl(getTpl).render([], function (html) {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
var str = '期货'; var str = '期货';
data.value == '期货' ? str='期货':str='现货'; data.value == '现货' ? str='现货':str='期货';
var getTpl = deliveryHtml.innerHTML; var getTpl = deliveryHtml.innerHTML;
......
...@@ -98,7 +98,6 @@ ...@@ -98,7 +98,6 @@
} }
}, },
calcForm: function (ele, type) { calcForm: function (ele, type) {
var $mobile = $(ele).find('input[name="mobile"]'), var $mobile = $(ele).find('input[name="mobile"]'),
$password = $(ele).find('input[name="password"]'), $password = $(ele).find('input[name="password"]'),
...@@ -134,7 +133,7 @@ ...@@ -134,7 +133,7 @@
} }
if (!$code.val() && type ===2) { if (!$code.val() && type === 2) {
$code.parent('.input-wrap').addClass('error'); $code.parent('.input-wrap').addClass('error');
...@@ -257,19 +256,20 @@ ...@@ -257,19 +256,20 @@
}); });
//密码提交 //验证码提交
layui.form.on('submit(login)', function (data) { layui.form.on('submit(verifyCode)', function (data) {
if (opt.calcForm(data.form, 1)) {
if (opt.calcForm(data.form, 2)) {
$(data.elem).addClass("layui-btn-disabled"); $(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) { if (!opt.isClick) {
opt.isClick = true; opt.isClick = true;
IcController.getData(apis.authlogin, 'POST', data.field, function (res) { IcController.getData(apis.authMobilelogin, 'POST', data.field, function (res) {
if (res.err_code == 0) { if (res.err_code == 0) {
//注入token //注入token
Util.setCookie('token', res.data.access_token, 1, cookieHostname); Util.setCookie('token', res.data.access_token, 1, cookieHostname);
...@@ -287,19 +287,20 @@ ...@@ -287,19 +287,20 @@
}); });
} }
} }
}); });
//验证码提交 //密码提交
layui.form.on('submit(verifyCode)', function (data) { layui.form.on('submit(login)', function (data) {
if (opt.calcForm(data.form, 1)) {
if (opt.calcForm(data.form, 2)) {
$(data.elem).addClass("layui-btn-disabled"); $(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) { if (!opt.isClick) {
opt.isClick = true; opt.isClick = true;
IcController.getData(apis.authMobilelogin, 'POST', data.field, function (res) { IcController.getData(apis.authlogin, 'POST', data.field, function (res) {
if (res.err_code == 0) { if (res.err_code == 0) {
...@@ -321,8 +322,24 @@ ...@@ -321,8 +322,24 @@
} }
} }
}); });
$("body").keydown(function () {
if (event.keyCode == "13") {
if ($(".layui-form").is(":visible")) {
$(".layui-form").find('a.btn').trigger('click');
}
}
});
return this; return this;
}, }
}, $(function () { }, $(function () {
LoginController.init(); LoginController.init();
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment