dialogConfirm.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!--
  2. * @FileDescription: 提示确认类型弹窗
  3. * @Author: 黄琪勇
  4. * @Date:2024-03-20 19:18:13
  5. -->
  6. <template>
  7. <div class="dialogConfirm">
  8. <div class="close" @click="close"></div>
  9. <img class="headImg" v-if="props.modalData.headImg" :src="props.modalData.headImg" />
  10. <div class="textCon">
  11. <div class="text">{{ props.modalData.text }}</div>
  12. </div>
  13. <div v-if="filterBtnShow" class="dialogBtn">
  14. <img v-if="props.modalData.btnShow[1]" @click="cancel" src="@/img/useDialogConfirm/cancel.png" />
  15. <img v-if="props.modalData.btnShow[0]" @click="ok" src="@/img/useDialogConfirm/ok.png" />
  16. </div>
  17. </div>
  18. </template>
  19. <script setup lang="ts">
  20. import { computed } from "vue"
  21. const props = defineProps<{
  22. modalData: {
  23. text: string
  24. btnShow: [boolean?, boolean?]
  25. headImg?: string
  26. }
  27. }>()
  28. const emits = defineEmits<{
  29. (e: "onClose"): void
  30. (e: "onCancel"): void
  31. (e: "onOk"): void
  32. }>()
  33. const filterBtnShow = computed(() => {
  34. const { btnShow } = props.modalData
  35. return !!(btnShow[0] || btnShow[1])
  36. })
  37. function close() {
  38. emits("onClose")
  39. }
  40. function cancel() {
  41. emits("onCancel")
  42. }
  43. function ok() {
  44. emits("onOk")
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .dialogConfirm {
  49. padding-top: 36px;
  50. padding-bottom: 22px;
  51. width: 100%;
  52. height: 100%;
  53. display: flex;
  54. flex-direction: column;
  55. .close {
  56. position: absolute;
  57. top: -14px;
  58. right: -16px;
  59. width: 42px;
  60. height: 44px;
  61. cursor: pointer;
  62. background: url("@/img/useDialogConfirm/close.png") no-repeat;
  63. background-size: cover;
  64. &:hover {
  65. background: url("@/img/useDialogConfirm/closeHover.png") no-repeat;
  66. background-size: cover;
  67. }
  68. }
  69. .headImg {
  70. width: 163px;
  71. height: 51px;
  72. position: absolute;
  73. left: 50%;
  74. top: -13px;
  75. transform: translate(-50%, 0);
  76. }
  77. .textCon {
  78. flex-grow: 1;
  79. display: flex;
  80. align-items: center;
  81. justify-content: center;
  82. padding: 0 20px;
  83. overflow: hidden;
  84. .text {
  85. font-size: 20px;
  86. color: #a04d11;
  87. line-height: 32px;
  88. }
  89. }
  90. .dialogBtn {
  91. flex-shrink: 0;
  92. display: flex;
  93. justify-content: center;
  94. margin-top: 6px;
  95. > img {
  96. width: 170px;
  97. height: 51px;
  98. cursor: pointer;
  99. margin-left: 12px;
  100. &:hover {
  101. opacity: $opacity-hover;
  102. }
  103. }
  104. }
  105. }
  106. </style>