rdialog.js
1.76 KB
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
/**
* 弹框 dialog 改版
* @author: gxh<xuhui.ge@yoho.cn>
* @date: 2016/01/06
*/
var $ = require('yoho-jquery'),
Dialog = require('../common/dialog').Dialog;
function RDialog(opts) {
var option = $.extend(true, {}, {
className: 'r-dialog',
closeIcon: true
}, opts);
option.content = '<div class="dialog-content">' + option.content + '</div>';
option.btns.name = '';
Dialog.call(this, option);
}
RDialog.prototype = new Dialog({
inherit: true
});
RDialog.prototype.constructor = RDialog;
function RConfirm(content, ok, cancel, okName, cancelName) {
var rd = new RDialog({
content: content,
btns: [{
id: 'confirm-btn-ok',
btnClass: ['alert-sure'],
name: okName || '确定',
cb: function() {
rd.close();
(typeof ok === 'function') && ok();
}
}, {
id: 'confirm-btn-cencel',
btnClass: ['btn-cancel'],
name: cancelName || '取消',
cb: function() {
rd.close();
(typeof cancel === 'function') && cancel();
}
}]
});
rd.show();
}
RConfirm.prototype = new Dialog({
inherit: true
});
RConfirm.prototype.constructor = RConfirm;
exports.RConfirm = RConfirm;
function RAlert(content, title) {
var rd = new RDialog({
content: content,
title: title || '提示',
btns: [{
id: 'alert-sure',
btnClass: ['alert-sure'],
name: '确定',
cb: function() {
rd.close();
}
}]
});
rd.show();
}
RAlert.prototype = new Dialog({
inherit: true
});
RAlert.prototype.constructor = RAlert;
exports.RAlert = RAlert;