Skip to content

Commit a439d35

Browse files
authored
feat: add comprehensive report util (#51)
* add comprehensive report * improvment * basically completed * basically completed
1 parent ec3d512 commit a439d35

File tree

7 files changed

+575
-81
lines changed

7 files changed

+575
-81
lines changed

package-lock.json

Lines changed: 81 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<div>
3+
<Card>
4+
<p slot="title" class="util-title">{{ utilTitle }}</p>
5+
<Button slot="extra" class="util-button" type="success" @click="DialogChange">Take it</Button>
6+
<p class="util-introduction">{{ utilIntroduction }}</p>
7+
</Card>
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
name: 'UtilMenuCard',
14+
props: {
15+
utilTitle: String,
16+
utilIntroduction: String
17+
},
18+
methods: {
19+
DialogChange() {
20+
this.$emit('change-dialog')
21+
}
22+
}
23+
}
24+
</script>
25+
26+
<style scoped lang="less">
27+
/deep/ .ivu-card-extra{
28+
top: 9px
29+
}
30+
31+
.util-introduction {
32+
padding: 12px 12px;
33+
line-height: 1;
34+
}
35+
</style>

src/components/NavBar.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<Icon type="ios-contacts"></Icon>
3737
Group
3838
</MenuItem>
39+
<MenuItem name="util" :to="{ name: 'util' }">
40+
<Icon type="ios-settings" />
41+
Util
42+
</MenuItem>
3943
</Menu>
4044
</div>
4145
</template>

src/router/routes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const routes = [
4040
name: 'group',
4141
component: () => import('@/views/group/GroupListView')
4242
},
43+
{
44+
path: '/util',
45+
name: 'util',
46+
component: () => import('@/views/util-information/UtilView')
47+
},
4348
{
4449
path: '*',
4550
component: () => import('@/views/404/404View')

src/utils/ObjectArrayIndexof.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const indexof = function (array, propName, val) {
2+
const a = [];
3+
array.forEach(item => {
4+
a.push(item[propName])
5+
})
6+
return a.indexOf(val)
7+
}

src/utils/api.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ export default {
8282
}
8383
});
8484
},
85+
86+
/* 通过组号获取比赛列表 */
87+
getContestListByGroupId: function(params) {
88+
return get('/contest/list', params)
89+
},
90+
91+
/* 通过组号获取组内学生 */
92+
getStudentListByGroupId: function (params) {
93+
return get('/group/query', params)
94+
},
8595
// 查询用户列表
8696
getUserList: function (params) {
8797
return get('/manage/user/list', params);
@@ -177,6 +187,25 @@ export default {
177187
createContest: function (data) {
178188
return post('/manage/contest/create', data);
179189
},
190+
// 综合报表
191+
exportComprehensive: function (data) {
192+
return new Promise((resolve, reject) => {
193+
post('/manage/contest/exportComprehensiveReport', data, { responseType: 'blob' }).then(ret => {
194+
resolve(ret);
195+
const blob = new Blob([ret.data], { type: ret.headers['content-type'] });
196+
const elink = document.createElement('a');
197+
const filename = new Date().getTime().toString();
198+
if ('download' in elink) {
199+
elink.download = filename;
200+
elink.href = URL.createObjectURL(blob);
201+
elink.click();
202+
URL.revokeObjectURL(elink.href);
203+
} else {
204+
navigator.msSaveBlob(blob, filename);
205+
}
206+
}, err => (reject(err)));
207+
})
208+
},
180209
// ----------------- 评测模板相关 -------------------
181210
// 查询单个评测模板
182211
getOneTemplate: function(id) {

0 commit comments

Comments
 (0)