/*
 * @功能描述:各种系统消息框
 * @前置插件:JQueryUI
 * @开 发 者:魏巍
 * @开发日期:2015-04-15
 * @version 1.0
 */
var SF = {};
SF.Msg = function () {
    var $msgbox, offTimer;

    var popup = function (_msg) {//自动关闭
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 150,
            resizable: false,
            close: function () {
                $(this).dialog("destroy");
            }
        });
        $msgbox.prev('.ui-dialog-titlebar').remove();

        clearTimeout(offTimer);
        offTimer = setTimeout(function () {
            $msgbox.dialog("close");
        }, 1000);
    }

    var succeed = function () {//操作成功
        popup("操作成功");
    }

    var alert = function (_msg) {
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 200,
            modal: true,
            resizable: false,
            buttons: { "确定": function () { $(this).dialog("close"); } },
            close: function () {
                $(this).dialog("destroy");
            }
        });
    }

    var confirm = function (_msg, _callback) {
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 200,
            modal: true,
            resizable: false,
            buttons: {
                "确定": function () {
                    $(this).dialog("close");
                    _callback();
                },
                "取消": function () {
                    $(this).dialog("close");
                }
            },
            close: function () {
                $(this).dialog("destroy");
            }
        });
    }

    return {
        popup: popup,
        succeed: succeed,
        alert: alert,
        confirm: confirm
    }
}();

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-12-19
  • 2021-11-20
  • 2022-12-23
  • 2021-06-12
猜你喜欢
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
相关资源
相似解决方案