<template>
	<view class="">
		<navigation :showBack="true" :bgnum="false">
			<text class="big_title">
				Show private key
			</text>
		</navigation>
		<view class="main">
	<view class="title">
		Please keep your private key. Anyone who gets your private key can control your account, including transferring all funds.
	</view>
		
		
		
		<view class="btnconn" >
				<view class="btn"  @click="showText" :class="show?'active':''">
					<image src="../../../../static/tongyonh/insert_drive_file_24px.png" mode="aspectFit" class="img1" v-if="show2"></image>	
					<image src="../../../../static/tongyonh/insert_drive_file_24px_outlined.png" mode="aspectFit" class="img1" v-if="show"></image>
					Text
				</view>
				<view class="btn"   @click="showCode" :class="show2?'active':''">
					<image src="../../../../static/tongyonh/Frame300.png" mode="aspectFit" class="img1" v-if="show"></image>
				<image src="../../../../static/tongyonh/codeci.png" mode="aspectFit" class="img1" v-if="show2"></image>		
				QR Code
				</view>
			</view> 
			
			
			<view class="bottom_con" v-if="show" >
				<view class="top">
					{{this.userObj.privateKey}}
				</view>
				<view class="bottom" @click="copyTextMethod()">
					<image src="../../../../static/tongyonh/copy_24px_outlined.svg" mode="aspectFit" class="img1"></image>
					Copy
				</view>
			</view>
			
			
			<view class="code_con" v-if="show2">
		<view class="cond">
			<tki-qrcode ref="qrcode" :val="ercodeText" :size="size" :unit="unit" :background="background"
				:foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval" :loadMake="loadMake"
				:showLoading="showLoading" :loadingText="loadingText" :icon="icon" class="test" />
		</view>		
			<view class="text">
				Scan the QR code to ....
			</view>
			</view>
		
		   
		
	</view>
	
		</view>
</view>



</template>

<script>
	import cont from "@/components/navigation/navigation.vue"
	import tkiQrcode from "tki-qrcode"
	export default {
		components: {
			tkiQrcode
		},
		data() {
			return {
	   msg:'',
	        msgLength:0,
			fes:false,
			borNum:true,
			userObj:{},
			// 二维码的数据
			showErweiMask: false,
			ercodeText: '',
			size: 400,
			background: '#ffffff',
			foreground: '#000000',
			pdground: '#000000',
			iconsize: 30,
			lv: 3,
			onval: true,
			unit: 'upx',
			loadMake: true,
			icon: '',
			showLoading: true,
			loadingText: 'One moment please',
			// 二维码的数据
			show:true,
			show2:false
			
			
			}
		},

		methods: {
			showCode(){
				this.show2=true
				this.show=false
			},
			showText(){
				this.show2=false
				this.show=true
			},
			copyTextMethod() {
			// #ifdef H5
			    this.$copyText(this.userObj.privateKey).then(res => {
			     uni.showToast({
			      title: 'Copy Success',
			      icon: 'success'
			     })
			    })
			    // #endif
			    // #ifdef APP-PLUS
			    uni.setClipboardData({
			     data: this.userObj.privateKey,
			     success() {
					 uni.showToast({
					  title: 'Copy Success',
					  icon: 'success'
					 })
			     }
			    })
			    // #endif
			},
		},
		onLoad: function(option) {
					const item = JSON.parse(option.item);
					console.log(item,777)
					this.userObj = item
					this.ercodeText=this.userObj.privateKey
				}
	};
</script>
<style scoped>

</style>

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