disable submit button after submitting

This commit is contained in:
zema1 2018-09-07 14:28:06 +08:00
parent 12243757af
commit 97a672968e
3 changed files with 34 additions and 31 deletions

View File

@ -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

View File

@ -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'

View File

@ -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)