<template>
<Row type="flex" justify="end"  align="middle">
    <Col v-if="isShowDivider">
        <Divider  type="vertical" style="margin:1px 12px 0 12px; height:32px;" />
    </Col>
    <Col v-if="showHelpBtn">
        <p  @click="openHelp" style="cursor:pointer;height:32px;line-height: 32px;">
            <Row type="flex" justify="start" align="middle">
                <Icon custom='iconfont icon-custom-help' size="16" />  <span style="margin-left: 4px;">帮助中心</span>
            </Row>
        </p>
    </Col>
    <Col v-if="modulecodeFlag && showHelpBtn">
        <Divider  type="vertical" style="margin:1px 12px 0 12px; height:32px;" />
    </Col>
    <Col v-if="modulecodeFlag">
        <div class="modulecodetext">
            <span> {{modulecode}} </span>
        </div>
    </Col> 
</Row>
</template>

<script>
export default {
    name:'mpromptmessage',
    props:{
        modetype: {
            type:String,
            default:'1'
        },
    },
    data() {
        return {
            modulecodeFlag:false,
            modulecode:'',
            showHelpBtn:false,
            curHelpUrl:''
        };
    },
    computed: {
        isShowDivider() {
            if (this.showHelpBtn && this.modetype === '1') {
                return true;
            } else {
                return false;
            }
        }
    },
    created () {
        // 处理模块号提示
        this.modulecode = this.$Method.getUrlParam('modulecode');
        if (!this.modulecode) {
            this.modulecode = this.$Method.getUrlParam('billmoduleid');
        }
        if (this.modulecode) {
            this.modulecodeFlag = true;
        }
        //处理帮助
        let self = this;
        this.curHelpUrl = this.OmdUrl.getCurHelpUrl(self);
        if (this.curHelpUrl) {
            this.showHelpBtn = true;
        }
    },
    methods:{
        openHelp () {
            if (this.curHelpUrl) {
                window.open(this.curHelpUrl);
            }
        }
    }
};
</script>