<template>
	<custom-scroll-list :refreshFn="getExamList" :tabList="tabData" :defaultTab="1">
		<template #default="{list}">
			<scroll-list-card  v-for="(item,index) in list" :key="item.ksId" :data="item" @btnClick="handleClick"></scroll-list-card>
		</template>
	</custom-scroll-list>
</template>

<script setup>
	import {
		getExamList
	} from "@/api/exam.js";
	import {
		// onLoad,
		onReady,
		
	} from "@dcloudio/uni-app"
	import {
		reactive,
		ref
	} from "vue";

	const tabData = [{
			label: "可以考试",
			value: 1,
		},
		{
			label: "已结束",
			value: 4,
		}
	]
	
	function handleClick(data) {
		console.log('data', data)
		if (data.status == 0) {
			// 未开始
			uni.redirectTo({
				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
			})
		}
		if (data.status == 1) {
			// 可以考试
			uni.redirectTo({
				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
			})
		}
		if (data.status == 2) {
			// 再次考试
			uni.redirectTo({
				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
			})
		}
		if (data.status == 3) {
			// 考试中
			uni.redirectTo({
				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
			})
		}
		if (data.status == 4) {
			// 已结束
		}
		if (data.status == 5) {
			// 未报名
		}
		if (data.status == 6) {
			// 报名审核中
		}
		if (data.status == 7) {
			// 审核未通过
		}
		if (data.status == 8) {
			// 等待人工评分
		}

	}
</script>

<style lang="scss">

</style>