<template>
	<view class="wrap">
		<u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
			:indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper>
			
		
		<u-card v-for="(item, index) in myinspecttaskList" v-bind:key="index" :title="item.name" margin="6rpx" 
		:border="false" :foot-border-top="false" border-radius="2rpx" :head-style="headstyle"
		@body-click="taskClick" :index="item.id">
			<view class="" slot="body">
				<view class="u-body-item-title">
					<span style="color:blue;border:1rpx solid blue;margin-right:6rpx">{{item.state}}</span>
					{{item.name}}
				</view>
				<view class="u-body-item">
					所属任务:
					<span>{{item.inspecttask_.name}}</span>
				</view>
				<view class="u-body-item">
					检查期限:
					<span>{{item.inspecttask_.start_date}}</span>至
					<span>{{item.inspecttask_.end_date}}</span>
				</view>
				<view class="u-body-item">
					涉及单位:
					<span style="color:blue;">{{item.depts_count}}</span>家
					巡查组:
					<span style="color:blue;">{{item.members.length}}</span>人
				</view>
			</view>
		</u-card>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				swiper_list: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				swtitle: false,
				mode: 'round',
				indicatorPos: 'bottomCenter',
				effect3d: true,
				test: '',
				myinspecttaskList:[],
				list: [{
					groupName: '最近任务',
					list: [{
							path: '/pages/example/js',
							title: '员工台账',
						},
						{
							path: '/pages/example/components',
							title: '放射源台账',
						}
					]
				}],
				title: '素胚勾勒出青花，笔锋浓转淡',
				subTitle: '2020-05-15',
				thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
				headstyle:{"padding-top":"12rpx","padding-bottom":"12rpx"}
			}
		},
		computed: {
			getIcon() {
				return path => {
					return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
				}
			},
		},
		onLoad() {
			
		},
		onShow() {
			this.getMyInspectTask();
		},
		methods: {
			getUserInfo() {
				this.$u.api.getUserInfo().then(res => {

				}).catch(e => {})
			},
			getMyInspectTask() {
				this.$u.api.getMyInspectTask({state:'执行中'}).then(res => {
				     this.myinspecttaskList = res.data
				}).catch(e=>{})
			},
			openPage(path) {
				this.$u.route({
					url: path
				})
			},
			change() {

			},
			click() {

			},
			taskClick(index){
				console.log(index)
			}
		}
	}
</script>

<style>
	page {
		background-color: #ededed;
	}
</style>

<style lang="scss" scoped>
	.u-body-item-title{
		font-size: 32rpx;
		color: #333;
	}
	.u-body-item{
		margin-top:4rpx;
		span{
			color: #333;
		}
		
	}
</style>
