[前端-后台]统一各列表显示项目的大致顺序,为题目列表增添可见筛选,统一对列表中boolen值的显示,是/否[CI SKIP]

This commit is contained in:
esp
2015-08-27 15:18:31 +08:00
parent 09e30832f9
commit f3b88e85fc
5 changed files with 23 additions and 10 deletions

View File

@@ -26,11 +26,9 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "validator"],
showGlobalViewRadio: true, showGlobalViewRadio: true,
isGlobal: true, isGlobal: true,
allGroups: [], allGroups: [],
getState: function (el) { //获取公告当前状态,显示 getYesOrNo: function(yORn) {
if (el.visible) if (yORn) return "是";
return "可见"; return "";
else
return "隐藏";
}, },
getNext: function () { getNext: function () {
if (!vm.nextPage) if (!vm.nextPage)

View File

@@ -14,6 +14,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
page: 1, page: 1,
totalPage: 1, totalPage: 1,
keyword: "", keyword: "",
showVisibleOnly: false,
getNext: function () { getNext: function () {
if (!vm.nextPage) if (!vm.nextPage)
return; return;
@@ -40,14 +41,23 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
}, },
showProblemSubmissionPage: function(problemId){ showProblemSubmissionPage: function(problemId){
vm.$fire("up!showProblemSubmissionPage", problemId); vm.$fire("up!showProblemSubmissionPage", problemId);
},
getYesOrNo: function(yORn) {
if (yORn) return "是";
return "否";
} }
}); });
vm.$watch("showVisibleOnly", function () {
getPageData(1);
});
} }
getPageData(1); getPageData(1);
function getPageData(page) { function getPageData(page) {
var url = "/api/admin/problem/?paging=true&page=" + page + "&page_size=10"; var url = "/api/admin/problem/?paging=true&page=" + page + "&page_size=10";
if (vm.keyword != "") if (vm.keyword != "")
url += "&keyword=" + vm.keyword; url += "&keyword=" + vm.keyword;
if (vm.showVisibleOnly)
url += "&visible=true";
$.ajax({ $.ajax({
url: url, url: url,
dataType: "json", dataType: "json",

View File

@@ -7,8 +7,8 @@
<th>创建时间</th> <th>创建时间</th>
<th>更新时间</th> <th>更新时间</th>
<th>创建者</th> <th>创建者</th>
<td>可见范围</td> <th>可见范围</th>
<th>状态</th> <th>可见</th>
<th></th> <th></th>
</tr> </tr>
<tr ms-repeat="announcementList"> <tr ms-repeat="announcementList">
@@ -18,7 +18,7 @@
<td>{{ el.last_update_time|date("yyyy-MM-dd HH:mm:ss")}}</td> <td>{{ el.last_update_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.created_by.username }}</td> <td>{{ el.created_by.username }}</td>
<td ms-text="el.is_global?'全局可见':'组内可见'"></td> <td ms-text="el.is_global?'全局可见':'组内可见'"></td>
<td>{{ getState(el)}}</td> <td>{{ getYesOrNo(el.visible)}}</td>
<td> <td>
<button class="btn-sm btn-info" ms-click="editAnnouncement(el)">编辑</button> <button class="btn-sm btn-info" ms-click="editAnnouncement(el)">编辑</button>
</td> </td>

View File

@@ -16,18 +16,18 @@
<th>ID</th> <th>ID</th>
<th>比赛</th> <th>比赛</th>
<th>公开排名</th> <th>公开排名</th>
<th>可见</th>
<th>创建时间</th> <th>创建时间</th>
<th>创建者</th> <th>创建者</th>
<th>可见</th>
<th></th> <th></th>
</tr> </tr>
<tr ms-repeat="contestList"> <tr ms-repeat="contestList">
<td>{{ el.id }}</td> <td>{{ el.id }}</td>
<td>{{ el.title }}</td> <td>{{ el.title }}</td>
<td>{{ getYesOrNo(el.show_rank) }}</td> <td>{{ getYesOrNo(el.show_rank) }}</td>
<td>{{ getYesOrNo(el.visible) }}</td>
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td> <td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.created_by.username }}</td> <td>{{ el.created_by.username }}</td>
<td>{{ getYesOrNo(el.visible) }}</td>
<td> <td>
<a class="btn btn-info btn-sm" href="javascript:void(0)" ms-click="showEditContestArea($index+1)">编辑</a> <a class="btn btn-info btn-sm" href="javascript:void(0)" ms-click="showEditContestArea($index+1)">编辑</a>
<a class="btn btn-info btn-sm" href="javascript:void(0)" ms-click="showEditProblemArea($index+1)">题目</a> <a class="btn btn-info btn-sm" href="javascript:void(0)" ms-click="showEditProblemArea($index+1)">题目</a>

View File

@@ -17,6 +17,7 @@
<th>题目</th> <th>题目</th>
<th>创建时间</th> <th>创建时间</th>
<th>作者</th> <th>作者</th>
<td>可见</td>
<td>通过次数/提交总数</td> <td>通过次数/提交总数</td>
<td></td> <td></td>
</tr> </tr>
@@ -25,6 +26,7 @@
<td>{{ el.title }}</td> <td>{{ el.title }}</td>
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td> <td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.created_by.username }}</td> <td>{{ el.created_by.username }}</td>
<td>{{ getYesOrNo(el.visible) }}</td>
<td>{{ el.total_accepted_number }}/{{ el.total_submit_number }}</td> <td>{{ el.total_accepted_number }}/{{ el.total_submit_number }}</td>
<td> <td>
<button class="btn-sm btn-info" ms-click="showEditProblemPage(el.id)">编辑</button> <button class="btn-sm btn-info" ms-click="showEditProblemPage(el.id)">编辑</button>
@@ -32,6 +34,9 @@
</td> </td>
</tr> </tr>
</table> </table>
<div class="form-group">
<label>仅显示可见 <input ms-duplex-checked="showVisibleOnly" type="checkbox"/></label>
</div>
<div class="text-right"> <div class="text-right">
页数:{{ page }}/{{ totalPage }}&nbsp;&nbsp; 页数:{{ page }}/{{ totalPage }}&nbsp;&nbsp;
<button ms-attr-class="getBtnClass('pre')" ms-click="getPrevious">上一页</button> <button ms-attr-class="getBtnClass('pre')" ms-click="getPrevious">上一页</button>