Blame view

src/views/dashboard/index.vue 2.36 KB
b89c8760   wangming   项目初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  <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>