header-title.vue 3.44 KB
<template>
<div>
    <h3 class="chart-public-header">
        <div class="box">
            <i class="ivu-icon ivu-icon-chevron-left" v-if="rPage" @click="jumpPage"></i>
            <p class="main-title" :class="{rowHeight: !subTitle.hasSub}">{{title}}<i class="ivu-icon ivu-icon-ios-help-outline" @click="isShow = true" v-if="isShowHelp"></i></p>
            <p v-if="subTitle.hasSub" class="sub-title">{{subTitle.title}}</p>
        </div>
    </h3>
    <div class="mask" v-if="isShow">
        <div class="help-text">
            <i class="ivu-icon ivu-icon-close-round" @click="isShow = false"></i>
            <div v-html="helpText"></div>
        </div>
    </div>
</div>
</template>
<script>
export default {
    name: 'header-title',
    props: ['title', 'helpText', 'subTitle', 'noReturn'],
    data() {
        return {
            isShow: false,
            rPage: true,
            isShowHelp: true
        };
    },
    created() {
        this.rPage = this.noReturn ? false : this.rPage;
        this.isShowHelp = this.helpText ? true : false;
    },
    methods: {
        jumpPage() {
            window.history.go(-1);

            if (this.title == '各端口趋势') {
                this.$store.remove('channel');
            }
        }
    }
}
</script>
<style lang="scss">
    .detail-header {
        margin: 1.3rem 0 1.3rem !important;
        border: none !important;
    }

    .chart-public-header {
        color: #fff;
        display: block;
        width: 100%;
        height: 2px;
        position: relative;
        border-top: 1px solid #fff;
        margin: 60px 0;

        .ivu-icon-chevron-left {
            position: absolute;
            left: 4px;
            top: 6px;
            font-size: 30px;
            color: #ffffff;
            background: #FFC107;
            border-radius: 50%;
            width: 46px;
            height: 46px;
            line-height: 46px;
        }

        .box {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 90%;
            height: 60px;
            text-align: center;
            border-radius: 30px;
            background: #FF641C;
            position: absolute;
            left: 5%;
            top: 50%;
            margin-top: -30px;
            font-size: 18px;
            box-sizing: border-box;
        }

        .sub-title {
            font-size: 12px;
        }

        .main-title {
            display: flex;
            align-items: center;
        }

        .rowHeight {
            line-height: 60px;
        }

        .ivu-icon-ios-help-outline {
            margin-left: 5px;
            font-size: 21px;
        }
    }

    .help-text {
        width: 336px;
        background: #fff;
        border-radius: 8px;
        position: absolute;
        padding: 15px;
        line-height: 21px;
        font-size: 13px;
        z-index: 6;
        height: 500px;
        overflow: auto;
        display: block;
        left: 50%;
        top: 50%;
        margin-left: -168px;
        margin-top: -250px;


        .ivu-icon {
            font-size: 20px;
            position: absolute;
            right: 16px;
            top: 15px;
            color: #9f9f9f;
        }

        h2 {
            color: #ff641c;
        }
    }

    .mask {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 5;
    }
</style>