Commit 8aa1f4d2 by 梁建民

js

parent dcefbeb0
......@@ -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) {
......
......@@ -20,7 +20,7 @@
var str = '期货';
data.value == '期货' ? str='期货':str='现货';
data.value == '现货' ? str='现货':str='期货';
var getTpl = deliveryHtml.innerHTML;
......
......@@ -98,7 +98,6 @@
}
},
calcForm: function (ele, type) {
var $mobile = $(ele).find('input[name="mobile"]'),
$password = $(ele).find('input[name="password"]'),
......@@ -134,7 +133,7 @@
}
if (!$code.val() && type ===2) {
if (!$code.val() && type === 2) {
$code.parent('.input-wrap').addClass('error');
......@@ -257,24 +256,25 @@
});
//码提交
layui.form.on('submit(login)', function (data) {
if (opt.calcForm(data.form, 1)) {
//验证码提交
layui.form.on('submit(verifyCode)', function (data) {
if (opt.calcForm(data.form, 2)) {
$(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) {
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) {
//注入token
Util.setCookie('token', res.data.access_token, 1, cookieHostname);
window.location.href = home_url + '/homes';
} else {
layer.msg(res.err_msg);
......@@ -287,27 +287,28 @@
});
}
}
});
//验证码提交
layui.form.on('submit(verifyCode)', function (data) {
if (opt.calcForm(data.form, 2)) {
//码提交
layui.form.on('submit(login)', function (data) {
if (opt.calcForm(data.form, 1)) {
$(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) {
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) {
//注入token
Util.setCookie('token', res.data.access_token, 1, cookieHostname);
window.location.href = home_url + '/homes';
} else {
layer.msg(res.err_msg);
......@@ -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;
},
}
}, $(function () {
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