mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
Merge branch 'dev-s' into virusdefender-dev
* dev-s: 小调整,修改addContest的小bug, 修复小bug,仿照problem GET添加获取单个比赛信息的API 添加后台编辑比赛页面[CI SKIP] Conflicts: static/src/js/app/admin/contest/contestList.js static/src/js/app/admin/contest/editContest.js
This commit is contained in:
commit
c295d5d032
@ -136,8 +136,8 @@ class ProblemAdminAPIView(APIView):
|
|||||||
# 普通管理员只能获取自己创建的题目
|
# 普通管理员只能获取自己创建的题目
|
||||||
# 超级管理员可以获取全部的题目
|
# 超级管理员可以获取全部的题目
|
||||||
problem = Problem.objects.get(id=problem_id)
|
problem = Problem.objects.get(id=problem_id)
|
||||||
if request.user.admin_type != SUPER_ADMIN:
|
if request.user.admin_type != SUPER_ADMIN and problem.created_by != request.user:
|
||||||
problem = problem.get(created_by=request.user)
|
return error_response(u"题目不存在")
|
||||||
return success_response(ProblemSerializer(problem).data)
|
return success_response(ProblemSerializer(problem).data)
|
||||||
except Problem.DoesNotExist:
|
except Problem.DoesNotExist:
|
||||||
return error_response(u"题目不存在")
|
return error_response(u"题目不存在")
|
||||||
|
|||||||
@ -75,7 +75,7 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
|
|||||||
showGlobalViewRadio: true,
|
showGlobalViewRadio: true,
|
||||||
realTimeRank: true,
|
realTimeRank: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
showContestListPage: function() {
|
showContestListPage: function () {
|
||||||
avalon.vmodels.admin.template_url = "template/contest/contest_list.html";
|
avalon.vmodels.admin.template_url = "template/contest/contest_list.html";
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
|
|||||||
placeholder: "比赛介绍内容"
|
placeholder: "比赛介绍内容"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
avalon.scan();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/api/user/",
|
url: "/api/user/",
|
||||||
method: "get",
|
method: "get",
|
||||||
@ -111,19 +111,9 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
|
|||||||
vm.allGroups = [];
|
vm.allGroups = [];
|
||||||
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["isSelected"] = false;
|
item.isSelected = false;
|
||||||
vm.allGroups.push(item);
|
vm.allGroups.push(item);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
bsAlert(data.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/api/admin/contest/?contest_id=" + avalon.vmodels.admin.contestId,
|
url: "/api/admin/contest/?contest_id=" + avalon.vmodels.admin.contestId,
|
||||||
method: "get",
|
method: "get",
|
||||||
@ -146,12 +136,10 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
|
|||||||
vm.allGroups[i].isSelected = false;
|
vm.allGroups[i].isSelected = false;
|
||||||
}
|
}
|
||||||
for (var i = 0; i < contest.groups.length; i++) {
|
for (var i = 0; i < contest.groups.length; i++) {
|
||||||
var id = parseInt(contest.groups[i]);
|
var id = contest.groups[i];
|
||||||
console.log(id);
|
|
||||||
for (var index = 0; vm.allGroups[index]; index++) {
|
for (var index = 0; vm.allGroups[index]; index++) {
|
||||||
if (vm.allGroups[index].id == id) {
|
if (vm.allGroups[index].id == id) {
|
||||||
vm.allGroups[index].isSelected = true;
|
vm.allGroups[index].isSelected = true;
|
||||||
console.log(id+"asdf");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +151,14 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
avalon.scan();
|
}
|
||||||
|
else {
|
||||||
|
bsAlert(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("#contest_start_time").datetimepicker({
|
$("#contest_start_time").datetimepicker({
|
||||||
format: "yyyy-mm-dd hh:ii",
|
format: "yyyy-mm-dd hh:ii",
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
{{ request.user.username }}
|
{{ request.user.username }}
|
||||||
<span class="caret"></span></a>
|
<span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{% if request.user.admin_type == 2 %}
|
{% if request.user.admin_type > 0 %}
|
||||||
<li><a href="/admin/">后台管理</a></li>
|
<li><a href="/admin/">后台管理</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href="/submissions/">我的提交</a></li>
|
<li><a href="/submissions/">我的提交</a></li>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user