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)
|
join = request.GET.get("join", None)
|
||||||
if join:
|
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)
|
paginator = Paginator(contests, 20)
|
||||||
try:
|
try:
|
||||||
|
@ -6,36 +6,52 @@
|
|||||||
@import url("webuploader/webuploader.css");
|
@import url("webuploader/webuploader.css");
|
||||||
@import url("datetime_picker/bootstrap-datetimepicker.css");
|
@import url("datetime_picker/bootstrap-datetimepicker.css");
|
||||||
@import url("tagEditor/jquery.tag-editor.css");
|
@import url("tagEditor/jquery.tag-editor.css");
|
||||||
@import url("contest/add_contest.css");
|
|
||||||
|
|
||||||
#loading-gif{
|
#loading-gif {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0; left: 0; bottom: 0; right: 0;
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-chart{
|
.line-chart {
|
||||||
min-width:100%;
|
min-width: 100%;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pie-chart{
|
.pie-chart {
|
||||||
min-width:100%;
|
min-width: 100%;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart-description{
|
.chart-description {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pie-chart-container{
|
.pie-chart-container {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor{
|
.tag-editor {
|
||||||
border: 1px solid #d9d9d9;
|
border: 1px solid #d9d9d9;
|
||||||
border-top-color: silver;
|
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) {
|
require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"], function ($, avalon, csrfTokenHeader, bsAlert, editor) {
|
||||||
|
|
||||||
avalon.ready(function () {
|
avalon.ready(function () {
|
||||||
if(avalon.vmodels.contestList){
|
if (avalon.vmodels.contestList) {
|
||||||
vm = avalon.vmodels.contestList;
|
vm = avalon.vmodels.contestList;
|
||||||
vm.editingContest = 0;
|
vm.editingContest = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var vm = avalon.define({
|
var vm = avalon.define({
|
||||||
@ -16,11 +16,11 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
|||||||
group: "-1",
|
group: "-1",
|
||||||
groupList: [],
|
groupList: [],
|
||||||
keyword: "",
|
keyword: "",
|
||||||
editingContestId: 0,
|
editingContestId: 0,
|
||||||
editTitle: "",
|
editTitle: "",
|
||||||
editProblemList: [],
|
editProblemList: [],
|
||||||
editPassword: "",
|
editPassword: "",
|
||||||
editStartTime: "",
|
editStartTime: "",
|
||||||
editEndTime: "",
|
editEndTime: "",
|
||||||
editMode: "",
|
editMode: "",
|
||||||
editShowRank: false,
|
editShowRank: false,
|
||||||
@ -30,8 +30,8 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
|||||||
editSamples: [],
|
editSamples: [],
|
||||||
editTestCaseList: [],
|
editTestCaseList: [],
|
||||||
editChoseGroupList: [],
|
editChoseGroupList: [],
|
||||||
modelNameList: ["ACM", "AC总数", "分数"],
|
modelNameList: ["ACM", "AC总数", "分数"],
|
||||||
contestTypeNameList: ["小组赛", "公开赛", "有密码保护的公开赛"],
|
contestTypeNameList: ["小组赛", "公开赛", "有密码保护的公开赛"],
|
||||||
getNext: function () {
|
getNext: function () {
|
||||||
if (!vm.nextPage)
|
if (!vm.nextPage)
|
||||||
return;
|
return;
|
||||||
@ -54,32 +54,32 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
|||||||
getPageData(page_index);
|
getPageData(page_index);
|
||||||
},
|
},
|
||||||
showEditContestArea: function (contestId) {
|
showEditContestArea: function (contestId) {
|
||||||
if (contestId == vm.editingContestId)
|
if (contestId == vm.editingContestId)
|
||||||
vm.editingContestId = 0;
|
vm.editingContestId = 0;
|
||||||
else {
|
else {
|
||||||
vm.editingContestId = contestId;
|
vm.editingContestId = contestId;
|
||||||
vm.editTitle = vm.contestList[contestId-1].title;
|
vm.editTitle = vm.contestList[contestId - 1].title;
|
||||||
vm.editEndTime = vm.contestList[contestId-1].end_time;
|
vm.editEndTime = vm.contestList[contestId - 1].end_time;
|
||||||
vm.editPassword = vm.contestList[contestId-1].password;
|
vm.editPassword = vm.contestList[contestId - 1].password;
|
||||||
vm.editStartTime = vm.contestList[contestId-1].start_time;
|
vm.editStartTime = vm.contestList[contestId - 1].start_time;
|
||||||
vm.editMode = vm.contestList[contestId-1].mode;
|
vm.editMode = vm.contestList[contestId - 1].mode;
|
||||||
vm.editChoseGroupList = [];
|
vm.editChoseGroupList = [];
|
||||||
//= vm.contestList[contestId-1].group;//
|
//= vm.contestList[contestId-1].group;//
|
||||||
/*for (var key in vm.contestList[contestId-1].groups){
|
/*for (var key in vm.contestList[contestId-1].groups){
|
||||||
var id = parseInt(vm.contestList[contestId-1].groups);
|
var id = parseInt(vm.contestList[contestId-1].groups);
|
||||||
for ()
|
for ()
|
||||||
vm.editChoseGroupList.push({
|
vm.editChoseGroupList.push({
|
||||||
name:vm.groupList[vm.group].name,
|
name:vm.groupList[vm.group].name,
|
||||||
index:index,
|
index:index,
|
||||||
id:parseInt(vm.contestList[contestId-1].groups)
|
id:parseInt(vm.contestList[contestId-1].groups)
|
||||||
});
|
});
|
||||||
}*/
|
}*/
|
||||||
vm.editShowRank = vm.contestList[contestId-1].show_rank;
|
vm.editShowRank = vm.contestList[contestId - 1].show_rank;
|
||||||
vm.editShowSubmission = vm.contestList[contestId-1].show_user_submission;
|
vm.editShowSubmission = vm.contestList[contestId - 1].show_user_submission;
|
||||||
//vm.editProblemList = vm.contestList[contestId-1].problems
|
//vm.editProblemList = vm.contestList[contestId-1].problems
|
||||||
editor("#editor").setValue(vm.contestList[contestId-1].description);
|
editor("#editor").setValue(vm.contestList[contestId - 1].description);
|
||||||
vm.editingProblemList = vm.contestList[contestId-1].problemList;
|
vm.editingProblemList = vm.contestList[contestId - 1].problemList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
|||||||
|
|
||||||
var isSuperAdmin = true;
|
var isSuperAdmin = true;
|
||||||
|
|
||||||
$.ajax({ //用于获取该用户创建的所有小组的ajax请求
|
$.ajax({ //用于获取该用户创建的所有小组的ajax请求
|
||||||
|
|
||||||
url: "/api/admin/group/",
|
url: "/api/admin/group/",
|
||||||
method: "get",
|
method: "get",
|
||||||
@ -120,41 +120,20 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker"]
|
|||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (!data.code) {
|
if (!data.code) {
|
||||||
if (!data.data.length) {
|
if (!data.data.length) {
|
||||||
bsAlert("您的用户权限只能创建组内比赛,但是您还没有创建过小组");
|
bsAlert("您的用户权限只能创建组内比赛,但是您还没有创建过小组");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (var i = 0; i < data.data.length; i++) {
|
for (var i = 0; i < data.data.length; i++) {
|
||||||
var item = data.data[i];
|
var item = data.data[i];
|
||||||
item["chose"] = false;
|
item["chose"] = false;
|
||||||
vm.groupList.push(item);
|
vm.groupList.push(item);
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bsAlert(data.data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
bsAlert(data.data);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
avalon.scan();
|
avalon.scan();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user