UI弹窗插件
复制代码
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(function (window, $, undefined) { /******************************************UI****************************** */ var _UI = function () { var _message = function () { var createAlert = function (type, msg, timeout) { if (timeout === undefined) timeout = 2000; var div = $( '<div class="cntenalert" >' + '<div class="alert-icons"></div>' + '<div class="alert-close">×</div>' + '<div class="alert-msg"></div></div>'); var winWidth = ($(window).width() - 200) / 2; div.css("left", winWidth); div.addClass(type); var close = div.find(".alert-close"); var divmsg = div.find(".alert-msg"); close.click(function () { div.fadeOut(function () { div.remove(); }); }); divmsg.text(msg); div.fadeIn(function () { }); $("body").append(div); if (timeout > 0) setTimeout(function () { div.fadeOut(function () { div.remove(); }); }, timeout); } /** * 成功提示 * @param {any} msg */ this.success = function (msg) { createAlert("alert", msg); } /** * 错误的提示 * @param {any} msg */ this.error = function (msg) { createAlert("alert-error", msg, 5000); } /** * 提醒 * @param {any} msg */ this.warning = function (msg) { createAlert("alert-warning", msg, 3000); } /** * 清除所有提示信息 * */ this.clear = function () { $(".cntenalert").fadeOut(function () { $(".cntenalert").remove(); }); } } this.message = new _message(); /** * 打开一个url 的Dialog 对话框 * @param {any} id 指定一个名字 * @param {any} url 页面地址 * @param {any} options Dialog 参数 */ this.openDialog = function (id, url, options) { var frameid = id + "_frame"; var win = $("#" + id); if (url.indexOf("?") > -1) url = url + "&_r=" + Math.random(); else url = url + "?_r=" + Math.random(); var getframe = function (id, url) { var f = $('<iframe id="{0}" src="{1}" width="100%" height="100%" scrolling="no" frameborder="0" ></iframe>'.format(id, url)); return f; }; if (win.size() == 0) { var $frame = getframe(frameid, url); //$frame.height(options.height - 43); var defaultOptions = { maximizable: true, resizable: true, closed: false, cache: false, modal: true, constrain: true, width: "80%", height: "90%" }; if (options) { $.extend(defaultOptions, options, { onClose: function () { win.remove(); if ($.isFunction(options.onClose)) { options.onClose.apply(this); } } }); } defaultOptions.content = $frame; var dd = $("<div id='" + id + "' style='overflow:hidden' />"); return dd.dialog(defaultOptions); } else { $("#" + frameid).attr("src", url); return win.dialog("open"); } } /** * 重新设置datagrid 排序状态 * @param {any} dg jquery对象 */ this.resetDataGridSort = function (dg, psotrName, psortOrder) { var opt = dg.datagrid('options'); opt.sortName = psotrName || ""; opt.sortOder = psortOrder || ""; var panel = dg.datagrid("getPanel"); var sortcell = panel.find(".datagrid-sort"); $.each(sortcell, function (i, n) { var targer = $(n); targer.removeClass("datagrid-sort-asc datagrid-sort-desc"); }); } }; $Core.UI = new _UI(); })(window, jQuery);
复制代码
1
2
3
4
5
6
7
8
9
10$Core.UI.openDialog("approve", url, { title: '审核', width: '30%', height: '45%', onClose: function () { $("#dglist").datagrid("load"); } });
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22if (rows.length == 0) { $Core.UI.message.warning("请选择要提交的数据!"); return false; } $.messager.confirm('提示', '您确定提交吗?', function (r) { debugger; if (r) { var ids = ""; $.each(rows, function (k, j) { ids += (ids == "" ? j[$id] : "," + j[$id]); }); var paras = { ids: ids }; $.post(url, paras, function (data) { if (data.code == "0") { $Core.UI.message.success("提交成功!"); $dg.datagrid("load"); } else { $Core.UI.message.error("服务器正忙!"); } }); } });
最后
以上就是疯狂帅哥最近收集整理的关于UI弹窗与提示框插件的全部内容,更多相关UI弹窗与提示框插件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复