index.js
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
jQuery(document).ready(function() {
///// TRANSFORM CHECKBOX /////
jQuery('input:checkbox').uniform();
///// LOGIN FORM SUBMIT /////
jQuery('#login').submit(function() {
if(jQuery('#username').val() == '' && jQuery('#password').val() == '') {
jQuery('.nousername').fadeIn();
jQuery('.nopassword').hide();
return false;
}
if(jQuery('#username').val() != '' && jQuery('#password').val() == '') {
jQuery('.nopassword').fadeIn().find('.userlogged h4, .userlogged a span').text(jQuery('#username').val());
jQuery('.nousername,.username').hide();
return false;
}
jQuery('#submit_btn').css({"background-color":"#c0c0c0","border":"0px"}).attr("disabled",true).text("正在登录...");
jQuery.ajax({
type: "POST",
url: "user/login",
data: { username: jQuery("#username").val(), password: jQuery.md5(jQuery("#password").val()), platform:1},
dataType: "json",
success: function (data) {
if(data.code != 0) {
jQuery("#submit_btn").css({"background":"#f0801d url(../images/btngrad.png) repeat-x top left"}).attr("disabled",false).text("登录");
jQuery('.nopassword').fadeIn().find('.userlogged h4, .userlogged a span').text(data.message);
jQuery('.nopassword').fadeIn().find('.loginmsg').text(data.message);
} else {
if(data.data.sysUser.hotelId) {
location.href = 'resources/hotelIndex.html?v=1.1.3#/hotelIndex';
} else {
location.href = 'resources/dashboard.html?v=1.2.2#/main';
}
}
}
});
});
///// ADD PLACEHOLDER /////
jQuery('#username').attr('placeholder','手机号');
jQuery('#password').attr('placeholder','密码');
});