login.js 698 Bytes
if (typeof(dmap) == "undefined") var dmap = {};
dmap.login = {
    init: function() {
        $('#btn-login').bind('click', function(e) {
            let username = $("#username").val();
            let password = $("#password").val();

            if (username.length <= 0 || password.length <= 0) {
                tips.notify("用户名或密码不能为空", "danger", 1e3);
                return false;
            }

            $.post("authorize", { username: username, password: password }, function(data) {
                if (!data.result) {
                    tips.notify("账号或密码错误", "danger", 1e3);
                }
            })
        });
    }
};