<template>
    <div class="err-page-box" :style="{'background-color':pageBg}">
        <div class="err-img">
            <img :src="errIcon" />
        </div>
        <div clas="err-right" :style="{color: fontColor}">
            <div class="err-code">{{errType}}</div>
            <div class="err-message">{{errMessage}}</div>
            <el-button class="err-btn" type="primary" size="small" @click="goBack">{{backText}}</el-button>
        </div>
    </div>
</template>

<script>
export default {
    name: "ErrorPage",
    props: {
        pageBg: {
            type: String,
            default: '#F5F7F9'
        },
        errType: {
            type: Number | String,
            default: 403
        },
        errMessage: {
            type: String,
            default: '抱歉，你没有权限访问当前页面!'
        },
        errIcon: {
            type: String,
            default: 'http://cdn.gugusj.com/jbr_admin_docments/icon-403.svg'
        },
        errLink: {
            type: String,
            default: '/'
        },
        backText: {
            type: String,
            default: '返回首页'
        },
        fontColor: {
            type: String,
            default: ''
        }
    },
    methods: {
        goBack() {
            let url = this.errLink
            this.$router.replace(url)
        }
    }
}
</script>

<style lang="less" scoped>
    .err-page-box {
        display: flex;
        height: 100%;
        align-items: center;
        justify-content: center;
        .err-img {
            width:440px;
            height: auto;
            margin-right: 250px;
        }
        .err-right {
            color: #515a6e;
        }
        .err-code {
            margin-bottom: 24px;
            font-weight: 600;
            font-size: 72px;
            line-height: 72px;
        }
        .err-message {
            margin-bottom: 16px;
            font-size: 20px;
            line-height: 28px;
        }
    }
</style>