You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

2 years ago
<style lang="scss">
2 years ago
.container{
2 years ago
min-height: 100%;
background:#F6F6F6;
&>map{
height:348rpx;
width:100%;
2 years ago
margin-bottom:-9rpx;
2 years ago
}
&>.u-tabs{
background:#fff;
box-shadow: 0 6rpx 12rpx 2rpx rgba(0,0,0,0.1);
}
}
</style>
<template>
2 years ago
<view class="container">
2 years ago
<map id="amap"/>
2 years ago
<u-tabs :list="tabs" :current="tabIndex" activeStyle="color:#10C176;" lineColor="#10C176" lineWidth="50" :scrollable="false" @change="tabIndex=$event.index"/>
2 years ago
<plant-plan v-if="tabIndex==0" :plotId="plotId" @trigger="tabIndex=$event.tabIndex;plantId=$event.plantId"/>
<farmRecord v-else-if="tabIndex==1" :plotId="plotId"/>
<recovery v-else :plotId="plotId"/>
2 years ago
</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:"采收记录",},
],
2 years ago
plotId:"",
plantId:"",
2 years ago
}
},
onLoad(options){
2 years ago
this.plotId=options.id
},
2 years ago
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:{
}
2 years ago
}
</script>