<template>
	<u-popup :show="show" mode="left" @close="close" @open="open">
		<view class="popupBox">
			<view class="cancel" @click="close">
				<image src="/static/img/img13.png"></image>
			</view>
			<view class="listBox">
				<view class="listTpl flex_item"  v-for="item,index in list" :key="index" :class="{ atcive: currTab == index }" @click="navTo(item.url,index)">
					<image class="icon" :src="item.icon" mode="widthFix"></image>
					<view class="name">{{item.name}}</view>
				</view>
			</view>
		</view>
	</u-popup>
</template>
<script>
	export default {
		props:['currTab'],
		data() {
			return {
				show: false,
				list:[]
			}
		},
		mounted() {},
		methods: {
			open(){
				this.list = [{
					name:'Home',
					icon:'/static/img/img14.png',
					url:'/pages/index/index'
				},{
					name:'BF swap',
					icon:'/static/img/img15.png',
					url:''
				},{
					name:this.$t('indexs.i2'),
					icon:'/static/img/img16.png',
					url:'/pages/supermarket/index'
				},{
					name:this.$t('indexs.i3'),
					icon:'/static/img/img17.png',
					url:''
				},{
					name:this.$t('indexs.i4'),
					icon:'/static/img/img19.png',
					url:'/pages/diagram/index'
				},{
					name:this.$t('indexs.i7'),
					icon:'/static/img/img25.png',
					url:''
				},
				{
					name:this.$t('indexs.i5'),
					icon:'/static/img/img18.png',
					url:'https://t.me/Benfolds_cn'
				}]
				this.show = true
			},
			// 关闭弹窗
			close() {
				this.show = false
			},
			navTo(url,index){
				this.show = false
				if(index == 6){
					window.open(url)
				}else{
					if (url == "") {
						let url = '/pages/404/index?index='+index
						uni.navigateTo({
							url,
							fail() {
								uni.switchTab({
									url,
								});
							},
						});
					} else {
						uni.navigateTo({
							url,
							fail() {
								uni.switchTab({
									url,
								});
							},
						});
					}
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.popupBox{
		width: 522rpx;
		height: 100%;
		background: #111111;
		padding-left: 50rpx;
		padding-right: 43rpx;
		.cancel{
			width: 100%;
			text-align: right;
			margin: 82rpx 0rpx 125rpx 0rpx;
			image{
				width: 30rpx;
				height: 30rpx;
			}
		}
		.listBox{
			.listTpl{
				font-size: 32rpx;
				color: #FFFFFF;
				padding: 25rpx 30rpx;
				margin-bottom: 20rpx;
				.icon{
					width: 44rpx;
					height: 43rpx;
				}
				.name{
					padding-left: 29rpx;
				}
			}
			.atcive{
				box-shadow: -4rpx -4rpx 13rpx 0rpx rgba(168,168,206,0.13), 4rpx 4rpx 7rpx 3rpx rgba(0,0,0,0.4);
				border-radius: 10rpx;
				color: #FFCC12 !important;
			}
		}
	}
</style>
