<template>
	<view>
	 <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
		 <view @click="goDetail(item)" class="card" v-for="(item,index) in list" :key="index">
		 	<view class="item top" style="padding: 15rpx 0;">
		 		<view class="">
		 			<u-icon name="map"></u-icon>
		 			<text class="padding-left-10">{{item.residentialName}}</text>
		 		</view>
		 	</view>
		 	<view style="margin-left: 30rpx;">
		 		<view class="item">
		 			<view class="">
		 				<text>体温是否异常：</text>
		 				<text v-if="item.temparetureException==0" class="text-green text-bold">否</text>
						<text v-if="item.temparetureException==1" class="text-red text-bold">异常</text>
		 			</view>
		 		</view>
		 		<view class="item">
		 			<view >
		 				<text>是否咳嗽不适：</text>
		 				<text v-if="item.symptomException==0" class="text-green text-bold">否</text>
		 				<text v-if="item.symptomException==1" class="text-red text-bold">异常</text>
		 			</view>
		 		</view>
		 		<view class="item">
		 			<text class="padding-right-20">登记时间:</text>
		 			<text>{{item.createDate}}</text>
		 		</view>
		 	</view>
		 </view>
	 </mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/comps/mescroll-body/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				list:[],
				upOption: {
					noMoreSize: 5, 
					auto: true,
					page: {
						page: 0,
						size: 10
					}
				},
				// 下拉配置参数
				downOption: {
					use: true, 
					auto: false
				}
			}
		},
		onLoad() {
			
		},
		methods: {
			goDetail(item){
				getApp().globalData.pratiqueData=item
				uni.navigateTo({
					url:"./detail?show=false"
				})
			},
			downCallback(){
				setTimeout(()=>{
					this.mescroll.resetUpScroll()
				},1500)
			},
			upCallback(mescroll){
				let that=this
				let member=getApp().globalData.member
				let params={
					memberId:member.id,
					current:mescroll.num,
					size:mescroll.size
				}
				let operation='pratique/getListByMemberId'
				try{
					getApp().globalData.postRequest(params, operation, function (res) {
						let data=res.data.list
						mescroll.endBySize(data.length, res.data.total);
						if(mescroll.num == 1) that.list = []; //如果是第一页需手动制空列表
						that.list=that.list.concat(data); //追加新数据
					});
				}catch(e){
					mescroll.endErr();
				}
			}
		}
	}
</script>

<style lang="scss">
	.card{
		margin: 10rpx;
		padding:0 20rpx 20rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;
		
		.top{
			border-bottom: 1rpx dashed #DEDEDE;
			font-weight: 800;
			margin-bottom: 20rpx;
		}
		
		.item{
			padding: 10rpx;
		}
		
		.bottom{
			border-top: 1rpx dashed #DEDEDE;
			margin-top: 10rpx;
			padding-right: 20rpx;
		}
	}
</style>
