<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">{{total.PriceNumber/100}}<span style="font-size: 16px;">元</span></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">{{total.Count}}</label>
					<div>总人数</div>
				</div>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	import {
		GetQuestionTotal,
		GetTestPaperTotal
	} from '@/api/index'
  import {
    OrderGetPriceNumber
  } from '@/api/order.js'
	import {
		mapGetters
	} from 'vuex'
import {
    GetUserList
  } from '@/api/user'
	export default {
		name: '安第斯考试系统',
		data() {
			return {
				total: {
					questiontotal: 0,
					testpapertotal:0,
          PriceNumber:0,
          Count:0,
				},
        query: {
          UserTypeEnum: 1, //0：管理员，1普通用户
          PageIndex: 1,
          PageSize: 10,
        
        }
			}
		},
		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;
				});
        OrderGetPriceNumber().then(res=>{
          this.total.PriceNumber = res.data.data;
        })
        GetUserList(this.query).then(res => {
          this.total.Count = res.data.data.total
        })
			}
		}
	}
</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>
