<template>
	<view class="">
		<navigation :showBack="false" :bgnum="false">
			<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()"></image>
			<text class="big_title">
				{{i18n.Showprivatekey}}
			</text>
		</navigation>
		<view class="main">
	<view class="title">
		{{i18n.keepyourprivatekey}}
	</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>
					{{i18n.Showprivatekeytext}}
				</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>		
				{{i18n.ShowQRCode}}
				</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>
				{{i18n.ShowCopy}}
				</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">
				{{i18n.ScanQR}}
			</view>
			</view>
		
		   <view class="info_con green" :class="toTop?'goTop':''">
		   	<image src="../../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
		   {{i18n.CopyprivatekeySuccessful}}
		   </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: this.$t('index').Onemomentplease,
			// 二维码的数据
			show:true,
			show2:false,
			toTop:false,
			
			}
		},
	computed: {
				i18n() {
					return this.$t('index')
				},
			},
		methods: {
	back(){
		uni.reLaunch({
			url:'/pages/menu/wallet/mwallet/manage/index',
		})
	},
			showCode(){
				this.show2=true
				this.show=false
			},
			showText(){
				this.show2=false
				this.show=true
			},
			copyTextMethod() {
			// #ifdef H5
			    this.$copyText(this.userObj.privateKey).then(res => {
			     this.toTop=true;
				 setTimeout(()=>{
					  this.toTop=false;
				 },1500)
			    })
			    // #endif
			    // #ifdef APP-PLUS
				var that = this
			    uni.setClipboardData({
			     data: this.userObj.privateKey,
			success() {
				uni.hideToast()
				that.toTop = true;
				setTimeout(() => {
					that.toTop = false;
				}, 1500)
			}
			    })
			    // #endif
			},
		},
		onLoad: function() {
					this.userObj = uni.getStorageSync('keyInfo')
					this.ercodeText=this.userObj.privateKey
				}
	};
</script>
<style scoped>

</style>

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