1 2var login = { 3 init : function(){ 4 login.resetInputFun(); 5 login.resetCheckbox(); 6 login.loginForm(); //ç»å½éªè¯ 7 login.statusTab(); 8 }, 9 10 //ç¶æåæ¢ 11 statusTab:function(){ 12 $('.indivdual-tab li').click(function(){ 13 $('.indivdual-tab li').removeClass('active'); 14 $(this).addClass('active'); 15 var type = $(this).data('type'); 16 $('input[name="login_type_org"]').val(type); 17 }) 18 }, 19 20 resetInputFun : function(){ 21 $('.login-input').on('focus',function(){ 22 $(this).closest('.login-input-box').addClass('active'); 23 }) 24 25 $('.login-input').on('blur',function(){ 26 if($(this).val() == ''){ 27 $(this).closest('.login-input-box').removeClass('active'); 28 } 29 }) 30 31 $('#signupForm').on('click','.login-status.login-error',function(){ 32 $(this).siblings('input').val(''); 33 }) 34 35 /*0.6såè·åç¦ç¹*/ 36 setTimeout(function(){ 37 $('.login-input').eq(0).focus(); 38 },600) 39 }, 40 resetCheckbox : function(){ 41 $('.login-checkbox').on('click',function(){ 42 if($(this).find('.login-status').hasClass('login-success')){ 43 $(this).find('.login-status').removeClass('login-success'); 44 $(this).find('.login-checkbox-value').val(0); 45 }else{ 46 $(this).find('.login-status').addClass('login-success'); 47 $(this).find('.login-checkbox-value').val(1); 48 } 49 }) 50 }, 51 52 //è¡¨åæ°æ®æ´å 53 resetData : function(data){ 54 var dataArr = {}; 55 $.each(data,function(index,obj){ 56 dataArr[obj.name] = obj.value; 57 }) 58 return dataArr; 59 }, 60 /*表åéªè¯ä¸æäº¤*/ 61 loginForm : function(){ 62 63 //èªå®ä¹éªè¯ é®ç®± 64 jQuery.validator.addMethod("email", 65 function(value,element,params){ 66 var type = $('.indivdual-tab li.active').data('type'); 67 if(type == 'user'){ 68 var exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 69 return exp.test(value); 70 }else{ 71 value = $.trim(value); 72 return value.length != 0; 73 } 74 75 },"Email format is not correct."); 76 77 78 $("#signupForm").validate({ 79 rules: { 80 username: { 81 required: true, 82 email : true, 83 }, 84 pwd: { 85 required: true, 86 maxlength: 15, 87 minlength: 6 88 }, 89 }, 90 messages: { 91 username: { 92 required: "Please input your User Email.", 93 }, 94 pwd: { 95 required: "Please input your password.", 96 minlength: "Password must not be less than 6 characters.", 97 maxlength: "Password must not be larger than 15 characters." 98 } 99 }, 100 errorPlacement: function(error, element) { 101 error.appendTo(element.parent()); 102 error.siblings('.login-status').removeClass('login-success').addClass('login-error'); 103 }, 104 success:function(label){ 105 label.siblings('.login-status').removeClass('login-error').addClass('login-success'); 106 }, 107 submitHandler:function(form){ 108 var data = login.resetData($(form).serializeArray()); 109 110 layer.load(1, {shade: .1}); 111 $.ajax({ 112 type: "post", 113 url: "", 114 data: data, 115 dataType: "json", 116 success: function(data) { 117 // console.log(data); 118 // return false; 119 if(data.code == 100000){ 120 layer.msg("Successfully signed in.", {icon: 1,time:1500}, function(){ 121 window.location.href = data.url; 122 }) 123 }else if(data.code == 100009){ 124 layer.closeAll(); 125 layer.msg("Invalid email or password. Please try again.", {icon: 5,time:3500}, function(){ 126 // window.location.href= data.url; 127 }) 128 }else if(data.code == 100099) { 129 layer.closeAll(); 130 layer.confirm("Sorry, due to it's been too long since you last logged in, or this is your first log in, please reset your password.", { 131 icon: 0, 132 title: 'Message', 133 btn: ['Reset', 'Cancel'] 134 }, function () { 135 $(".user-changepwd").click(); 136 // window.location.href= data.url; 137 }) 138 } else if(data.code == 3){ 139 layer.closeAll(); 140 layer.msg(data.message, {icon: 5,time:5000}, function(){ 141 // window.location.href= data.url; 142 }) 143 }else{ 144 layer.closeAll(); 145 layer.msg("Sorry, the user email and password don't seem match. Please check both.",{icon: 5,time:5500,area: '380px'}, function(){ 146 //弿¥å·æ°éªè¯ç 147 // $(".captcha").attr('src','/site/captcha?t='+Math.random()); 148 // $("input[name='captcha']").val(""); 149 // if(data.code == 3){ 150 // window.location.reload(); 151 // } 152 }) 153 } 154 }, 155 error: function(){ 156 layer.closeAll(); 157 layer.msg("Invalid email or password. Please try again."); 158 } 159 }); 160 return false;
161 //form.submit(); 162 return false; 163 } 164 }) 165 } 166} 167 168login.init();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.