<template>
    <div class="page">
        <img class="img" :src="statusInfo.img" alt="" />
        <div class="title">{{ statusInfo.title }}</div>
        <div class="sub">
            {{ statusInfo.sub }}
        </div>

        <div class="btn" v-if="statusInfo.showBtn">
            <van-button type="primary" block round @click="$router.replace('/Authentication')"> 重新认证 </van-button>
        </div>
    </div>
</template>

<script>
import { mapState } from 'vuex';
export default {
    computed: {
        ...mapState(['userInfo']),
        statusInfo() {
            return this.info.FAIL;
            // if (this.userInfo && this.userInfo.authStatus) {
            //     return { ...this.info }[this.userInfo.authStatus];
            // } else {
            //     return this.info.PENDING;
            // }
        }
    },
    data() {
        return {
            info: {
                PENDING: {
                    img: require('@assets/png-renzhengchenggong.png'),
                    title: '身份验证成功',
                    sub: '平台将于3日内完成资料审核，平台内通知审核结果',
                    showBtn: false
                },
                FAIL: {
                    img: require('@assets/png-renzhengshibai.png'),
                    title: '身份验证失败',
                    sub: '很遗憾，您的认证失败，请检查您填写的资料是否正确',
                    showBtn: true
                }
            }
        };
    },
    beforeRouteEnter(to, from, next) {
        next(vm => {
            vm.$store.dispatch('getUserInfo');
        });
    }
};
</script>

<style lang="less" scoped>
.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 30px;
    background-color: @bg3;

    .img {
        width: 120px;
        display: block;
    }

    .title {
        font-size: 20px;
        color: #fff;
        line-height: 30px;
        margin-top: 38px;
        font-weight: bold;
    }
    .sub {
        font-size: 12px;
        color: #6a6d83;
        line-height: 24px;
        margin-top: 4px;
        text-align: center;
    }

    .btn {
        margin-top: 60px;
        width: 100%;
    }
}
</style>
