mirror of
https://github.com/QingdaoU/OnlineJudgeFE.git
synced 2024-12-28 07:21:50 +00:00
disable submit button after submitting
This commit is contained in:
parent
ec14ba848b
commit
b5bf87594c
@ -91,10 +91,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<Button type="warning" icon="edit" :loading="submitting" @click="submitCode"
|
||||
:disabled="problemSubmitDisabled"
|
||||
:disabled="problemSubmitDisabled || submitted"
|
||||
class="fl-right">
|
||||
<span v-if="!submitting">Submit</span>
|
||||
<span v-else>Submitting</span>
|
||||
<span v-if="submitting">Submitting</span>
|
||||
<span v-else-if="submitted">Submitted</span>
|
||||
<span v-else>Submit</span>
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
@ -228,6 +229,7 @@
|
||||
language: 'C++',
|
||||
theme: 'solarized',
|
||||
submissionId: '',
|
||||
submitted: false,
|
||||
result: {
|
||||
result: 9
|
||||
},
|
||||
@ -405,6 +407,7 @@
|
||||
const submitFunc = (data, detailsVisible) => {
|
||||
this.statusVisible = true
|
||||
api.submitCode(data).then(res => {
|
||||
this.submitted = true
|
||||
this.submissionId = res.data.data && res.data.data.submission_id
|
||||
// 定时检查状态
|
||||
this.submitting = false
|
||||
|
@ -1,41 +1,41 @@
|
||||
<template>
|
||||
<Row type="flex" justify="space-around">
|
||||
<Col :span="20" id="status">
|
||||
<Alert :type="status.type" showIcon>
|
||||
<span class="title">{{status.statusName}}</span>
|
||||
<div slot="desc" class="content">
|
||||
<template v-if="isCE">
|
||||
<pre>{{submission.statistic_info.err_info}}</pre>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>Time: {{submission.statistic_info.time_cost | submissionTime}}</span>
|
||||
<span>Memory: {{submission.statistic_info.memory_cost | submissionMemory}}</span>
|
||||
<span>Lang: {{submission.language}}</span>
|
||||
<span>Author: {{submission.username}}</span>
|
||||
</template>
|
||||
</div>
|
||||
</Alert>
|
||||
<Alert :type="status.type" showIcon>
|
||||
<span class="title">{{status.statusName}}</span>
|
||||
<div slot="desc" class="content">
|
||||
<template v-if="isCE">
|
||||
<pre>{{submission.statistic_info.err_info}}</pre>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>Time: {{submission.statistic_info.time_cost | submissionTime}}</span>
|
||||
<span>Memory: {{submission.statistic_info.memory_cost | submissionMemory}}</span>
|
||||
<span>Lang: {{submission.language}}</span>
|
||||
<span>Author: {{submission.username}}</span>
|
||||
</template>
|
||||
</div>
|
||||
</Alert>
|
||||
</Col>
|
||||
|
||||
<!--后台返info就显示出来, 权限控制放后台 -->
|
||||
<Col v-if="submission.info && !isCE" :span="20">
|
||||
<Table stripe :loading="loading" :disabled-hover="true" :columns="columns" :data="submission.info.data"></Table>
|
||||
<Table stripe :loading="loading" :disabled-hover="true" :columns="columns" :data="submission.info.data"></Table>
|
||||
</Col>
|
||||
|
||||
<Col :span="20">
|
||||
<Highlight :code="submission.code" :language="submission.language" :border-color="status.color"></Highlight>
|
||||
<Highlight :code="submission.code" :language="submission.language" :border-color="status.color"></Highlight>
|
||||
</Col>
|
||||
<Col v-if="submission.can_unshare" :span="20">
|
||||
<div id="share-btn">
|
||||
<Button v-if="submission.shared"
|
||||
type="warning" size="large" @click="shareSubmission(false)">
|
||||
UnShare
|
||||
</Button>
|
||||
<Button v-else
|
||||
type="primary" size="large" @click="shareSubmission(true)">
|
||||
Share
|
||||
</Button>
|
||||
</div>
|
||||
<div id="share-btn">
|
||||
<Button v-if="submission.shared"
|
||||
type="warning" size="large" @click="shareSubmission(false)">
|
||||
UnShare
|
||||
</Button>
|
||||
<Button v-else
|
||||
type="primary" size="large" @click="shareSubmission(true)">
|
||||
Share
|
||||
</Button>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
<script>
|
||||
import api from '@oj/api'
|
||||
import { JUDGE_STATUS } from '@/utils/constants'
|
||||
import {JUDGE_STATUS} from '@/utils/constants'
|
||||
import utils from '@/utils/utils'
|
||||
import Highlight from '@/pages/oj/components/Highlight'
|
||||
|
||||
|
@ -5,7 +5,7 @@ function utcToLocal (utcDt, format = 'YYYY-M-D HH:mm:ss') {
|
||||
return moment.utc(utcDt).local().format(format)
|
||||
}
|
||||
|
||||
// get duration from startTime to endTime, return like 3 days, 2 hours, one yead ..
|
||||
// get duration from startTime to endTime, return like 3 days, 2 hours, one year ..
|
||||
function duration (startTime, endTime) {
|
||||
let start = moment(startTime)
|
||||
let end = moment(endTime)
|
||||
|
Loading…
Reference in New Issue
Block a user