rdialog.js
1.61 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
/**
* 弹框 dialog 改版
* @author: gxh<xuhui.ge@yoho.cn>
* @date: 2016/01/06
*/
var $ = require('yoho-jquery'),
Dialog = require('../plugins/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) {
var that = this;
var rd = new RDialog({
content: content,
btns: [{
btnClass: ['alert-sure'],
name: '确定',
cb: function() {
rd.close();
(typeof ok === 'function') && ok();
}
}, {
btnClass: ['btn-cancel'],
name: '取消',
cb: function() {
that.close();
}
}]
});
rd.show();
}
RConfirm.prototype = new Dialog({
inherit: true
});
RConfirm.prototype.constructor = RConfirm;
exports.RConfirm = RConfirm;
function RAlert(content, title) {
var that = this;
var rd = new RDialog({
content: content,
title: title || '提示',
btns: [{
btnClass: ['alert-sure'],
name: '确定',
cb: function() {
that.close();
}
}]
});
rd.show();
}
RAlert.prototype = new Dialog({
inherit: true
});
RAlert.prototype.constructor = RAlert;
exports.RAlert = RAlert;