<template>
	<view>
		<!-- <scroll-view scroll-y class="DrawerPage" :class="modalName=='viewModal'?'show':''" >
		</scroll-view> -->
		<view class="DrawerClose" :class="modalName=='viewModal'?'show':''" @tap="hideModal">
			<text class="cuIcon-pullright"></text>
		</view>
		<scroll-view scroll-y class="DrawerWindow" :class="modalName=='viewModal'?'show':''" @tap="showModal" data-target="viewModal"
		 :style="{'margin-top':marginright}">
			<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg" >
				<view class="cu-item arrow" v-for="(item,index) in plusDrawerList" :key="index" @tap="pushWindPowerStationNameToSessionStorage(item.name,item.windPowerStationId);" style=" background-color: #272727; border-bottom: 1rpx solid #1F1F1F;">
					<view class="content">
						<!-- <text class="cuIcon-github text-grey"></text> -->
						<text class="text-grey">{{item.name}}</text>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				modalName: null,
				plusDrawerList: [],
				width: '',
				windPowerStationId: '',
				listWidth: '',
				marginright: ''
			};
		},
		onLoad() {
			this.windpowerstationIds = JSON.parse(uni.getStorageSync('windpowerstationNames'));
			uni.showLoading({
				title: '加载中...',
				mask: true,
			});
		},
		onReady() {
			uni.hideLoading();
		},
		onShow() {
			this.hideModal();
		},
		created: function() {
			// this.listWidth="352px";
			// this.marginright="-20px";
		},
		methods: {
			showModal(plusDrawerList, modalName) {
				this.plusDrawerList = plusDrawerList;
				this.modalName = modalName;
			},
			hideModal(modalName) {
				this.modalName = null;
			},
			// tabSelect(e) {
			// 	this.TabCur = e.currentTarget.dataset.id;
			// 	this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			// },
			pushWindPowerStationNameToSessionStorage(windpowerstationName, windPowerStationId) {
				uni.setStorageSync('windpowerstationName', windpowerstationName);
				uni.setStorageSync('windPowerStationId', windPowerStationId);
				this.common.goback('/pages/index/Index');
			},
			getWindPowerStationNamesToSessionStorage() {
				uni.getStorageSync('windpowerstationNames');
				console.log(uni.getStorageSync('windpowerstationNames'));
				return uni.getStorageSync('windpowerstationNames');
			},
		},
	}
</script>

<style>
	page {
		background-image: var(--gradualBlue);
		width: 100vw;
		overflow: hidden;
	}

	.DrawerPage {
		position: fixed;
		width: 100vw;
		height: 100vh;
		left: 0vw;
		background-color: #242424;
		transition: all 0.4s;
	}

	.DrawerPage.show {
		transform: scale(0.9, 0.9);
		left: 85vw;
		box-shadow: 0 0 60upx rgba(0, 0, 0, 0.2);
		transform-origin: 0;
		background-color: #242424;
	}

	.DrawerWindow {
		position: absolute;
		width: 85vw;
		height: 100vh;
		left: 0;
		top: 0;
		transform: scale(0.9, 0.9) translateX(-100%);
		opacity: 0;
		pointer-events: none;
		transition: all 0.4s;
		padding: 100upx 0;
		background-color: #242424;
	}

	.DrawerWindow.show {
		transform: scale(1, 1) translateX(0%);
		opacity: 1;
		pointer-events: all;
		background-color: #242424;
	}

	.DrawerClose {
		position: absolute;
		width: 40vw;
		height: 100vh;
		right: 0;
		top: 0;
		color: transparent;
		padding-bottom: 30upx;
		display: flex;
		align-items: flex-end;
		justify-content: center;
		background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));
		letter-spacing: 5px;
		font-size: 50upx;
		opacity: 0;
		pointer-events: none;
		transition: all 0.4s;
		background-color: #242424;
	}

	.DrawerClose.show {
		opacity: 1;
		pointer-events: all;
		width: 15vw;
		color: #fff;
		background-color: #242424;
	}

	.DrawerPage .cu-bar.tabbar .action button.cuIcon {
		width: 64upx;
		height: 64upx;
		line-height: 64upx;
		margin: 0;
		display: inline-block;
		background-color: #242424;
	}

	.DrawerPage .cu-bar.tabbar .action .cu-avatar {
		margin: 0;
	}

	.DrawerPage .nav {
		flex: 1;
	}

	.DrawerPage .nav .cu-item.cur {
		border-bottom: 0;
		position: relative;
	}

	.DrawerPage .nav .cu-item.cur::after {
		content: "";
		width: 10upx;
		height: 10upx;
		background-color: currentColor;
		position: absolute;
		bottom: 10upx;
		border-radius: 10upx;
		left: 0;
		right: 0;
		margin: auto;
	}

	.DrawerPage .cu-bar.tabbar .action {
		flex: initial;
	}
</style>