layui.use(["form","layer","jquery"],function(){var i=layui.form,a=layui.layer,t=layui.jquery;t(function(){t.ajax({url:"ajax.php",dataType:"json",success:function(i){"0"==i.code&&(window.location.href="home.html")}})}),i.on("submit(login)",function(i){var o=t(".userName").val(),u=t(".password").val(),n=a.msg("数据提交中，请稍候",{icon:16,time:!1,shade:.8});return t.ajax({url:"ajax.php?act=login",type:"post",data:{user:o,pass:u},dataType:"json",success:function(i){"登录成功"==i.data.msg?(setTimeout(function(){a.close(n),a.msg("登录成功",{icon:1,time:1e3})},500),setTimeout(function(){window.location.href="home.html"},2e3)):setTimeout(function(){a.close(n),a.msg(i.data.msg,{icon:2,time:1e3})},500)}}),!1}),t(".loginBody .input-item").click(function(i){i.stopPropagation(),t(this).addClass("layui-input-focus").find(".layui-input").focus()}),t(".loginBody .layui-form-item .layui-input").focus(function(){t(this).parent().addClass("layui-input-focus")}),t(".loginBody .layui-form-item .layui-input").blur(function(){t(this).parent().removeClass("layui-input-focus"),""!=t(this).val()?t(this).parent().addClass("layui-input-active"):t(this).parent().removeClass("layui-input-active")})});