<template>
	<view class="page-view">
		<top-return :color="'#FFF'" text="评测列表"></top-return>

		<view class="bg-box2"></view>
		<!-- 页面标题内容 -->
		<view class="top-box">
			<view class="flex-baseline">
				<view class="info-title" style="margin-left: 0;">{{dayTime.split('月')[0]}}</view>
				<view class="info-subtitle">月</view>
				<view class="info-title">{{dayTime.split('月')[1]}}</view>
				<view class="info-subtitle">日</view>
				<view class="info-subtitle" style="margin-left: 20rpx;">已完成</view>
				<view class="info-title">{{value}}%</view>
			</view>
			<view class="flex-baseline">
				<view class="data-subtitle" style="margin-left: 0;">孩子今日共</view>
				<view class="data-title">{{examData.length}}</view>
				<view class="data-subtitle">例评测</view>
			</view>
		</view>
		<!-- 卡片内容 -->
		<view class="card-view">
			<view class="card-item" v-for="(item,index) in examData" :key="index"
				@click="navExamReport(index)">
				<view class="card-title">
					<view class="t-icon t-icon-examicon"></view>
					<view class="YS-title" style="font-size: 45rpx;">{{item.examInfo.name}}</view>
					<view
						:class="[item.examInfo.progress === 'finish'?'t-icon t-icon-yiwancheng1':'t-icon t-icon-jinhangzhong','state-seal']">
					</view>
				</view>
				<view class="card-info">
					<view class="flex-row">
						<view class="tag-fill"
							:style="{backgroundColor: item.examInfo.progress === 'finish'? '#23b46c': '#ff8caf' }">
							<view class="tag-text">{{item.examInfo.subjects[0].name}}</view>
						</view>
						<view class="tag-fill" style="margin-left: 20rpx;"
							:style="{backgroundColor: item.examInfo.progress === 'finish'? '#23b46c': '#ff8caf' }">
							<view class="tag-text">{{item.examInfo.examType.name}}</view>
						</view>
					</view>
					<view class="flex-baseline" style="margin-top: 20rpx;">
						<view class="info-type">布置老师:</view>
						<view class="YS-title" style="margin-left: 10rpx;">{{item.examInfo.creatorId}}
						</view>
						<view class="info-type" style="margin-left: 20rpx;">截止时间:</view>
						<view class="YS-title" style="margin-left: 10rpx;">
							{{$timeStampToTime(item.examInfo.endTime)}}
						</view>
					</view>
				</view>
				<view class="content-box">
					<view class="title-box"
						:style="{backgroundColor: item.examInfo.progress === 'finish'? '#23b46c': '#ff8caf' }">
						<view class="title-text">{{item.examInfo.papers[0].name}}</view>
					</view>
					<view class="content-detail"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	export default {
		computed: {
			...mapState('m_children', ['examData'])
		},
		data() {
			return {
				// tabList: [{
				// 	name: '已完成'
				// }, {
				// 	name: '未完成'
				// }],
				value: '',
				dayTime: ''
			}
		},
		onLoad(parameter) {
			this.value = parameter.value
			this.dayTime = (new Date()).format('M-d').replace('-', '月')
		},
		methods: {
			navExamReport(index) {
				uni.navigateTo({
					url: `/subpkg/datalist/examReport?index=${index}`
				})
			}
		}
	}
</script>

<style lang="scss">
	@import 'data_pages.scss';
	@import 'top_info.scss';
	.tag-fill {
		background-color: $color-pink;
	}
</style>
