<template>
    <view class="container" v-if="text.length"><!--  bgColor="#EFF4FA" color="#333" -->
        <u-notice-bar direction="column" mode="link" fontSize='3.733vw' :text="text" @click="onClick" />
    </view>
</template>

<script>
export default {
    name: 'notice',
    data() {
        return {
            text: []
        };
    },
    created() {
        this.$Http.updateMessage = this.getList.bind(this);
    },
    methods: {
        getList() {
            this.$Http.basic({
                "classname": "system.message.Message",
                "method": "queryMessage",
                "content": {
                    "nocache": true,
                    "pageNumber": 1,
                    "pageSize": 3,
                    "pageTotal": 1,
                    "type": "应用",
                    "where": {}
                }
            }).then(res => {
                console.log("滚动消息", res)
                if (this.cutoff(res.msg)) return;
                if (res.data.length) this.text = res.data.map(v => v.message)
                // this.text = ["4v电池电量告警！当前设备“4V电池电量”值为“90”，<100时触发警告", '上游压力异常告警！当前设备“上游当前压力”值为“3”<5时触发警告', '下游压力异常告警！当前设备“下游当前压力”值为“5”，<10时触发警告']
            })
        },
        onClick(index) {
            console.log(index)
        }
    }
}
</script>

<style lang="scss" scoped>
.container {

    /deep/ .uicon-volume span,
    /deep/ .uicon-arrow-right span {
        font-size: 3.733vw;
    }
}
</style>
