<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="authStatus === '认证失败'">
            <van-button type="primary" block plain round @click="$router.replace('/Authentication')">
                重新申请
            </van-button>
        </div>
    </div>
</template>

<script>
import { mapState } from 'vuex';
export default {
    computed: {
        ...mapState(['userInfo']),
        statusInfo() {
            if (this.userInfo.authStatus) {
                return { ...this.info }[this.userInfo.authStatus];
            } else {
                return {};
            }
        }
    },
    data() {
        return {
            info: {
                PENDING: {
                    img: require('../../assets/shenqing_shenhezhong.png'),
                    title: '资料审核中',
                    sub: '平台将于3日内完成资料审核，并将审核结果以短信的形式通知您'
                },
                FAIL: {
                    img: require('../../assets/shenqing_weitongguo.png'),
                    title: '资料审核失败',
                    sub: '很遗憾，您的资料审核失败，请检查您填写的资料是否正确以及上传照片是否清晰'
                }
            }
        };
    },
    mounted() {
        this.$store.dispatch('getUserInfo');
    }
};
</script>

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

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

    .title {
        font-size: 20px;
        color: #ffffff;
        line-height: 30px;
        margin-top: 38px;
    }
    .sub {
        font-size: 14px;
        color: #939599;
        line-height: 24px;
        margin-top: 16px;
        text-align: center;
    }

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