<!-- 发布弹窗 -->
<template>
    <div class="main_app">
        <give-dialog
            :dialogVisible="dialogVisible"
            @close="close"
            @payPalFinsh="payPalFinsh"
        ></give-dialog>
    </div>
</template>

<script setup>
import { ref } from "vue";
import giveDialog from "@/view/iframe/publish/give-dialog.vue";

let dialogVisible = ref(false);

const close = () => {
    dialogVisible.value = false;
    hideIframe();
};

const payPalFinsh = (params) => {
    close();
    window.parent.postMessage({ actionType: "IFRAME_SHOW_TWITTER_PUBLISH_DIALOG", publishRes: params.publishRes }, "*");
};

const hideIframe = () => {
    window.parent.postMessage({ actionType: "IFRAME_HIDE_IFREME" }, "*");
};

window.addEventListener("message", function (event) {
    console.log("addEventListener", event);
    if (event.data && event.data.actionType == "CONTENT_SHOW_GIVE_DIALOG") {
        window.parent.postMessage({ actionType: "IFRAME_SHOW_IFREME" }, "*");
        dialogVisible.value = true;
    }
});
</script>

<style>
html, body {
    background-color: rgba(255,255,255,0)!important;
    line-height: unset !important;
}
</style>
