mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 08:23:20 +00:00
修复代码冲突
This commit is contained in:
parent
f250dec201
commit
7b3c14343b
@ -293,7 +293,8 @@ def contest_list_page(request, page=1):
|
||||
# 筛选我能参加的比赛
|
||||
join = request.GET.get("join", None)
|
||||
if join:
|
||||
contests = Contest.objects.filter(Q(contest_type__in=[1, 2]) | Q(groups__in=request.user.group_set.all()))
|
||||
contests = Contest.objects.filter(Q(contest_type__in=[1, 2]) | Q(groups__in=request.user.group_set.all())).\
|
||||
filter(end_time__gt=datetime.datetime.now(), start_time__lt=datetime.datetime.now())
|
||||
|
||||
paginator = Paginator(contests, 20)
|
||||
try:
|
||||
|
@ -6,36 +6,52 @@
|
||||
@import url("webuploader/webuploader.css");
|
||||
@import url("datetime_picker/bootstrap-datetimepicker.css");
|
||||
@import url("tagEditor/jquery.tag-editor.css");
|
||||
@import url("contest/add_contest.css");
|
||||
|
||||
#loading-gif{
|
||||
#loading-gif {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: auto;
|
||||
position: absolute;
|
||||
top: 0; left: 0; bottom: 0; right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.line-chart{
|
||||
min-width:100%;
|
||||
.line-chart {
|
||||
min-width: 100%;
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
.pie-chart{
|
||||
min-width:100%;
|
||||
.pie-chart {
|
||||
min-width: 100%;
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
.chart-description{
|
||||
.chart-description {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pie-chart-container{
|
||||
.pie-chart-container {
|
||||
width: 50%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tag-editor{
|
||||
.tag-editor {
|
||||
border: 1px solid #d9d9d9;
|
||||
border-top-color: silver;
|
||||
}
|
||||
}
|
||||
|
||||
.group-tag {
|
||||
color: #46799b;
|
||||
background: #e0eaf1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border-radius: 2px 0 0 2px;
|
||||
float: left;
|
||||
padding: 0 4px;
|
||||
box-sizing: border-box;
|
||||
list-style-type: none;
|
||||
margin: 5px;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"], function ($, avalon, csrfTokenHeader, bsAlert, editor) {
|
||||
|
||||
avalon.ready(function () {
|
||||
if(avalon.vmodels.contestList){
|
||||
if (avalon.vmodels.contestList) {
|
||||
vm = avalon.vmodels.contestList;
|
||||
vm.editingContest = 0;
|
||||
vm.editingContest = 0;
|
||||
}
|
||||
else {
|
||||
var vm = avalon.define({
|
||||
@ -16,11 +16,11 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
||||
group: "-1",
|
||||
groupList: [],
|
||||
keyword: "",
|
||||
editingContestId: 0,
|
||||
editTitle: "",
|
||||
editProblemList: [],
|
||||
editPassword: "",
|
||||
editStartTime: "",
|
||||
editingContestId: 0,
|
||||
editTitle: "",
|
||||
editProblemList: [],
|
||||
editPassword: "",
|
||||
editStartTime: "",
|
||||
editEndTime: "",
|
||||
editMode: "",
|
||||
editShowRank: false,
|
||||
@ -30,8 +30,8 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
||||
editSamples: [],
|
||||
editTestCaseList: [],
|
||||
editChoseGroupList: [],
|
||||
modelNameList: ["ACM", "AC总数", "分数"],
|
||||
contestTypeNameList: ["小组赛", "公开赛", "有密码保护的公开赛"],
|
||||
modelNameList: ["ACM", "AC总数", "分数"],
|
||||
contestTypeNameList: ["小组赛", "公开赛", "有密码保护的公开赛"],
|
||||
getNext: function () {
|
||||
if (!vm.nextPage)
|
||||
return;
|
||||
@ -54,32 +54,32 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
||||
getPageData(page_index);
|
||||
},
|
||||
showEditContestArea: function (contestId) {
|
||||
if (contestId == vm.editingContestId)
|
||||
vm.editingContestId = 0;
|
||||
else {
|
||||
vm.editingContestId = contestId;
|
||||
vm.editTitle = vm.contestList[contestId-1].title;
|
||||
vm.editEndTime = vm.contestList[contestId-1].end_time;
|
||||
vm.editPassword = vm.contestList[contestId-1].password;
|
||||
vm.editStartTime = vm.contestList[contestId-1].start_time;
|
||||
vm.editMode = vm.contestList[contestId-1].mode;
|
||||
vm.editChoseGroupList = [];
|
||||
//= vm.contestList[contestId-1].group;//
|
||||
/*for (var key in vm.contestList[contestId-1].groups){
|
||||
var id = parseInt(vm.contestList[contestId-1].groups);
|
||||
for ()
|
||||
vm.editChoseGroupList.push({
|
||||
name:vm.groupList[vm.group].name,
|
||||
index:index,
|
||||
id:parseInt(vm.contestList[contestId-1].groups)
|
||||
});
|
||||
}*/
|
||||
vm.editShowRank = vm.contestList[contestId-1].show_rank;
|
||||
vm.editShowSubmission = vm.contestList[contestId-1].show_user_submission;
|
||||
//vm.editProblemList = vm.contestList[contestId-1].problems
|
||||
editor("#editor").setValue(vm.contestList[contestId-1].description);
|
||||
vm.editingProblemList = vm.contestList[contestId-1].problemList;
|
||||
}
|
||||
if (contestId == vm.editingContestId)
|
||||
vm.editingContestId = 0;
|
||||
else {
|
||||
vm.editingContestId = contestId;
|
||||
vm.editTitle = vm.contestList[contestId - 1].title;
|
||||
vm.editEndTime = vm.contestList[contestId - 1].end_time;
|
||||
vm.editPassword = vm.contestList[contestId - 1].password;
|
||||
vm.editStartTime = vm.contestList[contestId - 1].start_time;
|
||||
vm.editMode = vm.contestList[contestId - 1].mode;
|
||||
vm.editChoseGroupList = [];
|
||||
//= vm.contestList[contestId-1].group;//
|
||||
/*for (var key in vm.contestList[contestId-1].groups){
|
||||
var id = parseInt(vm.contestList[contestId-1].groups);
|
||||
for ()
|
||||
vm.editChoseGroupList.push({
|
||||
name:vm.groupList[vm.group].name,
|
||||
index:index,
|
||||
id:parseInt(vm.contestList[contestId-1].groups)
|
||||
});
|
||||
}*/
|
||||
vm.editShowRank = vm.contestList[contestId - 1].show_rank;
|
||||
vm.editShowSubmission = vm.contestList[contestId - 1].show_user_submission;
|
||||
//vm.editProblemList = vm.contestList[contestId-1].problems
|
||||
editor("#editor").setValue(vm.contestList[contestId - 1].description);
|
||||
vm.editingProblemList = vm.contestList[contestId - 1].problemList;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -112,7 +112,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
||||
|
||||
var isSuperAdmin = true;
|
||||
|
||||
$.ajax({ //用于获取该用户创建的所有小组的ajax请求
|
||||
$.ajax({ //用于获取该用户创建的所有小组的ajax请求
|
||||
|
||||
url: "/api/admin/group/",
|
||||
method: "get",
|
||||
@ -120,41 +120,20 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
if (!data.data.length) {
|
||||
bsAlert("您的用户权限只能创建组内比赛,但是您还没有创建过小组");
|
||||
return;
|
||||
bsAlert("您的用户权限只能创建组内比赛,但是您还没有创建过小组");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var item = data.data[i];
|
||||
item["chose"] = false;
|
||||
vm.groupList.push(item);
|
||||
}
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
var item = data.data[i];
|
||||
item["chose"] = false;
|
||||
vm.groupList.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: url,
|
||||
dataType: "json",
|
||||
method: "get",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
if (isSuperAdmin)
|
||||
vm.groupList.push({id:0, name:"所有人", chose: false});
|
||||
for (var key in data.data) {
|
||||
data.data[key].chose = false;
|
||||
vm.groupList.push(data.data[key]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
avalon.scan();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user