<style lang="scss">
	.container{
		height: 100%;
		background:#F6F6F6;
		&>map{
			flex-shrink: 0;
			height:348rpx;
			width:100%;
			margin-bottom:-9rpx;
		}
		&>.u-tabs{
			flex-shrink: 0;
			background:#fff;
			box-shadow: 0 6rpx 12rpx 2rpx rgba(0,0,0,0.1);
		}
		swiper{
			flex-grow: 1;
			height:1rpx;
		}
	}
</style>
<template>
	<view class="container flex">
		<map id="amap"/>

		<u-tabs :list="tabs" :current="tabIndex" activeStyle="color:#10C176;" lineColor="#10C176" lineWidth="50" :scrollable="false" @change="plantId='';tabIndex=$event.index"/>

		<swiper :current="tabIndex" @change="tabIndex=$event.detail.current">
			<swiper-item>
				<plant-plan :plotId="plotId" @trigger="tabIndex=$event.tabIndex;plantId=$event.plantId"/>
			</swiper-item>
			<swiper-item>
				<farmRecord :plotId="plotId"/>
			</swiper-item>
			<swiper-item>
				<recovery :plotId="plotId" :plantId="plantId"/>
			</swiper-item>
		</swiper>
	</view>
</template>
<script>
import plantPlan from './plantPlan.vue'
import farmRecord from './farmRecord.vue'
import recovery from './recovery.vue'
export default {
	components:{plantPlan,farmRecord,recovery},
	data(){
		return{
			tabIndex:0,
			tabs:[
				{name:"种植计划",},
				{name:"农事记录",},
				{name:"采收记录",},
			],
			plotId:"",
			plantId:"",
		}
	},
	onLoad(options){
		this.plotId=options.id
	},
	onReady(){
		/* #ifdef APP-PLUS */
			var a=uni.createMapContext("amap",this)
			
			var maps=a.$getAppMap()
			maps.setMapType(plus.maps.MapType.MAPTYPE_SATELLITE)
			maps.onclick=(e)=>{
				console.log(e,'-------maps--click---------')
			}
			var polygon=new plus.maps.Polygon([
				new plus.maps.Point(116.39524,39.925301),
				new plus.maps.Point(116.400444,39.925285),
				new plus.maps.Point(116.400558,39.923282),
				new plus.maps.Point(116.395502,39.923082),
			])
			polygon.setLineWidth(0)
			polygon.setFillColor("#ff0000")
			polygon.setFillOpacity(0.3)
			maps.addOverlay(polygon)
		/* #endif */
	},
	methods:{
		
	}
}
</script>