"use strict"; /** * UI信息提示与交互确认类 * * @class IBizNotification */ var IBizNotification = /** @class */ (function () { /** * Creates an instance of IBizNotification. * 创建 IBizNotification 实例 私有构造,拒绝通过 new 创建对象 * @param {*} [opts={}] * @memberof IBizNotification */ function IBizNotification(opts) { if (opts === void 0) { opts = {}; } } /** * 获取 IBizNotification 单例对象 * * @static * @returns {IBizNotification} * @memberof IBizNotification */ IBizNotification.getInstance = function () { if (!IBizNotification.iBizNotification) { IBizNotification.iBizNotification = new IBizNotification(); } return this.iBizNotification; }; /** * 信息 * * @param {string} title 标题 * @param {string} desc 内容 * @param {number} [duration] 关闭时间,默认4.5秒 (可选) * @memberof IBizNotification */ IBizNotification.prototype.info = function (title, desc, duration) { iview.Notice.info({ title: title, desc: desc, duration: duration ? duration : 4.5 }); }; /** * 成功 * * @param {string} title 标题 * @param {string} desc 内容 * @param {number} [duration] 关闭时间,默认4.5秒 (可选) * @memberof IBizNotification */ IBizNotification.prototype.success = function (title, desc, duration) { iview.Notice.success({ title: title, desc: desc, duration: duration ? duration : 4.5 }); }; /** * 警告 * * @param {string} title 标题 * @param {string} desc 内容 * @param {number} [duration] 关闭时间,默认4.5秒 (可选) * @memberof IBizNotification */ IBizNotification.prototype.warning = function (title, desc, duration) { iview.Notice.warning({ title: title, desc: desc, duration: duration ? duration : 4.5 }); }; /** * 错误 * * @param {string} title 标题 * @param {string} desc 内容 * @param {number} [duration] 关闭时间,默认4.5秒 (可选) * @memberof IBizNotification */ IBizNotification.prototype.error = function (title, desc, duration) { iview.Notice.error({ title: title, desc: desc, duration: duration ? duration : 4.5 }); }; /** * 确认对话框 * * @param {string} title 标题 * @param {string} contant 内容 * @returns {Subject<any>} 可订阅对象 * @memberof IBizNotification */ IBizNotification.prototype.confirm = function (title, contant) { var subject = new rxjs.Subject(); iview.Modal.confirm({ title: title, content: contant, onOk: function () { subject.next('OK'); }, onCancel: function () { subject.next('CANCEL'); } }); return subject; }; /** * 单例变量声明 * * @static * @type {IBizNotification} * @memberof IBizNotification */ IBizNotification.iBizNotification = null; return IBizNotification; }());