index.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { h } from 'vue'
  2. import domView from './index.vue'
  3. //删除提醒
  4. export const delMessageV2 = (cbk) => {
  5. window?.$messageBox({
  6. center: true,
  7. message: () => h(domView, {
  8. type: 'delete',
  9. title: '确认删除提醒',
  10. text: '请谨慎考虑后,确认是否需要删除?',
  11. }),
  12. customClass: 'hc-message-view-box',
  13. showCancelButton: true,
  14. confirmButtonText: '确认删除',
  15. cancelButtonText: '取消操作',
  16. beforeClose: (action, instance, done) => {
  17. if (cbk) {
  18. cbk(action, instance, done)
  19. } else {
  20. done()
  21. }
  22. },
  23. })
  24. }
  25. //请求异常
  26. export const apiErrorMessage = () => {
  27. setTimeout(() => {
  28. const doms = document.querySelector('.hc-message-view-box.warning')
  29. if (doms) return
  30. window?.$messageBox({
  31. center: true,
  32. message: () => h(domView, {
  33. type: 'warning',
  34. title: '服务器异常,请稍后重试',
  35. text: '服务器异常了,如有需要,请联系管理员!',
  36. }),
  37. customClass: 'hc-message-view-box warning',
  38. showCancelButton: false,
  39. confirmButtonText: '关闭',
  40. })
  41. }, 1000)
  42. }
  43. //请求异常
  44. export const apiWarningMessage = () => {
  45. setTimeout(() => {
  46. const doms = document.querySelector('.hc-message-view-box.warning')
  47. if (doms) return
  48. window?.$messageBox({
  49. center: true,
  50. message: () => h(domView, {
  51. type: 'warning',
  52. title: '正在升级优化,请稍后重试',
  53. text: '该功能正在升级优化,请联系管理员',
  54. }),
  55. customClass: 'hc-message-view-box warning',
  56. showCancelButton: false,
  57. confirmButtonText: '关闭',
  58. })
  59. }, 1000)
  60. }