<template>
	<view class="page_view">
		<top-return color="#FFF" text="作业统计"></top-return>
		<!-- 背景 -->
		<view class="bg_box"></view>
		<!-- 页面标题内容 -->
		<view class="flex_cloumn">
			<view class="flex_baseline">
				<view class="content_title" style="font-size: 70rpx;">{{dayTime.split('月')[0]}}</view>
				<view class="content_title" style="margin-left: 10rpx;">月</view>
				<view class="content_title" style="font-size: 70rpx;margin-left: 10rpx;">{{dayTime.split('月')[1]}}
				</view>
				<view class="content_title" style="margin-left: 10rpx;">日</view>
				<view class="content_title" style="font-size: 70rpx;margin-left: 20rpx;">{{weekTime}}</view>
			</view>
			<view class="flex_baseline">
				<view class="content_subtitle" style="opacity: 0.8;">孩子今日共</view>
				<view class="content_subtitle" style="margin-left: 20rpx;font-size: 60rpx;">{{workData.length}}</view>
				<view class="content_subtitle" style="margin-left: 20rpx;opacity: 0.8;">份作业</view>
			</view>
		</view>
		<!-- 统计列表 -->
		<view class="card_view">

			<view class="card_item" style="width: 100%;">
				<view class="card_title">
					<view class="front_tag"></view>
					<view class="title">近期作业完成率</view>
				</view>
				<view class="chart_box">
					<qiun-data-charts type="column" ontouch="true" :chartData="workChartData[0]"
						tooltipFormat='HomeworkPercent' :canvas2d="true" canvasId="work_chart1" />
				</view>
			</view>

			<view class="card_item" style="width: 100%;">
				<view class="card_title">
					<view class="front_tag"></view>
					<view class="title">近期作业得分率</view>
				</view>
				<view class="chart_box">
					<qiun-data-charts type="area" ontouch="true" :chartData="workChartData[1]"
						tooltipFormat='HomeworkPercent' :canvas2d="true" canvasId="work_chart2" />
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		computed: {
			...mapState('m_children', ['workData']),
			...mapState('m_chart', ['workChartData']),
		},
		data() {
			return {
				dayTime: '',
				weekTime: ''
			};
		},
		onLoad() {
			this.getToday()
		},
		methods: {
			getToday() {
				this.dayTime = (new Date()).format('M-d').replace('-', '月')
				this.weekTime = "星期" + "日一二三四五六".charAt(new Date().getDay());
			}
		}
	}
</script>

<style lang="scss">
	.chart_box {
		width: 100%;
		height: 500rpx;
	}

	.flex_cloumn {
		margin: 140rpx 0 0 50rpx;
		height: 170rpx;
		justify-content: space-around;

		.content_title {
			font-size: 35rpx;
			font-family: YSfont;
			color: #FFF;
			z-index: 2;
			text-shadow: 1px -1px 0px #c0c0c0, 2px -2px 0px #b0b0b0, 1px -1px 0px #a0a0a0, 2px -2px 0px #909090;
		}

		.content_subtitle {
			font-size: 40rpx;
			color: #FFF;
			font-family: YSfont;
			z-index: 2;
		}
	}
</style>
