<template>
	<view class="container">
		<view class='qr-wrap' v-if='qrstatus==true&&show==1'>
			<view>
				<image :src='qrcode'></image>
			</view>
			<text>扫一扫上面的二维码</text>
		</view>
		<view class='no-qrcode' v-if='show==0'>当前暂无可用二维码</view>
	</view>
</template>

<script>
	import uploadImage from '@/components/ossutil/uploadFile.js';
	import uniNumberBox from '@/components/uni-number-box.vue';
	import {  
        mapState 
    } from 'vuex';
	export default {
		components: {
			uniNumberBox
		},
		data() {
			return {
				qrstatus:false,
				qrcode:"",
				show:1,
			}
		},
		onShow() {
		},
		onLoad(options) {
			const that = this

			that.$api.request('user', 'getQrCode', {
			}, failres => {
				that.$api.msg(failres.errmsg)
				uni.hideLoading()
			}).then(res => {
				if(res.data=='error'){
					that.show=0
				}else{
					that.qrstatus=true
					that.qrcode = res.data
				}
			})
		},
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		methods: {
		}
	}
</script>
<style lang='scss' scoped>
	.container {
		background: $page-color-base;
		padding-bottom: 160upx;
	}
	.qr-wrap{
		text-align:center;
		height:100vh;
	}
	.no-qrcode{
		text-align: center;
		line-height: 100vh;
		height: 100vh;
	}
</style>
