<template>
    <Cn-page :loading="loading">
        <view slot="body">
            <view class="transfer">
                <!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
                <uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }" :loading="false"></uqrcode>
                <canvas id="qrcode" width="200" height="200"></canvas>
                <view class="transfer-text">{{ userInfo.nickname }}</view>
                <!-- <view class="transfer-btn">
                    <button class="transfer-btn-item" style="background-color: #fff; color: #111" @click="back">
                        返回
                    </button>
                    <button class="transfer-btn-item ml20" @click="home">转移成功</button>
                </view> -->
            </view>
        </view>
    </Cn-page>
</template>
<script>
// import QRCode from 'qrcodejs2'
// import UQRCode from '@/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';

export default {
    data() {
        return {
            loading: false,
            content: '',
            userInfo: {},
        }
    },
    methods: {
        back() {
            this.$util.refreshPrePage(2)
        },
        home() {
            this.$util.refreshPrePage(2)
        },
    },
    onLoad(options) {
        this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
        this.content = JSON.stringify({
            type: 'userId',
            id: this.userInfo.userIndex,
        })
    },
}
</script>
<style lang="scss">
.transfer {
    padding: 200rpx 34rpx 0;
    display: flex;
    flex-direction: column;
    align-items: center;

    .transfer-img {
    }

    .transfer-text {
        font-size: 28rpx;
        color: #999999;
        margin-top: 30rpx;
    }

    .transfer-btn {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 100rpx;
        width: 100%;

        .transfer-btn-item {
            flex: 1;
            height: 80rpx;
            border-radius: 12rpx;
            background-color: $uni-theme-color;
            font-size: 28rpx;
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }
}
</style>
