content-dialog.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <script setup>
  2. import { watch, watchEffect } from 'vue'
  3. import AnimatedOverlay from '../../components/dialog/AnimatedOverlay.vue'
  4. import { usePhoneCheck, usePreLeaveInfo } from '../../utils/hooks.js'
  5. import ContentCard from './components/content-card.vue'
  6. import PhoneConfirmDialog from './components/PhoneConfirmDialog.vue'
  7. import PhoneEditDialog from './components/PhoneEditDialog.vue'
  8. import SubMitSuccess from './components/SubMitSuccess.vue'
  9. const props = defineProps({
  10. source: {
  11. type: String,
  12. default: '',
  13. required: true,
  14. },
  15. sourceDesc: {
  16. type: String,
  17. default: '',
  18. },
  19. popupTitle: {
  20. type: String,
  21. default: '联系专属客服,申请免费体验'
  22. },
  23. type: {
  24. type: String,
  25. default: '1'
  26. }
  27. })
  28. const {
  29. updateVisible,
  30. close,
  31. visible,
  32. configInfo,
  33. } = usePreLeaveInfo({ props })
  34. const config = {
  35. configInfo,
  36. props,
  37. }
  38. const {
  39. confirmPhoneDialog,
  40. changePhoneDialog,
  41. successCheckDialog,
  42. dialogEvents,
  43. checkPhonePass,
  44. contactMe
  45. } = usePhoneCheck({
  46. configInfo,
  47. props,
  48. // popupVisible: visible,
  49. })
  50. function contactMeEvent(phone) {
  51. configInfo.phone = phone
  52. contactMe()
  53. }
  54. function phoneEditConfirm(phone) {
  55. changePhoneDialog.phoneNumber = phone
  56. dialogEvents.phoneChangeConfirm()
  57. }
  58. defineExpose({
  59. updateVisible
  60. })
  61. </script>
  62. <script>
  63. export default {
  64. name: 'PCContentDialog',
  65. }
  66. </script>
  67. <template>
  68. <AnimatedOverlay
  69. class="pc-leave-dialog"
  70. :class="`pc-leave-dialog-${props.type}`"
  71. :visible="visible"
  72. @update:visible="updateVisible"
  73. >
  74. <ContentCard
  75. :config="config"
  76. @contactMeEvent="contactMeEvent"
  77. @close="updateVisible(false)"
  78. />
  79. <!-- 确认手机弹窗 -->
  80. <PhoneConfirmDialog
  81. :visible="confirmPhoneDialog.show"
  82. :title="confirmPhoneDialog.title"
  83. :content-text="confirmPhoneDialog.contentText"
  84. :confirm-button-text="confirmPhoneDialog.confirmButtonText"
  85. :cancel-button-text="confirmPhoneDialog.cancelButtonText"
  86. @confirm="dialogEvents.confirmPhoneConfirm"
  87. @cancel="dialogEvents.confirmPhoneCancel"
  88. />
  89. <!-- 修改手机号弹窗 -->
  90. <PhoneEditDialog
  91. :visible="changePhoneDialog.show"
  92. :phone="changePhoneDialog.phoneNumber"
  93. @confirm="phoneEditConfirm"
  94. @cancel="dialogEvents.phoneChangeCancel"
  95. />
  96. <!-- 提交成功弹窗 -->
  97. <SubMitSuccess
  98. :visible="successCheckDialog.show"
  99. :title="successCheckDialog.title"
  100. :content-text="successCheckDialog.contentText"
  101. :confirm-button-text="successCheckDialog.confirmButtonText"
  102. @confirm="dialogEvents.successConfirm"
  103. />
  104. </AnimatedOverlay>
  105. </template>
  106. <style scoped lang="scss">
  107. .pc-leave-dialog {
  108. ::v-deep {
  109. .overlay-content {
  110. margin: 300px auto;
  111. width: 732px;
  112. // background: #fff;
  113. border-radius: 8px;
  114. }
  115. }
  116. &-2 {
  117. ::v-deep {
  118. .overlay-content {
  119. width: 480px;
  120. }
  121. }
  122. }
  123. }
  124. </style>