<template>
	<view class="">
  <balance @send="getSonValue" :currencySymbol="currencySymbol" :currentBalance="currentBalance"></balance>
     <view class="index-body">
     	<view class="index-body-p1">
     		Game
     	</view>
		<view class="index-body-img" @click="goColor">
			<image src="../../../static/home/bg_color@2x.png" mode=""></image>
		</view>
     </view>
		
	</view>

</template>

<script>
	import Vue from 'vue';
		import balance from "@/components/balance/balance.vue"
		import api from '@/utils/api'
	export default {
		data() {
			return {
			currencySymbol:'',
			currentBalance:'',
			}
		},
		onLoad() {
            this.currencySymbol=uni.getStorageSync('siteInfo').currencySymbol;
			const post = api.withdrawConfig({
				"ticket": uni.getStorageSync('logInfo').data,
			})
			post.then(res => {
				if(res.data!=undefined){
					this.currentBalance=res.data.currentBalance;
					uni.setStorage({
						key: 'currentBalance',
						data: this.currentBalance,
						success: function() {
							console.log('success')
						}
					});
				}
			
				})
				.catch(e => {
					console.log(e)
				})
				
				
				
				const post2 = api.userInfo({
					"ticket": uni.getStorageSync('logInfo').data,
				})
				post2.then(res => {
						uni.setStorage({
							key: 'MyInfo',
							data: res.data,
							success: function() {
								console.log('success')
							}
						});
						console.log(res.data)
					})
					.catch(e => {
						uni.showToast({
							title: e,
							icon: 'none',
							duration: 2500
						})
					})
		
		},
		methods: {
			getSonValue(){
					  uni.navigateTo({
					  	url:'../recharge/index'
					  })
			},
			
			goColor(){
				uni.navigateTo({
					url:'../color/index'
				})
			},
		}
	}
</script>

<style>
	@import './index.css';
	

</style>
