publish.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!-- 发布弹窗 -->
  2. <template>
  3. <div class="main_app">
  4. <give-dialog
  5. :dialogData="dialogData"
  6. @close="close"
  7. @postPublishFinish="finish" ></give-dialog>
  8. <select-publish-content
  9. :visible="selectVisible"
  10. @close="hideSelectDialog"
  11. @select="selectPublishType"></select-publish-content>
  12. </div>
  13. </template>
  14. <script setup>
  15. import { ref, reactive } from "vue";
  16. import giveDialog from "@/view/iframe/publish/give-dialog.vue";
  17. import selectPublishContent from "@/view/iframe/publish/components/select-publish-content.vue";
  18. let dialogData = reactive({
  19. visible: false,
  20. type: 'REDPACKET'
  21. });
  22. let selectVisible = ref(false);
  23. const close = () => {
  24. dialogData.visible = false;
  25. hideIframe();
  26. };
  27. const finish = (params) => {
  28. close();
  29. window.parent.postMessage({ actionType: "IFRAME_SHOW_TWITTER_PUBLISH_DIALOG", publishRes: params.publishRes }, "*");
  30. };
  31. const hideIframe = () => {
  32. window.parent.postMessage({ actionType: "IFRAME_HIDE_IFREME" }, "*");
  33. };
  34. const hideSelectDialog = () => {
  35. close();
  36. }
  37. const selectPublishType = (params) => {
  38. selectVisible.value = false;
  39. dialogData.visible = true;
  40. dialogData.type = params.type;
  41. }
  42. window.addEventListener("message", function (event) {
  43. let eventData = event.data;
  44. if (eventData && eventData.actionType == "CONTENT_SHOW_GIVE_DIALOG") {
  45. window.parent.postMessage({ actionType: "IFRAME_SHOW_IFREME" }, "*");
  46. let {type = 'REDPACKET'} = eventData.data || {};
  47. if(type != 'SHOW_SELECT') {
  48. dialogData.visible = true;
  49. dialogData.type = type;
  50. } else {
  51. selectVisible.value = true;
  52. }
  53. }
  54. });
  55. </script>
  56. <style>
  57. html, body {
  58. background-color: rgba(255,255,255,0)!important;
  59. line-height: unset !important;
  60. }
  61. </style>