<template>
	<view>
		<!-- 私钥 -->
		<view class="keys">
			<view class="title">您的ZH托管钱包</view>
			<view class="key">{{key || '-'}}</view>
			<view class="copykey" @click="copykey">复制我的私钥</view>
		</view>
		<!-- 疑问 -->
		<view class="doubt" v-if="rules.length > 0">
			<view class="doubt-item" v-for="(item, index) in rules" :key="index">
				<view class="title">{{item.title || '-'}}</view>
				<view class="content">{{item.description || '-'}}</view>
			</view>
		</view>
		<!-- 免责说明 -->
		<!-- <view class="liability">
			<navigator url="/pages/wallet/cmsWithDraw">免责条款</navigator>
		</view> -->
	</view>
</template>

<script>
	import { privatekey, keyrules } from '@/apis/interfaces/wallet'
	export default {
		data() {
			return {
				key: "",
				rules: [
					{
						title: "什么是托管钱包？",
						description: "托管钱包顾名思义就是用户把私钥和数字资产委托给其他机构管理，也就是就是通过中心化的方式安全管理并保存资产，本质上是与区块链所追求的去中心化相背离的。"
					},
					{
						title: "什么是钱包私钥？",
						description: "作为管理和使用加密货币最关键的东西，私钥对所有数字货币用户而言具有所有权，拥有私钥才能支配相应的加密资产。"
					}
				]
			};
		},
		mounted() {
			privatekey(this.$Route.query.password).then(res => {
				this.key = res.private_key
			}).catch(err => {
				uni.showToast({
					title: err.message,
					icon : 'none'
				})
			})
		},
		methods:{
			copykey(){
				uni.setClipboardData({
					data: this.key
				})
			}
		}
	}
</script>

<style lang="scss">
	.keys{
		margin: $margin * 2;
		background: white;
		padding: $padding * 2;
		box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
		border-radius: $radius;
		.title{
			text-align: center;
			font-weight: bold;
			font-size: $title-size + 4;
			color: $text-color;
		}
		.key{
			padding: $padding * 2 0;
			text-align: center;
			color: $main-color;
			word-wrap: break-word;
		}
		.copykey{
			background-color: $main-color;
			color: white;
			height: 95rpx;
			line-height: 95rpx;
			text-align: center;
			font-size: $title-size;
			border-radius: $radius-m;
			font-weight: bold;
		}
	}
	.doubt{
		margin: $margin $margin * 2;
		.doubt-item{
			padding: $padding 0;
			.title{
				font-weight: bold;
				color: $text-color;
				line-height: 50rpx;
				font-size: $title-size + 2;
			}
			.content{
				color: $text-gray;
				font-size: $title-size-m;
				line-height: 40rpx;
			}
		}
	}
	.liability{
		text-align: center;
		color: $text-gray;
		@extend .ios-bottom;
		navigator{
			font-size: $title-size-sm;
			display: inline-block;
			line-height: 90rpx;
			padding: 0 ($padding * 2);
		}
	}
</style>
