diff --git a/static/src/js/app/admin/announcement/announcement.js b/static/src/js/app/admin/announcement/announcement.js index 9b6f2d2..fbb9779 100644 --- a/static/src/js/app/admin/announcement/announcement.js +++ b/static/src/js/app/admin/announcement/announcement.js @@ -26,11 +26,9 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "validator"], showGlobalViewRadio: true, isGlobal: true, allGroups: [], - getState: function (el) { //获取公告当前状态,显示 - if (el.visible) - return "可见"; - else - return "隐藏"; + getYesOrNo: function(yORn) { + if (yORn) return "是"; + return "否"; }, getNext: function () { if (!vm.nextPage) diff --git a/static/src/js/app/admin/problem/problem.js b/static/src/js/app/admin/problem/problem.js index c11d7c7..ced0d91 100644 --- a/static/src/js/app/admin/problem/problem.js +++ b/static/src/js/app/admin/problem/problem.js @@ -14,6 +14,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT page: 1, totalPage: 1, keyword: "", + showVisibleOnly: false, getNext: function () { if (!vm.nextPage) return; @@ -40,14 +41,23 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT }, showProblemSubmissionPage: function(problemId){ vm.$fire("up!showProblemSubmissionPage", problemId); + }, + getYesOrNo: function(yORn) { + if (yORn) return "是"; + return "否"; } }); + vm.$watch("showVisibleOnly", function () { + getPageData(1); + }); } getPageData(1); function getPageData(page) { var url = "/api/admin/problem/?paging=true&page=" + page + "&page_size=10"; if (vm.keyword != "") url += "&keyword=" + vm.keyword; + if (vm.showVisibleOnly) + url += "&visible=true"; $.ajax({ url: url, dataType: "json", diff --git a/template/src/admin/announcement/announcement.html b/template/src/admin/announcement/announcement.html index b909823..fbf612d 100644 --- a/template/src/admin/announcement/announcement.html +++ b/template/src/admin/announcement/announcement.html @@ -7,8 +7,8 @@