<template>
	<yf-more-list url="/api/paper/paper/my-paging" :params="queryParams" ref="moreList">
		<template v-slot:item="{ data }">
			<uni-list-item 
					:note="`得分：${data.userScore}`"
					:rightText="stateText(data)"
					:title="`考试时间：${data.createTime}`" 
					link="navigateTo"
					:to="`/pages/paper/detail?id=${data.id}`">
			</uni-list-item>
		</template>
	</yf-more-list>
</template>

<script>
	export default {
		components: { },
		data() {
			return {
				queryParams:{
					examId: ''
				}
			}
		},
		onLoad(option) {
			this.queryParams.examId = option.id;
		},
		onShow() {
			if(this.$refs.moreList){
				this.$refs.moreList.initData()
			}
		},
		
		onReachBottom() {
			// 加载数据
			this.$refs.moreList.loadData()
		},
		
		onBackPress(e){
		
		  //正常返回页面
		  uni.redirectTo({
			url:"/pages/paper/index"
		  })
			
		  return true;
		},
		
		methods: {
			
			stateText(item){
				
				if(item.state===1){
					return '待阅卷'
				}else{
					if(item.userScore>=item.qualifyScore){
						return '合格'
					}else{
						return '不合格'
					}
				}				
			}
		}
	}
</script>

<style>
	
	.container {
		font-size: 14rpx;
	}
	
	.exam-item{
		display: flex; align-items: center;
		line-height: 30px;
	}
	.exam-item .left{
		text-align: left;
		flex-grow: 1;
	}
	.exam-item .left .title{
		font-size: 16px;
	}
	
	.exam-item .left .desc{
		font-size: 14px;
		color: #888;
	}
	
	.exam-item .left .icons{
		font-size: 10px; 
		display: flex; 
		align-items: center; 
		color: #666;
	}
	.right {
		
		display: flex; 
		align-items: center;
	}


	.pass{
		color: #007AFF !important;
		margin-right: 5px; 
	}
	
	.fail{
		color: #ff0000 !important;
		margin-right: 5px;
	}

</style>
