<template>
	<view class="container">
		<!-- 抽屜 -->
		<uni-drawer :visible="drawerIsShow" :width="width" @close="closeDrawer" style="z-index: 99999;">
			<view style="padding:0rpx; background-color:#1A1A1A;">
				<view class="picture">
					<view class="sisGroup">{{leftNavigationtitle}}
					<view class="iconImgage">
					</view>
					</view>
					
					<view v-for="(item,index) in drawerList" :class="[changeGary==index?'statusMonitoring':'item']" :key="index" @click="clickChangeColor(index)">
						<div @click="goToIndex(item);closeDrawer();">
							{{item.name}}
							</div>
					
					</view>

				</view>
				<view class="cu-bar tabbar bg-black">
					<view class="action">
						<view class="icon cuIcon-repair text-black">
						</view>
						<view class="text-black">设置</view>
					</view>
					<view class="action" style="margin-left: 30px;">
						<view class="icon cuIcon-command text-black">
						</view>
						<view class="text-black">修改密码</view>
					</view>
				</view>
			</view>
		</uni-drawer>
	</view>
</template>

<script>
	import uniDrawer from "@/uni-drawer/uni-drawer.vue"
	import uniList from '@/uni-list/uni-list.vue'
	import uniListItem from '@/uni-list-item/uni-list-item.vue'
	import uniIcons from '@/uni-icons/uni-icons.vue'
	export default {
		components: {
			uniDrawer,
			uniList,
			uniListItem,
			uniIcons
		},
		data: function() {
			return {
				drawerIsShow: false,
				drawerList: [],
				width: 250,
				inconList: [],
				changeGary: -1,
				leftNavigationtitle:'',
			}
		},
		methods: {
			openDrawer: function(width, drawerList, inconList,leftNavigationtitle) {
				this.drawerIsShow = true;
				this.drawerList = drawerList;
				this.width = width;
				this.inconList = inconList;
				this.leftNavigationtitle = leftNavigationtitle;
			},
			closeDrawer: function() {

				this.drawerIsShow = false;

















                if(this.drawerList.length!=0){
					//#ifdef H5
					   if(this.drawerList[0].name=='手环管理'){
						   this.$root.leftbar();
					   }
					   
					
					//#endif
					
					//#ifdef APP-PLUS
					   if(this.drawerList[0].name=='手环管理'){
					       this.$parent.leftbar();
					   }
					//#endif
				}
				

			},
			clickChangeColor: function(index) {
				this.changeGary = index;
			},
			goToIndex:function(item){
				console.log(item.remark1);
				if(item.remark1 == '/pages/index/Index'){
					uni.switchTab({
							url: item.remark1
					 });
				}
				else if(item.remark1 == '/pages/forecast/Forecast'){
					this.$parent.$root.toggleSwitch = false;
					uni.switchTab({
							url: item.remark1
					 });
				}
				else if(item.remark1 == '/components/weatherProphethomepage/WeatherProphethomepage'){
					this.$parent.$root.toggleSwitch = true;
				}
				else{
					 uni.navigateTo({
					 	url: item.remark1
					 })
				 }
			}
		}
	}
</script>

<style>
	.container{
		
	}
	.sisGroup {
		width: 90%;
		height: 65px;
		color: silver;
		font-size: 13px;
		padding-top: 40px;
		margin-left: 5%;
		font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, Simsun, sans-serif;
		
	}

	.statusMonitoring {
		background-color: #393939;
		width: 90%;
		margin-left: 5%;
		height: 40px;
		margin-top: 10px;
		/* text-align: center; */
		color: silver;
		font-size: 14px;
		padding-top: 10px;
		padding-left: 10px;
		font-family: Helvetica Neue, Helvetica, sans-serif;
		
		}

	.picture {
		width: 300px;
		height: 700px;
		background-color: #1A1A1A;
		
	}

	.cu-bar {
		position: fixed;
		top: calc(100% - 50px);
		width: 100%;
		background-color: #1A1A1A;
	}

	.icon {
		float: left;
	}

	.text-black {
		float: left;
		line-height: 28px;
		font-size: 15px;
		background-color: #1A1A1A;
		color: silver;
		
	}
	.iconImgage{
		width: 29px;
		height: 35px;
		background-color: red;
		margin-left: 82px;
		margin-top: -25px;
		background-image: url(../../static/picture/i.jpg);
	}
	.item {
		width: 90%;
		height: 40px;
		margin-top: 10px;
		margin-left: 5%;
		/* float: right; */
		/* margin-right: 10px; */
		background-color: #272727;
		/* text-align: center; */
		color: silver;
		font-size: 14px;
		padding-top: 10px;
		padding-left: 10px;
		font-family: Helvetica Neue, Helvetica, sans-serif;
	}
</style>