<template>
	<view class="container">
		<view class="search" style="width: 100%; margin-bottom: 60rpx;">
			<u-search placeholder="請輸入代幣名稱進行搜索" v-model="assetsvalue" :showAction="false" height="80rpx"
				bgColor="#f6f6f6"></u-search>
		</view>
		<!-- assets -->
		<view class="moneylist">
			<view class="moneyitem" v-for="(item,index) in assetsList" :key="index" @click="tomyassets">
				<view class="item_ri">
					<view class="name">
						<view class="">
							{{item.name}}
						</view>
					</view>
					<view class="number">
						<u-icon name="arrow-right" color="#fff" size="14"></u-icon>
					</view>
				</view>
			</view>
		</view>
		<view class="popular">
			<view class="" style="margin-bottom: 30rpx;">
				熱門代幣
			</view>
			<!-- 			<view class="p_top" v-if="warnval">
				<u-icon name="error" color="#EAA97D" size="18"></u-icon>
				<view class="tit">
					請注意，鏈上資料分析僅供參考，不構成任何建議
				</view>
				<u-icon style="margin-left: 2rpx;" name="close" color="#EAA97D" size="15"
					@click="warnval = false"></u-icon>
			</view> -->
			<!-- 代幣列表 -->
			<scroll-view scroll-y="true" style="height: 93%;">
				<view class="moneyitem" v-for="item in 8">
					<view class="item_le">
						<image src="/static/wallet7.png" mode="heightFix"></image>
					</view>
					<view class="item_ri">
						<view class="name">
							<view class="">
								ETH
							</view>
							<view style="margin-top: 22rpx; font-size: 25rpx;">
								<text style="color: #9B97B9;">️{{userMoneyAdressOptions(userMoneyAdress)}}</text>
							</view>
						</view>
						<view class="number" style="margin-top: 25rpx;">
							<image src="/static/assadd.png" mode=""></image>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				assetsvalue: '',
				assetsList: [{
					name: '首頁資產'
				}, {
					name: '我的資產'
				}],
				warnval: true,
				userMoneyAdress: '0x8622572752752752752727527527FDc3675',
			};
		},
		methods: {
			tomyassets() {
				uni.navigateTo({
					url: '/pages/wallet/myassets',
				});
			},
			userMoneyAdressOptions(data) {
				let start = data.substring(0, 14);
				let end = data.substring(data.length - 4);
				let middle = "…";
				let finalString = start + middle + end;
				return finalString
			},
		}
	}
</script>

<style lang="scss">
	.container {
		border-top: 1px solid dimgrey;
		width: 100vw;
		min-height: 100vh;
		padding: 20px;
		box-sizing: border-box;
		background: linear-gradient(to bottom, #000033, #51599b);

		image {
			width: 100%;
			height: 100%;
		}

		.moneylist {
			background-color: #392e7f;
			padding: 30rpx;
			border-radius: 20rpx;

			.moneyitem {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 20rpx;

				.item_ri {
					width: 100%;
					height: 100rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					border-bottom: 2rpx solid #534a84;

					.name {
						color: #fff;
						display: flex;
						flex-direction: column;
						padding-bottom: 10rpx;
						box-sizing: border-box;
					}
				}
			}
		}

		.popular {
			background-color: #392e7f;
			padding: 30rpx;
			border-radius: 20rpx;
			height: 800rpx;
			color: #fff;
			margin-top: 30rpx;

			.p_top {
				display: flex;
				align-items: center;
				justify-content: space-between;
				background-color: #fdf7f2;
				width: 100%;
				height: 60rpx;
				font-size: 28rpx;
				border-radius: 20rpx;
				margin-bottom: 30rpx;
				padding: 0 20rpx;
				box-sizing: border-box;

				.tit {
					color: #EAA97D;
					font-size: 24rpx;
				}
			}

			.moneyitem {
				display: flex;
				justify-content: space-between;
				margin-bottom: 50rpx;
				align-items: center;

				.item_le {
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
				}

				.item_ri {
					width: 520rpx;
					height: 100rpx;
					display: flex;
					justify-content: space-between;
					border-bottom: 2rpx solid #534a84;

					.name {
						color: #fff;
						display: flex;
						flex-direction: column;
						padding-bottom: 10rpx;
					}

					.number {
						width: 40rpx;
						height: 40rpx;
					}
				}
			}
		}
	}
</style>