<template>
    <div class="global-tip" v-if="state.is_show == 1">
        <img :src="require('@/assets/svg/icon-global-tip.svg')" alt="">
        <p>{{ state.msg }}</p>
    </div>
</template>
<script setup>
import { onMounted, reactive, defineProps } from "vue";
import { getAppNotification } from '@/http/messageApi.js'
let props = defineProps({
    type: String,
})
// 显示位置：1-红包主体，2-发布器，3-插件主体

let state = reactive({

})

onMounted(() => {
    getAppNotification().then((res) => {
        if (res.code == 0) {
            res.data.forEach((item) => {
                if (props.type == item.type) {
                    state.is_show = item.isShow
                    state.msg = item.message
                }
            })
        }
    })
})

</script>
<style lang="scss" scoped>
.global-tip {
    position: absolute;
    z-index: 3000;
    display: flex;
    height: 40px;
    background: #000000;
    opacity: 0.7;
    align-items: center;
    width: 100%;

    img {
        width: 15px;
        height: 15px;
        margin-left: 17px;
        margin-right: 10px;
    }

    p {
        color: #DCA550;
        flex: 1;
        margin: 0;
        padding: 0;
    }
}
</style>