Commit 72ad639a by 梁建民

login

parent df8211dd
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
this.handleBind(this); this.handleBind(this);
}, },
getUserName: function () { getUserName: function () {
var val = $("input[name='username']").val(); var val = $("input[name='account_name']").val();
if (val) { if (val) {
return val; return val;
} }
return false; return false;
}, },
getPasswd: function () { getPasswd: function () {
var val = $("input[name='pwd']").val(); var val = $("input[name='password']").val();
if (val) { if (val) {
return val; return val;
} }
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 10000,
success: function (res) { success: function (res) {
if (resp.code > 0) { if (res.code == 0) {
layer.msg(resp.msg);
} else {
typeof callback == 'function' && callback(res); typeof callback == 'function' && callback(res);
} else {
layer.msg(res.msg);
} }
}, },
error: function (res) { error: function (res) {
...@@ -74,18 +74,23 @@ ...@@ -74,18 +74,23 @@
//提交 //提交
$(opt.submit).on('click', function () { $(opt.submit).on('click', function () {
if (opt.calcForm(opt)) { if (opt.calcForm(opt)) {
opt.getData(function (res) { var params = {
setCookie('yunxin_token', resp.data) 'account_name': $("input[name='account_name']").val(),
'password': $.md5($("input[name='password']").val()),
'code': $("input[name='code']").val()
}
opt.getData(params, function (res) {
Util.setCookie('yunxin_token', res.data,1,cookieHostname)
window.location.href = "/web/orderList" window.location.href = "/web/orderList"
}); });
} }
}); });
$("input[name='username']").on('blur', function () { $("input[name='account_name']").on('blur', function () {
opt.calcForm(opt); opt.calcForm(opt);
}); });
$("input[name='pwd']").on('blur', function () { $("input[name='password']").on('blur', function () {
opt.calcForm(opt); opt.calcForm(opt);
}); });
......
...@@ -101,5 +101,5 @@ ...@@ -101,5 +101,5 @@
window.Util = Util; window.Util = Util;
} }
})(window); })(window);
var cookieHostname = window.location.hostname.split(".")[1] + "." + window.location.hostname.split(".")[2];
...@@ -42,14 +42,14 @@ ...@@ -42,14 +42,14 @@
<i class="icn i-1"></i> <i class="icn i-1"></i>
<b class="lineBlock emptys"></b> <b class="lineBlock emptys"></b>
</div> </div>
<input type="text" placeholder="请输入手机号/邮箱/企业用户名" name="username"> <input type="text" placeholder="请输入手机号/邮箱/企业用户名" name="account_name">
</div> </div>
<div class="inp-wrap"> <div class="inp-wrap">
<div class="arr"> <div class="arr">
<i class="icn i-2"></i> <i class="icn i-2"></i>
<b class="lineBlock emptys"></b> <b class="lineBlock emptys"></b>
</div> </div>
<input type="text" placeholder="请输入登录密码" name="pwd"> <input type="text" placeholder="请输入登录密码" name="password">
</div> </div>
<div class="code clr"> <div class="code clr">
<div class="code-inp fl"> <div class="code-inp fl">
......
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