Notify.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. import ModalFix from '../modal/src/ModalFix.JS';
  2. export default {
  3. /**
  4. * 显示模态框
  5. */
  6. show : function(options){
  7. var dialog = BootstrapDialog.show(options);
  8. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  9. ModalFix.fix();
  10. });
  11. },
  12. /**
  13. * 显示通知
  14. * @param {title} 标题
  15. * @param {content} 内容
  16. * @param {autoClose} 自动延时关闭时间(毫秒)
  17. * author: 杨志杰
  18. * version: 1.0
  19. */
  20. notice : function(title, content, autoClose){
  21. var dialog = BootstrapDialog.show({
  22. title: title,
  23. message: content,
  24. type: BootstrapDialog.TYPE_WARNING,
  25. });
  26. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  27. ModalFix.fix();
  28. });
  29. if(autoClose && autoClose > 0){
  30. setTimeout(function(){
  31. dialog.close();
  32. }, autoClose);
  33. }
  34. },
  35. /**
  36. * 显示通知
  37. * @param {title} 标题
  38. * @param {content} 内容
  39. * author: 杨志杰
  40. * version: 1.0
  41. */
  42. noticeBig : function(title, content){
  43. var dialog = BootstrapDialog.show({
  44. title: title,
  45. message: content,
  46. type: BootstrapDialog.TYPE_WARNING,
  47. size: BootstrapDialog.SIZE_WIDE,
  48. });
  49. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  50. ModalFix.fix();
  51. });
  52. },
  53. /**
  54. * 显示消息
  55. * @param {title} 标题
  56. * @param {content} 内容
  57. * @param {autoClose} 自动延时关闭时间(毫秒)
  58. * author: 杨志杰
  59. * version: 1.0
  60. */
  61. info : function(title, content, autoClose){
  62. var dialog = BootstrapDialog.show({
  63. title: title,
  64. message: content,
  65. type: BootstrapDialog.TYPE_INFO,
  66. });
  67. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  68. ModalFix.fix();
  69. });
  70. if(autoClose && autoClose > 0){
  71. setTimeout(function(){
  72. dialog.close();
  73. }, autoClose);
  74. }
  75. },
  76. /**
  77. * 显示消息
  78. * @param {title} 标题
  79. * @param {content} 内容
  80. * @param {autoClose} 自动延时关闭时间(毫秒)
  81. * author: 杨志杰
  82. * version: 1.0
  83. */
  84. infoBig : function(title, content, autoClose){
  85. var dialog = BootstrapDialog.show({
  86. title: title,
  87. message: content,
  88. type: BootstrapDialog.TYPE_INFO,
  89. size: BootstrapDialog.SIZE_WIDE,
  90. });
  91. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  92. ModalFix.fix();
  93. });
  94. if(autoClose && autoClose > 0){
  95. setTimeout(function(){
  96. dialog.close();
  97. }, autoClose);
  98. }
  99. },
  100. /**
  101. * 显示成功信息
  102. * @param {title} 标题
  103. * @param {content} 内容
  104. * @param {autoClose} 自动延时关闭时间(毫秒)
  105. * author: 杨志杰
  106. * version: 1.0
  107. */
  108. success : function(title, content, autoClose){
  109. var dialog = BootstrapDialog.show({
  110. title: title,
  111. message: content,
  112. type: BootstrapDialog.TYPE_SUCCESS,
  113. });
  114. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  115. ModalFix.fix();
  116. });
  117. if(autoClose && autoClose > 0){
  118. setTimeout(function(){
  119. dialog.close();
  120. }, autoClose);
  121. }
  122. },
  123. /**
  124. * 显示错误信息
  125. * @param {title} 标题
  126. * @param {content} 内容
  127. * @param {autoClose} 自动延时关闭时间(毫秒)
  128. * author: 杨志杰
  129. * version: 1.0
  130. */
  131. error : function(title, content, autoClose){
  132. var dialog = BootstrapDialog.show({
  133. title: title,
  134. message: content,
  135. type: BootstrapDialog.TYPE_DANGER,
  136. });
  137. dialog.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
  138. ModalFix.fix();
  139. });
  140. },
  141. };