<template>
  <div class="dashboard-container">
    <div class="item-row" style="margin-top: 20px">
      <div class="item-col">
        <echarts-lesson id="lesson" ref="lesson" :size="size" :wxcode="wxcode" />
      </div>
      <div class="item-col">
        <echarts-exam id="exam" ref="exam" :size="size" :wxcode="wxcode" />
      </div>
    </div>
    <div class="item-flex">
      <echarts-demon id="demon" ref="demon" :size="size" :info="demonOption" />
    </div>
  </div>
</template>

<script>
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import EchartsExam from './echarts/exam';
import EchartsLesson from './echarts/lesson';
import EchartsDemon from './echarts/demonstration';

export default {
	name: 'Dashboard',
	components: {
		EchartsExam,
		EchartsLesson,
		EchartsDemon
	},
	mixins: [WindowResizeHandler],
	data() {
		return {
			size: {
				width: 0,
				height: 0
			},
			demonOption: {
				backgroundColor: '#F0F2F5',
				title: {
					text: '仿真统计'
				},
				legend: {
					data: []
				},
				xAxis: {
					data: ['13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55']
				},
				yAxis: {
				},
				series: []
			}
		};
	},
	computed: {
		wxcode() {
			return this.$store.state.user.wxUnionId || '';
		}
	},
	methods: {
		resizeHandler() {
			this.size = {
				width: (this._clientWidth - 60) / 2,
				height: (this._clientHeight - 100) / 2
			};
		}
	}
};
</script>

<style lang="scss" scoped>
  .dashboard {
	background: #F0F2F5;
    &-container {
      margin: 0px;
    }

    &-text {
      font-size: 30px;
      line-height: 46px;
    }
  }

.item-col {
	display: inline-block;
}

.item-row {
	left: 50%;
	right: 50%;
	text-align: center;
}

.item-flex {
	display: flex;
	justify-content: center;
}
</style>
