wangsheng
2022-03-22 064d7cb908b5ff528dfb3310c49b2f010bd28079
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
(function ($) {
    $.extend($.fn, {
        showLoading: function () {
            var original = $(this);
            var position = original.offset();
            var width = original.outerWidth();
            var height = original.outerHeight();
 
            var loadingdiv = $(document.body).find("> div.loading-div-gen");
 
            if (loadingdiv.size() == 0) {
                loadingdiv = $('<div class="loading-div-gen" ><div style="display:block;margin-top:300px;"><i style="font-size: 75px; color: rgb(0, 153, 255);" class="icon-spinner icon-spin"></i></div></div>');
                loadingdiv.appendTo($(document.body));
            }
 
            loadingdiv.css({
                position: 'fixed',
                top: 0,
                left: 0,
                'z-index': 1051,
                opacity: 1,
                'text-align': 'center',
                width: screen.width,
                height: screen.height
            });
 
            return loadingdiv;
        },
        hideLoading: function () {
            var target = $(document.body).find("> div.loading-div-gen");
            target.fadeOut(1000, function () {
                target.remove();
            });
        }
    });
 
 
//    $.ajaxSubmitBak = $.fn.ajaxSubmit;
 
//    $.fn.ajaxSubmit = function (options) {
//        $(this).valid() && $.ajaxSubmitBak.call(this, options);
//    }
 
//    $.uuid = function (size) {
//        size = size || 32;
//        var s = [];
//        var hexDigits = "0123456789abcdef";
//        for (var i = 0; i < 36; i++) {
//            s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
//        }
//        s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
//        s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
//        s[8] = s[13] = s[18] = s[23] = "";
 
//        return s.join("").substr(0, size);
//    }
 
//    $.ajaxBak = $.ajax;
 
//    $.ajax = function (options) {
//        options.timeout = 300000;
//        options.url = options.url + (options.url.indexOf("?") > 0 ? "&" : "?") + "r=" + Math.random();
//        options.error = function (xhr, ajaxOptions, msg) {
//            bootbox.alert("服务器数据异常:" + xhr.statusText + ":" + xhr.responseText);
//        }
//        options.complete = function (e) {
//            $(document.body).hideLoading();
//        }
 
////        if (options.success) {
////            var successBak = options.success;
////            
////                options.success = function (e) {
////                    if (e.OK === false && !options.customError) {
////                       if (e.Message === "登录超时,请重新登录" && $("#relogin-modal").size() > 0) {
////                            $("#relogin-modal").modal();
////                        } else if ($(".loading-error").size() > 0) {
////                            $(".loading-error").html(e.Message);
////                        }
////                        //验证码
////                        else {
////                            bootbox.alert(e.Message);
////                        }
////                    }
////                    else {
////                            successBak.call(this, e);
////                            initTooltip();
////                    }
////                }
////        }
 
//        $(document.body).showLoading();
 
//        try {
//            return $.ajaxBak.call(this, options);
//        } catch (e) {
//            bootbox.alert(e);
//            $(document.body).hideLoading();
//        }
//        return this;
//    }
})(jQuery);
 
//$(function () {
//    $(document).on("show", ".modal", function (e) {
//        var w = $(this).width();
//        var h = $(this).height();
//        var docw = $(window).width();
//        var doch = $(window).height();
 
//        //h = h > doch - 60 ? doch - 60 : h;
//        $('html, body').css({
//            'overflow': 'hidden',
//            'height': '100%'
//        });
 
//        $(this).css({ left: (docw - w) / 2, "margin-left": 0, "margin-top": 0, top: (doch - h) / 2, height: h });
//    });
 
//    $(document).on("hide", ".modal", function (e) {
//        //h = h > doch - 60 ? doch - 60 : h;
//        $('html, body').css({
//            'overflow': 'auto',
//            'height': 'auto'
//        });
//    });
 
 
//    if ($("#relogin-modal form").size() > 0) {
//        $("#relogin-modal").on("click", "a.btn-primary", function (e) {
//            $("#relogin-modal form").ajaxSubmit({
//                success: function (data) {
//                    if (data.OK) {
//                        $('#relogin-modal').modal("hide");
//                    }
//                    else {
//                        bootbox.alert(data.Message);
//                    }
//                }
//            });
//        });
//    }
 
//    if ($(".action-add-shortcut").size() > 0) {
//        $(".action-add-shortcut").on("click", function (e) {
//            var funcid = $(this).data("funcid");
 
//            $.ajax({
//                url: '/ashx/profile.ashx?action=addShortcut',
//                type: 'POST',
//                data: { functionID: funcid },
//                success: function (result) {
//                    bootbox.alert(result.Message);
//                }
//            });
//        });
//    }
//});