分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-01-16 5884c9023393061afbe6d3d6e709e53e672ddde8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
function confirmMsgnew(params) {
    var msg = null;
   
    msg = {
        text: params.text ? params.text : '您确定要这样操作吗?',
        title: params.title ? params.title : '提示信息',
        style: params.style ? ' popmsg-' + params.style : '',
        btnCloseStyle: params.style ? ' btn-' + params.style : '',
        autoClose: params.autoClose == true ? true : false,
        draggable: params.drag == true ? true : false,
 
        init: function () {
            $(document.body).append('<div class="confirm-msg"><div class="shade"></div><div class="popmsg' + msg.style + '"><span class="popmsg-title"><i class="fa fa-info-circle"></i>' + msg.title + '</span><span class="popmsg-content">' + msg.text + '</span><span class="popmsg-close"><button class="btn mr5 btn-close-yes' + msg.btnCloseStyle + '">Yes</button><button class="btn btn-close-no' + msg.btnCloseStyle + '">No</button></span></div></div>');
            document.onmousewheel = function () { return false; }
            msg.resizeDialog();
            $(window).resize(function () { msg.resizeDialog(); });
            msg.dragDialog();
            msg.callDialog();
        },
 
        resizeDialog: function () {
            $('.popmsg').css({ top: ($(window).height() - $('.popmsg').height()) / 2 + 'px', left: ($(window).width() - $('.popmsg').width()) / 2 + 'px' });
        },
 
        closeDialog: function () {
            $('.confirm-msg').remove();
            document.onmousewheel = function () { return true; }
        },
 
        dragDialog: function () {
            if (msg.draggable) { $('.popmsg').draggable({ cursor: "move" }); }
        },
 
        callDialog: function () {
            $('.btn.btn-close-yes').click(function () {
                msg.closeDialog();
                if (typeof params.callback == 'function') { params.callback(); }
            });
            $('.btn.btn-close-no').click(function () {
                msg.closeDialog();
            });
        }
    }
 
    return msg;
}
 
function alertMsg(params) {
    var msg = null;
 
    msg = {
        text: params.text ? params.text : '这家伙很懒,提示的什么内容也不写。',
        title: params.title ? params.title : '提示信息',
        style: params.style ? ' popmsg-' + params.style : '',
        btnCloseStyle: params.style ? ' btn-' + params.style : '',
        autoClose: params.autoClose == true ? true : false,
        draggable: params.drag == true ? true : false,
 
        init: function () {
            $(document.body).append('<div class="alert-msg"><div class="shade"></div><div class="popmsg' + msg.style + '"><span class="popmsg-title"><i class="fa fa-info-circle"></i>' + msg.title + '</span><span class="popmsg-content">' + msg.text + '</span><span class="popmsg-close"><button class="btn btn-close-alert' + msg.btnCloseStyle + '">Close</button></span></div></div>');
            document.onmousewheel = function () { return false; }
            msg.resizeDialog();
            $(window).resize(function () { msg.resizeDialog(); });
            msg.dragDialog();
            msg.closeDialog();
        },
 
        resizeDialog: function () {
            $('.popmsg').css({ top: ($(window).height() - $('.popmsg').height()) / 2 + 'px', left: ($(window).width() - $('.popmsg').width()) / 2 + 'px' });
        },
 
        closeDialog: function () {
            if (msg.autoClose) {
                setTimeout(function () {
                    $('.alert-msg').remove();
                }, 3000);
            } else {
                $('.btn.btn-close-alert').click(function () {
                    $('.alert-msg').remove();
                    if (typeof params.callback == 'function') { params.callback(); }
                });
            }
        
            document.onmousewheel = function () { return true; }
        },
 
        dragDialog: function () {
            if (msg.draggable) { $('.popmsg').draggable({ cursor: "move" }); }
        }
    }
 
    return msg;
}