<template>
	<view>
		<!-- 私钥 -->
		<view class="keys">
			<view class="title">您已接收OC Chain托管</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: []
			};
		},
		mounted() {
			Promise.all([privatekey(this.$Route.query.password), keyrules()]).then(res => {
				let privatekey = res[0],
					keyrules   = res[1]
				this.key = privatekey.private_key
				this.rules = keyrules
			})
		},
		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: $mian-color;
			word-wrap: break-word;
		}
		.copykey{
			background-color: $mian-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-lg;
				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>
