modal.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus'
  2. let loadingInstance;
  3. import _this from '../main.js'
  4. const alertCommon = (content,type) => {
  5. _this.$alert(content, '系统提示', {
  6. confirmButtonText: '确定',
  7. callback: action => {
  8. this.$message({
  9. type,
  10. message: `action: ${ action }`
  11. });
  12. }
  13. });
  14. }
  15. const notifyCommon = (content,type) => {
  16. _this.$notify({
  17. title: '系统提示',
  18. message: content,
  19. type
  20. });
  21. }
  22. export default {
  23. // 消息提示
  24. msg(content) {
  25. _this.$message(content);
  26. },
  27. // 错误消息
  28. msgError(content) {
  29. _this.$message.error(content);
  30. },
  31. // 成功消息
  32. msgSuccess(content) {
  33. _this.$message({
  34. message: content,
  35. type: 'success'
  36. });
  37. },
  38. // 警告消息
  39. msgWarning(content) {
  40. _this.$message({
  41. message: content,
  42. type: 'warning'
  43. });
  44. },
  45. // 弹出提示
  46. alert(content) {
  47. alertCommon(content,'info');
  48. },
  49. // 错误提示
  50. alertError(content) {
  51. alertCommon(content,'error');
  52. },
  53. // 成功提示
  54. alertSuccess(content) {
  55. alertCommon(content,'success');
  56. },
  57. // 警告提示
  58. alertWarning(content) {
  59. alertCommon(content,'warning');
  60. },
  61. // 通知提示
  62. notify(content) {
  63. notifyCommon(content,'info');
  64. },
  65. // 错误通知
  66. notifyError(content) {
  67. notifyCommon(content,'error');
  68. },
  69. // 成功通知
  70. notifySuccess(content) {
  71. notifyCommon(content,'success');
  72. },
  73. // 警告通知
  74. notifyWarning(content) {
  75. notifyCommon(content,'warning');
  76. },
  77. // 确认窗体
  78. confirm(content) {
  79. return _this.$confirm(content, '系统提示', {
  80. confirmButtonText: '确定',
  81. cancelButtonText: '取消',
  82. type: 'warning'
  83. })
  84. },
  85. // 提交内容
  86. prompt(content) {
  87. return _this.$prompt(content, '系统提示', {
  88. confirmButtonText: '确定',
  89. cancelButtonText: '取消',
  90. type: "warning"
  91. })
  92. },
  93. // 打开遮罩层
  94. loading(content) {
  95. // loadingInstance = ElLoading.service({
  96. // lock: true,
  97. // text: content,
  98. // background: "rgba(0, 0, 0, 0.7)",
  99. // })
  100. },
  101. // 关闭遮罩层
  102. closeLoading() {
  103. // loadingInstance.close();
  104. }
  105. }