8.7w+
社区成员
setLoginStatus();
$("#loginButton").click(function () {
var id =$("#id").val();
var passwd=$("#passwd").val();
var remember=$("#remember").prop('checked');
if( id=='' && passwd==''){
$("#info").text("提示:账号和密码不能为空");
}
else if ( id ==''){
$("#info").text("提示:账号不能为空");
}
else if( passwd ==''){
$("#info").text("提示:密码不能为空");
}
else if(isNaN( id )){
$("#info").text("提示:账号必须为数字");
}
else {
$.ajax({
type: "POST",
url: "/api/loginCheck",
data: {
"id":id ,
"passwd": passwd
},
dataType: "json",
success: function(data) {
if(data.stateCode.trim() == "0") {
$("#info").text("提示:账号或密码错误!");
} else if(data.stateCode.trim() == "1") {
$("#info").text("提示:登陆成功,跳转中...");
window.location.href="/admin_main.html";
} else if(data.stateCode.trim() == "2"){
if(remember){
rememberLogin(id,passwd,remember);
}else {
Cookies.remove('loginStatus');
}
$("#info").text("提示:登陆成功,跳转中...");
window.location.href="/reader_main.html";
}
}
});
}
})