<template>
	<view class="">
		<navigation :showBack="true">
			Backup mnemonics
		</navigation>
		<view class="main">
		<view class="title">
			Please copy the helper words in<br>the correct order
		</view>
		<view class="mnemonic">
		    <view class="mnemonicBlock u-rela" v-for="(item,index) in mnemonics" :key="index">
		     <text>{{ item }}</text>
		     <view class="number u-abso" v-text="index+1<10 ? ((index+1)) : index+1"></view>
		    </view>
		   </view>
		<view class="title2">
			The booster words will be used for wallet asset recovery, please copy the booster words in the correct order and keep them in a safe place and do not disclose them to others
		</view>
		<u-button  class="custom-style" @click="test">I have copied it</u-button>
		  </view>
	
		</view>
	</view>
	
</template>

<script>
	import cont from "@/components/navigation/navigation.vue"
	import token from '@/utils/TokenUtil'
	export default {
		data() {
			return {
			mnemonics:[],
			goWhat:false,
			};
		},
		methods: {
			// 获取词语
		   getWrod(){
			 var walletInfo = uni.getStorageSync('word');
			 console.log(walletInfo)
			 console.log(walletInfo,44444444)
			 this.mnemonics=walletInfo.split(' ')
			 console.log(this.mnemonics)
		   },
		   getWrod2(){  
			   uni.setStorageSync('word',this.userObj.mnemonic);
		   			 this.mnemonics=this.userObj.mnemonic.split(' ')
		   			 console.log(this.mnemonics,88888)
		   },
		   test(){
			   if(this.goWhat){
				uni.navigateTo({
					url:'../backUpWord/index',
				})   
			   }else{
				uni.navigateTo({
					url:'../backUp3/index',
				})   
			   }
		   },
		
		},
		onLoad(option) {
			var walletInfo = new Object();
			walletInfo =uni.getStorageSync('word')
			if(walletInfo == ''){
				uni.reLaunch({
					url:'/pages/register/index'
				})
			}
		   if(JSON.stringify(option) != "{}"){
			  const item = JSON.parse(option.item);
			  console.log(item,7777777)
			  this.userObj = item 
			  this.goWhat=true;
			  this.getWrod2()
		   }else{
			   console.log(11111111)
			   this.getWrod()
		   }
		},
	};
</script>
<style scoped>
	.custom-style {
		height: 112rpx;
		text-align: center;
		 color: #fff;
		background-color: #5B53FF !important;
		 border-radius: 40rpx;
		 margin-top: 90rpx;
	}
	.u-default-hover{
		background-color: #5B53FF !important;
		border-radius: 40rpx !important;
		color: #fff !important;
		border: none;
	}
</style>

<style>

	@import './index.css';

</style>
