<template>
    <nav-bar :navbar-data="navbarData"></nav-bar>
    <view class="auth-result">
        <view class="success" v-if="stauts == 'SUCCESS'">
            <image :src="imgHost +'/images/icon/paySucc.png'" alt="" class="image"></image>
            <view class="text">授权成功</view>
        </view>
        <view class="fail" v-if="stauts == 'FAIL'">
            <uni-icons type="clear" size="200" color="#FF3300"></uni-icons>
            <view class="text">用户已取消授权</view>
        </view>
        <button class="btn" @tap="goBack">确定</button>
    </view>
</template>

<script>
    import Utils from '@/utils/utils'
    import httpConfig from '@/utils/httpConfig'
    import NavBar from '@/components/navBar/index'
    const app = getApp()
    export default {
        components: {
            "nav-bar": NavBar
        },
        data() {
            return {
                navbarData: {
                    isGoHome: false,
                    isGoBack: false,
                    title: "授权结果"
                },
                imgHost: httpConfig.imgHost,
                height: app.globalData.height,
                stauts: ''
            }
        },
        onLoad(options) {
            //#ifdef MP-ALIPAY
            my.hideBackHome()
            //#endif
            console.log('authResult.page.options', options)
            if (options && options.authResult) this.stauts = options.authResult == 'SUCCESS' ? 'SUCCESS' : (params.authResult == 'CANCEL_AUTH' ? 'FAIL' : '')
            const page = getCurrentPages()
            console.log(page)
        },
        methods: {
            goBack() {
                uni.navigateBack()
            }
        }
    }
</script>

<style>
    page {
        display: flex;
        justify-content: center;
    }

    .auth-result {
        width: 100%;
        height: 650rpx;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-top: 300rpx
    }

    .auth-result image {
        width: 296rpx;
        height: 296rpx;
    }

    .text {
        font-size: 48rpx;
        text-align: center;
    }

    .btn {
        width: 300rpx;
        height: 88rpx;
        margin-top: 40rpx;
        color: #fff;
        background-color: #007AFF;
        border-radius: 8rpx;
    }
</style>