<template>
	<view>
		<back :text="'课程列表'"></back>

		<view class="card-box">
			<view class="card-item" style="width: 100%;">
				<view class="card-info">
					<view class="t-icon t-icon-shuji1"></view>
					<text class="info-text">今日课程列表</text>
				</view>

				<view class="home-title-text">
					<view class="msg">课程数:</view>
					<view class="card-content">{{classList.length}}</view>
					<view style="display: flex; align-items: center; margin-left: auto; margin-right: 30rpx;">
						<view class="t-icon t-icon-yuyue-lishi-shijian"></view>
						<view class="msg" style="margin-left: 10rpx;">{{today}}</view>
						<view class="msg" style="margin-left: 10rpx;">{{week}}</view>
					</view>
				</view>
				<!-- 课程列表 -->
				<view style="margin-bottom: 20rpx;">
					<view class="block-box" v-for="(item,index) in classList" :key="index">
						<view class="index"></view>

						<view class="class-block" style="width: 85%;">
							<view class="block-title">{{item.name}}</view>
							<view class="block-tag-box">
								<view class="block-tag">{{item.teacher}}</view>
							</view>
							<view class="block-subtitle">{{item.timeFrame}}</view>
							<view class="block-title">{{item.time}}</view>
						</view>
					</view>
				</view>


			</view>

			<view class="card-item" style="width: 100%;">
				<view class="card-info">
					<view class="t-icon t-icon-zhishi"></view>
					<text class="info-text">本周课程表</text>
				</view>
				<z-table class="table" :tableData="weekClassTable" :columns="columns">
				</z-table>
			</view>
		</view>


	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		computed: {
			...mapState('m_children', ['classList'])
		},
		data() {
			return {
				columns: [{
						'title': '课程表',
						'key': '课程表',
						'width': 220,
					},
					{
						'title': '周一',
						'key': '周一',
					},
					{
						'title': '周二',
						'key': '周二',
					},
					{
						'title': '周三',
						'key': '周三',
					},
					{
						'title': '周四',
						'key': '周四',
					},
					{
						'title': '周五',
						'key': '周五',
					},
				],
				weekClassTable: [{
						'课程表': '上午一节',
						'周一': '语文',
						'周二': '数学',
						'周三': '外语',
						'周四': '语文',
						'周五': '数学',
					},
					{
						'课程表': '上午二节',
						'周一': '数学',
						'周二': '外语',
						'周三': '语文',
						'周四': '数学',
						'周五': '外语',
					},
					{
						'课程表': '上午三节',
						'周一': '外语',
						'周二': '语文',
						'周三': '数学',
						'周四': '外语',
						'周五': '语文',
					},
					{
						'课程表': '下午一节',
						'周一': '思品',
						'周二': '体育',
						'周三': '科学',
						'周四': '思品',
						'周五': '体育',
					},
					{
						'课程表': '下午二节',
						'周一': '体育',
						'周二': '科学',
						'周三': '思品',
						'周四': '体育',
						'周五': '科学',
					},
					{
						'课程表': '下午三节',
						'周一': '科学',
						'周二': '思品',
						'周三': '体育',
						'周四': '科学',
						'周五': '思品',
					}
				],
				today: '',
				week: ''
			};
		},
		onLoad() {
			this.getToday()
		},
		methods: {
			getToday(){
				this.today = (new Date()).format('M-d').replace('-','月')+'日'
				this.week = "星期" + "日一二三四五六".charAt(new Date().getDay());
			}
		}
	}
</script>

<style lang="scss">
	@import '@/pages/common/blockmsg.scss';

	.card-box {
		display: flex;
		flex-flow: column wrap;
		margin: 0 20rpx 0 20rpx;
		justify-content: space-between;

		.card-item {
			margin: 2% 0;
			width: 48%;
			height: auto;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			background-color: #FFF;
			// box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
			border-radius: $card-border-radius;

			.card-info {
				display: flex;
				align-items: center;
				padding: 20rpx;

				.info-text {
					font-size: 30rpx;
					font-weight: bold;
					color: #3B4144;
					margin-left: 10rpx;
				}
			}
		}
	}

	.card-content {
		font-size: 35rpx;
		margin: 10rpx 0 10rpx 25rpx;
		color: $u-primary;
		font-weight: bold;
	}

	.home-title-text {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		margin: 10rpx 0 10rpx 0;
	}

	.msg {
		color: $color-title;
		margin-left: 30rpx;
		font-size: 30rpx;
	}

	.t-icon {
		width: 40rpx;
		height: 40rpx;
	}
	//表格
	.table {
		margin: 0 auto 20rpx auto;
		width: 93%;
		height: 100%;
	}
</style>
