Skip to content

Commit

Permalink
feat: Contest 页面超时后提示
Browse files Browse the repository at this point in the history
  • Loading branch information
YDX-2147483647 committed Aug 8, 2023
1 parent 26088be commit 7fc37a7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions contest/js/static_src/src/contest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Swal from 'sweetalert2'

import { get_data } from "./util"

/** 时间允差,毫秒 */
Expand Down Expand Up @@ -30,7 +32,22 @@ async function update_contest_progress () {
body: new FormData(form)
})
if (!response.ok && response.status == 403) {
// 锁定表单
filed_sets.forEach(set => set.disabled = true)

// 提示提交
const result = await Swal.fire({
title: '此次作答已超时',
html: '<p>无法再更改答卷,但您还可以查看自己的答卷。</p><p>(截止前作答部分已尽量保存)</p>',
icon: 'warning',
confirmButtonText: '现在提交',
showCancelButton: true,
cancelButtonText: '再看看答卷',
showCloseButton: true,
})
if (result.isConfirmed) {
form.submit()
}
}
}

Expand Down

0 comments on commit 7fc37a7

Please sign in to comment.