index.vue 2.36 KB
<template>
	<div class="dashboard-container">
		<div class="dashboard-text"
			style="background-color: #334056;border-radius: 5px;color: #FFF;font-size: 16px;padding: 5px 5px 5px 15px;">
			<div style="font-size: 20px;">欢迎使用安第斯答题软件</div>
		</div>
		<el-row :gutter="20">
			<el-col :span="6">
				<div class="grid-content bg-purple">
					<label class="grid-content-number">0</label>
					<div>今日收益</div>
				</div>
			</el-col>
			<el-col :span="6">
				<div class="grid-content bg-purple">
					<label class="grid-content-number">{{total.questiontotal}}</label>
					<div>题目数量</div>
				</div>
			</el-col>
			<el-col :span="6">
				<div class="grid-content bg-purple">
					<label class="grid-content-number">{{total.testpapertotal}}</label>
					<div>试卷数量</div>
				</div>
			</el-col>
			<el-col :span="6">
				<div class="grid-content bg-purple">
					<label class="grid-content-number">0</label>
					<div>总人数</div>
				</div>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	import {
		GetQuestionTotal,
		GetTestPaperTotal
	} from '@/api/index'
	import {
		mapGetters
	} from 'vuex'

	export default {
		name: '安第斯考试系统',
		data() {
			return {
				total: {
					questiontotal: 0,
					testpapertotal:0
				}
			}
		},
		computed: {
			...mapGetters([
				'name'
			])
		},
		created() {

		},
		mounted() {
			this.GetTotalHeadler();
		},
		methods: {
			GetTotalHeadler() {
				GetQuestionTotal().then(res => {
					this.total.questiontotal = res.data.data;
				});
				GetTestPaperTotal().then(res=>{
					this.total.testpapertotal = res.data.data;
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.dashboard {
		&-container {
			margin: 30px;
		}
		&-text {
			font-size: 30px;
			line-height: 46px;
		}
	}
	.el-row {
		margin-bottom: 20px;
		margin-top: 20px;
		&:last-child {
			margin-bottom: 0;
		}
	}
	.el-col {
		border-radius: 5px;
	}
	.bg-purple-dark {
		background: #99a9bf;
	}
	.bg-purple {
		background: #d3dce6;
		box-shadow: 0 0 10px #cdcdcd;
	}
	.bg-purple-light {
		background: #e5e9f2;
	}
	.grid-content {
		border-radius: 5px;
		min-height: 36px;
		text-align: center;
		padding-top: 20px;
		padding-bottom: 20px;
		.grid-content-number {
			font-size: 40px;
			color: red;
		}
		div {
			font-size: 20px;
			margin-top: 10px;
		}
	}
	.row-bg {
		padding: 10px 0;
		background-color: #f9fafc;
	}
</style>