<template>
	<view class="">
		<navigation :showBack="false" :bgnum="true">
			<image src="../../../static/tongyonh/san.png" mode="aspectFit" class="renYou" slot="logo"
				@click="goCwallet()"></image>
			<image src="../../../static/tongyonh/erwei.png" mode="aspectFit" class="renYou2" slot="logo"
				@click="chooseImage()"></image>
			<text class="big_title">
				Wallet
			</text>
		</navigation>
		<view class="main">
			<view :class="{'money_con': userObj.coinList[0].xname=='Ethereum', 'money_con2': userObj.coinList[0].xname=='Bitcoin', 'money_con3': userObj.coinList[0].xname=='TRON'}">
				<image src="../../../static/tongyonh/ethereum.png" mode="aspectFit" class="imgicon" v-if="userObj.coinList[0].xname=='Ethereum'"></image>
				<image src="../../../static/tongyonh/Frame28.png" mode="aspectFit" class="imgicon"  v-if="userObj.coinList[0].xname=='Bitcoin'"></image>
				<image src="../../../static/tongyonh/tronicon.png" mode="aspectFit" class="imgicon"  v-if="userObj.coinList[0].xname=='TRON'"></image>
				<view class="textcon1 flex">
					<text class="text">{{this.userObj.coinList[0].name}}</text>
					<image src="../../../static/tongyonh/visibility_24px.png" mode="aspectFit" class="img1" @click="showMoney()" v-if="showMoney1"></image>
				<image src="../../../static/tongyonh/eyeno.png" mode="aspectFit" class="img1" @click="showMoney22()" v-if="showMoney2"></image>
				</view>
				<view class="textcon2" v-if="showMoney1">
					$0.00
				</view>
				<view class="textcon2" v-if="showMoney2">
					***
				</view>
				<view class="textcon3">
					{{this.userObj.address}}
				</view>
			</view>

			<view class="bot_con">
				<view class="title">
					Assets
				</view>
				<view class="item flexx" @click="goTrans()" v-for="item,index in this.userObj.coinList">
					<view class="left flex">
						<image :src="item.icon" mode="aspectFit" class="img1"></image>
						<view class="textcon">
							<view class="text1">								
							</view>
							<view class="text2">
								{{item.xname}}
							</view>
						</view>
					</view>
					<view class="rig">
						<view class="text1">
							0.00
						</view>
						<view class="text2">
							=$0.00
						</view>
					</view>
				</view>

			


			</view>



		</view>
		<tab-bar :selectActive="1"></tab-bar>
	</view>
</template>

<script>
	import cont from "@/components/navigation/navigation.vue"
	import token from "@/utils/TokenUtil"
	export default {
		data() {
			return {
				walletInfo:{},
				userObj:{},	
				showMoney1:true,
				showMoney2:false,
			}
		},
		onLoad() {
			this.setStorage();
		var a=uni.getStorageSync('wallet')
		console.log(a)
			if(a!=''){		
				console.log(1111)
				this.userObj=uni.getStorageSync('wallet');
				this.userObj.address = this.userObj.address.substring(0, 6)+'...'+this.userObj.address.substring(25,this.userObj.address.length);
			}
		},
		methods: {
			showMoney(){
				 this.showMoney1=false
				 this.showMoney2=true
			},
			showMoney22(){
				 this.showMoney1=true
				 this.showMoney2=false
			},
			setStorage() {
				this.walletInfo = uni.getStorageSync('walletInfo');
				this.userObj=this.walletInfo.BTC[0]
				this.userObj.address = this.userObj.address.substring(0, 6)+'...'+this.userObj.address.substring(25,this.userObj.address.length);
				console.log(this.walletInfo.BTC[0])
			},
			goTrans() {
				console.log(777777)
                let item = JSON.stringify(this.userObj)
				console.log(item,777777)
                uni.navigateTo({
                	url:'/pages/menu/token/btc/index?item='+item
                })
			},
			// 唤醒摄像头
			chooseImage() {
				var _this = this
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], //从相册选择、摄像头
					success: function(res) {
						_this.imgShow = res.tempFilePaths[0]
					}
				});
				// ass()
			},

			goCwallet() {
				uni.navigateTo({
					url: './cwallet/index'
				})
			}
		},

	};
</script>
<style scoped>
	page {
		background: #FAFAFA;
	}
</style>

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