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


    //获取屏幕高

    var bg_width = window.innerWidth * 0.22;
    var bg_height = bg_width;
    $("#bg").css("height", bg_height);
    $("#bg").css("width", bg_width);

    var top = (window.innerHeight - bg_height) / 2.0
    $("#bg").css("top", top);
    //  $("#bg input").css("height",window.innerHeight*.04);
    //  $("#bg label").css("line-height",window.innerHeight*.04+"px");

    //  $("#bg").css("font-size",window.innerHeight*.02);
    //  $(".p").css("margin-top",window.innerHeight*.035+"px");

    // $(".login").css("bottom",window.innerHeight*.15+"px")


    $('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");

            //获取域名
            // host = "http://"+window.location.host+"/";
            // base_image_server_url = host;
            // base_ui_url = host;
            window.location.href = base_ui_url + "view/new.html?time=" + (Date.parse(new Date()))

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