同步后台submission改动,status页面仅能查看用户有权查看的提交

This commit is contained in:
zemal 2017-07-05 21:12:03 +08:00
parent 9238bf76de
commit 6a8d2fb285
8 changed files with 80 additions and 63 deletions

View File

@ -220,7 +220,7 @@ export default {
})
},
getSubmission(id) {
return ajax('submissions', 'get', {
return ajax('submission', 'get', {
options: {
params: {
id

View File

@ -108,7 +108,6 @@ export default {
},
onLangChange(newVal) {
this.$refs.myEditor.editor.setOption('mode', this.mode[newVal])
console.log(newVal)
this.$emit('changeLang', newVal)
}
}

View File

@ -23,12 +23,17 @@ export default [
{
name: 'problem-submission-list',
path: '/status/problem/:id',
component: () => import('@/views/submission/SubmissionList')
component: () => import('@/views/submission/SubmissionList.vue')
},
{
name: 'submission-list',
path: '/status',
component: () => import('@/views/submission/SubmissionList')
component: () => import('@/views/submission/SubmissionList.vue')
},
{
name: 'submission-details',
path: '/status/:id',
component: () => import('@/views/submission/SubmissionDetails.vue')
},
{
name: 'logout',

View File

@ -1,50 +1,62 @@
export const STATUS = {
'-2': {
name: 'Compile Error',
color: 'yellow'
color: 'yellow',
type: 'warning'
},
'-1': {
name: 'Wrong Answer',
color: 'red'
color: 'red',
type: 'error'
},
'0': {
name: 'Accepted',
color: 'green'
color: 'green',
type: 'success'
},
'1': {
name: 'Time Limit Exceeded',
color: 'red'
color: 'red',
type: 'error'
},
'2': {
name: 'Time Limit Exceeded',
color: 'red'
color: 'red',
type: 'error'
},
'3': {
name: 'Memory Limit Exceeded',
color: 'red'
color: 'red',
type: 'error'
},
'4': {
name: 'Runtime Error',
color: 'red'
color: 'red',
type: 'error'
},
'5': {
name: 'System Error',
color: 'red'
color: 'red',
type: 'error'
},
'6': {
name: 'Pending',
color: 'yellow'
color: 'yellow',
type: 'error'
},
'7': {
name: 'Judging',
color: 'blue'
color: 'blue',
type: 'info'
},
'8': {
name: 'Partial Accepted',
color: 'blue'
color: 'blue',
type: 'info'
},
'9': {
name: 'Submitting',
color: 'yellow'
color: 'yellow',
type: 'warning'
}
}

View File

@ -159,7 +159,6 @@
mounted() {
api.getProblem(this.$route.params.id).then(res => {
this.problem = res.data.data
console.log(res.data.data)
bus.$emit('changeBread', this.problem.title)
})
},

View File

@ -1,38 +1,35 @@
<template>
<!--<Table stripe :disabled-hover="true" :columns="columns" :data="info"></Table>-->
<div>
Hello
<Alert
</div>
</template>
<script>
// import api from '@/api'
import api from '@/api'
export default {
name: 'test',
components: {
},
data() {
return {
code: ''
columns: [
{
title: 'TestCase',
type: 'index',
align: 'center'
// width: 60
}
],
info: []
}
},
mounted() {
// api.getProblem('1').then((res) => {
// console.log(res.data)
// })
api.getSubmission(this.$route.params.id).then((res) => {
console.log(res.data.data)
this.info = res.data.data.info.data
})
},
methods: {
onChangeCode(newCode) {
this.code = newCode
},
onChangeLang(newLang) {
this.language = newLang
}
}
methods: {}
}
</script>
<style scoped lang="less">
#breadcrumb {
outline: 1px;
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<Row type="flex" justify="space-around">
<Col :span="23">
<Table stripe :columns="columns" :data="submissions" @on-row-dblclick="handleDetails"></Table>
<Table stripe :disabled-hover="true" :columns="columns" :data="submissions"></Table>
</Col>
</Row>
</template>
@ -16,20 +16,39 @@
data() {
return {
columns: [
{
title: 'ID',
render: (h, params) => {
return h('span', params.row.id.slice(0, 10))
}
},
{
title: 'When',
align: 'center',
render: (h, params) => {
return h('span', utils.backendDatetimeFormat(params.row.created_time))
}
},
{
title: 'ID',
align: 'center',
render: (h, params) => {
if (params.row.show_link) {
return h('Button', {
props: {
type: 'text'
},
style: {
color: '#57a3f3'
},
on: {
click: () => {
this.$router.push('/status/' + params.row.id)
}
}
}, params.row.id.slice(0, 12))
} else {
return h('span', params.row.id.slice(0, 12))
}
}
},
{
title: 'Status',
align: 'center',
render: (h, params) => {
return h('Tag', {
props: {
@ -40,6 +59,7 @@
},
{
title: 'Problem ID',
align: 'center',
render: (h, params) => {
return h('Button',
{
@ -60,22 +80,26 @@
},
{
title: 'Time',
align: 'center',
render: (h, params) => {
return h('span', params.row.statistic_info.time_cost + 'MS')
}
},
{
title: 'Memory',
align: 'center',
render: (h, params) => {
return h('span', this.parseMemory(params.row.statistic_info.memory_cost))
}
},
{
title: 'Language',
align: 'center',
key: 'language'
},
{
title: 'Author',
align: 'center',
key: 'username'
}
],
@ -87,9 +111,6 @@
this.getProblemName()
},
methods: {
handleDetails(row) {
console.log(row)
},
parseMemory(memory) {
// 1048576 = 1024 * 1024
let t = parseInt(memory) / 1048576

View File

@ -6,35 +6,19 @@
<script>
// import api from '@/api'
import CodeMirror from '../components/CodeMirror.vue'
export default {
name: 'test',
components: {
CodeMirror
},
data() {
return {
code: ''
}
},
mounted() {
// api.getProblem('1').then((res) => {
// console.log(res.data)
// })
},
methods: {
onChangeCode(newCode) {
this.code = newCode
},
onChangeLang(newLang) {
this.language = newLang
}
}
}
</script>
<style scoped lang="less">
#breadcrumb {
outline: 1px;
}
</style>