$(document).ready(function() {
    $.zui.store.set("user", "");

    $('html').bind('keydown', function(e) {
        if (e.keyCode == 13) {
            // alert('enter'); 
            $('#loadingBtn').click();
        }
    });
    $('#loadingBtn').on('click', function() {
        var $btn = $(this);
        $btn.button('loading');


        //获取用户名
        //获取密码
        var data = {
            "username": $("#username").val(),
            "password": md5($("#password").val())
        }
        UserLogin(data, function(data) {
            $btn.button('reset');
            $.zui.store.remove("currentpage");
            window.location.href = base_ui_url + "view/main.html"

        }, function(error) {
            $btn.button('reset');
            layer.alert('用户名或密码错误');
        });




    });
});

