Skip to content

Commit 04442fc

Browse files
committed
add status list
1 parent dcf6574 commit 04442fc

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

src/assets/css/basic.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,18 @@ h3::before {
204204
position: fixed;
205205
}
206206

207+
.status-list-pagination {
208+
border: 1px solid #ebeef5;
209+
background: #ffffff;
210+
padding: 10px;
211+
height: 36px;
212+
text-align: center;
213+
bottom: 0;
214+
position: fixed;
215+
margin-left: auto;
216+
margin-right: auto;
217+
}
218+
207219
.el-dialog,
208220
.el-dialog__wrapper {
209221
z-index: 200000 !important;

src/components/status/list.vue

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<template>
2+
<div>
3+
<el-card class="item" v-if="alive">
4+
<AjaxTable
5+
:ajax_url="ajax_url"
6+
:columns="columns"
7+
:limit="limit"
8+
:total="data_count"
9+
:process="process"
10+
:default_sort="{prop: 'id', order: 'ascending'}"
11+
pagination_class="status-list-pagination"
12+
/>
13+
</el-card>
14+
</div>
15+
</template>
16+
17+
<script>
18+
import apiurl from './../../apiurl';
19+
import AjaxTable from './../lib/AjaxTable.vue';
20+
import ProblemTitleLink from './../problem/ProblemTitleLink.vue';
21+
22+
export default {
23+
name: 'StatusList',
24+
data() {
25+
return {
26+
alive: true,
27+
ajax_url: apiurl('/status/list'),
28+
limit: 50,
29+
columns: [{
30+
name: 'id',
31+
label: 'Run ID',
32+
width: '120',
33+
align: 'center',
34+
sortable: true
35+
}, {
36+
name: 'problem',
37+
label: 'Problem',
38+
sortable: false
39+
}, {
40+
name: 'score',
41+
label: 'Score',
42+
width: '120',
43+
align: 'center',
44+
sortable: true
45+
}, {
46+
name: 'state',
47+
label: 'Status',
48+
width: '120',
49+
align: 'center',
50+
sortable: false
51+
}, {
52+
name: 'time',
53+
label: 'Time',
54+
sortable: false
55+
}, {
56+
name: 'memory',
57+
label: 'Memory',
58+
sortable: false
59+
}, {
60+
name: 'lang',
61+
label: 'Language',
62+
sortable: false
63+
}, {
64+
name: 'owner',
65+
label: 'Author',
66+
sortable: false
67+
}],
68+
data_count: 10
69+
};
70+
},
71+
methods: {
72+
get_list_length() {
73+
this.$axios
74+
.get(apiurl('/status/list/count'))
75+
.then(response => {
76+
let data = response.data;
77+
this.data_count = data.res;
78+
})
79+
.catch(err => {
80+
this.$SegmentMessage.error(this, '[Status List] Get List Length Failed');
81+
console.log(err);
82+
});
83+
},
84+
process(x) {
85+
let color = '';
86+
if (x.score === 100) {
87+
color += 'color-success';
88+
} else if (x.score < 100 && x.score >= 0) {
89+
color += 'color-danger';
90+
} else {
91+
color += 'color-regular-text';
92+
}
93+
94+
x.problem = (<ProblemTitleLink pid={x.problem}></ProblemTitleLink>);
95+
96+
x.score = (<div class={color + ' text-extra-bold'}>{x.score >= 0 ? x.score : '-'}</div>);
97+
98+
return x;
99+
},
100+
},
101+
components: {
102+
AjaxTable
103+
},
104+
mounted() {
105+
this.get_list_length();
106+
}
107+
};
108+
</script>
109+
110+
<style scoped>
111+
.item {
112+
margin-top: 20px;
113+
}
114+
</style>
115+

0 commit comments

Comments
 (0)