You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.7 KiB
65 lines
2.7 KiB
<% include util %> |
|
<% include status_label %> |
|
|
|
<script src="//cdn.bootcss.com/textfit/2.3.1/textFit.min.js"></script> |
|
|
|
<script> |
|
const submissionUrl = <%- JSON.stringify(displayConfig.inContest ? |
|
syzoj.utils.makeUrl(['contest', 'submission', 'VanDarkholme']) : |
|
syzoj.utils.makeUrl(['submission', 'VanDarkholme'])) %>; |
|
const problemUrl = <%- JSON.stringify(displayConfig.inContest ? |
|
syzoj.utils.makeUrl(['contest', contest.id, 'problem', 'VanDarkholme']) : |
|
syzoj.utils.makeUrl(['problem', 'VanDarkholme'])) %>; |
|
|
|
Vue.component('submission-item', { |
|
template: '#submissionItemTemplate', |
|
props: ['data', 'config'], |
|
computed: { |
|
statusString() { |
|
const data = this.data; |
|
if (data.result) { |
|
return data.result.result; |
|
} else if (data.running) { |
|
return this.config.showResult ? 'Running' : 'Compiling'; |
|
} else return 'Waiting'; |
|
}, |
|
submissionLink() { |
|
return submissionUrl.replace('VanDarkholme', this.data.info.taskId); |
|
}, |
|
problemLink() { |
|
return problemUrl.replace('VanDarkholme', this.data.info.problemId); |
|
}, |
|
scoreClass() { |
|
return "score_" + (parseInt(this.data.result.score / 10) || 0).toString(); |
|
} |
|
}, |
|
methods: { |
|
alpha(number) { |
|
if (number && parseInt(number) == number && parseInt(number) > 0) return String.fromCharCode('A'.charCodeAt(0) + parseInt(number) - 1); |
|
} |
|
}, |
|
mounted() { |
|
textFit(this.$refs.problemLabel, { maxFontSize: 14 }); |
|
} |
|
}); |
|
</script> |
|
|
|
<script id="submissionItemTemplate" type="text/x-template"> |
|
<tr> |
|
<td><a :href="submissionLink">#{{ data.info.taskId }}</a></td> |
|
<td ref="problemLabel"><a :href="problemLink">#{{ config.inContest ? alpha(data.info.problemId) : data.info.problemId }}. {{ data.info.problemName }}</a></td> |
|
<td><a :href="submissionLink"><status-label :status="statusString"></status-label></a></td> |
|
|
|
<template v-if="data.result"> |
|
<td v-if="config.showScore"><span class="score" :class="scoreClass">{{ (data.result.score != null && data.result.score !== NaN) ? Math.floor(data.result.score) : '' }}</span></td> |
|
<td v-if="config.showUsage">{{ (data.result.time != null && data.result.time !== NaN) ? data.result.time.toString() + ' ms' : '' }}</td> |
|
<td v-if="config.showUsage">{{ (data.result.memory != null && data.result.memory !== NaN) ? data.result.memory.toString() + ' KiB' : '' }}</td> |
|
</template> <template v-else> |
|
<td v-if="config.showScore"/> <td v-if="config.showUsage"/> <td v-if="config.showUsage"/> |
|
</template> |
|
|
|
<td v-if="config.showCode">{{ data.info.language != null ? data.info.language + ' / ' : '' }}{{ data.info.codeSize }}</td> |
|
<td>{{ data.info.user }}</td> |
|
<td>{{ data.info.submitTime }}</td> |
|
</tr> |
|
</script> |