summaryrefslogtreecommitdiff
path: root/xxl-job-admin/src/main/resources/static/js/login.1.js
diff options
context:
space:
mode:
Diffstat (limited to 'xxl-job-admin/src/main/resources/static/js/login.1.js')
-rw-r--r--xxl-job-admin/src/main/resources/static/js/login.1.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/xxl-job-admin/src/main/resources/static/js/login.1.js b/xxl-job-admin/src/main/resources/static/js/login.1.js
new file mode 100644
index 0000000..37eba6b
--- /dev/null
+++ b/xxl-job-admin/src/main/resources/static/js/login.1.js
@@ -0,0 +1,66 @@
+$(function(){
+
+ // input iCheck
+ $('input').iCheck({
+ checkboxClass: 'icheckbox_square-blue',
+ radioClass: 'iradio_square-blue',
+ increaseArea: '20%' // optional
+ });
+
+ // login Form Valid
+ var loginFormValid = $("#loginForm").validate({
+ errorElement : 'span',
+ errorClass : 'help-block',
+ focusInvalid : true,
+ rules : {
+ userName : {
+ required : true ,
+ minlength: 4,
+ maxlength: 18
+ },
+ password : {
+ required : true ,
+ minlength: 4,
+ maxlength: 18
+ }
+ },
+ messages : {
+ userName : {
+ required : I18n.login_username_empty,
+ minlength : I18n.login_username_lt_4
+ },
+ password : {
+ required : I18n.login_password_empty ,
+ minlength : I18n.login_password_lt_4
+ /*,maxlength:"登录密码不应超过18位"*/
+ }
+ },
+ highlight : function(element) {
+ $(element).closest('.form-group').addClass('has-error');
+ },
+ success : function(label) {
+ label.closest('.form-group').removeClass('has-error');
+ label.remove();
+ },
+ errorPlacement : function(error, element) {
+ element.parent('div').append(error);
+ },
+ submitHandler : function(form) {
+ $.post(base_url + "/login", $("#loginForm").serialize(), function(data, status) {
+ if (data.code == "200") {
+ layer.msg( I18n.login_success );
+ setTimeout(function(){
+ window.location.href = base_url;
+ }, 500);
+ } else {
+ layer.open({
+ title: I18n.system_tips,
+ btn: [ I18n.system_ok ],
+ content: (data.msg || I18n.login_fail ),
+ icon: '2'
+ });
+ }
+ });
+ }
+ });
+}); \ No newline at end of file