创建了单个比赛的详情页
This commit is contained in:
24
static/src/js/app/oj/contest/contest_password.js
Normal file
24
static/src/js/app/oj/contest/contest_password.js
Normal file
@@ -0,0 +1,24 @@
|
||||
require(["jquery", "bsAlert", "csrfToken"], function($, bsAlert, csrfTokenHeader){
|
||||
$("#contest-password-btn").click(function(){
|
||||
var password = $("#contest-password").val();
|
||||
if(!password){
|
||||
bsAlert("密码不能为空!");
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/contest/password/",
|
||||
data: {password: password, contest_id: location.href.split("/")[4]},
|
||||
method: "post",
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(!data.code){
|
||||
location.reload();
|
||||
}
|
||||
else{
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user