将 admin 模块化拆分

This commit is contained in:
virusdefender
2015-08-02 09:54:37 +08:00
parent 8b058a3785
commit 9a8c15ab80
6 changed files with 186 additions and 186 deletions

View File

@@ -0,0 +1,42 @@
define("login", ["jquery", "bs_alert", "validation"], function($, bs_alert){
$("#login-form")
.formValidation({
framework: "bootstrap",
fields: {
username: {
validators: {
notEmpty: {
message: "请填写用户名"
}
}
},
password: {
validators: {
notEmpty: {
message: "请填写密码"
}
}
}
}
}
).on('success.form.fv', function(e) {
e.preventDefault();
var username = $("#username").val();
var password = $("#password").val();
$.ajax({
url: "/api/login/",
data: {username: username, password: password},
dataType: "json",
method: "post",
success: function (data) {
if(!data.code){
window.location.href="/";
}
else{
bs_alert(data.data);
}
}
})
});
});