|
@@ -12,6 +12,9 @@ function MarkHistory(option) {
|
|
|
this.taskList = [];
|
|
|
this.container = this.markControl.container.sidebar;
|
|
|
this.loading = false;
|
|
|
+ this.order = "time"
|
|
|
+ this.sort = "desc";
|
|
|
+ var isTag = false;
|
|
|
|
|
|
this.markControl.initMarkFunction();
|
|
|
this.container.toggleButton = getDom(this.toggle_button_dom, this.markControl).appendTo(this.markControl.container.assistant.functionList);
|
|
@@ -30,12 +33,15 @@ function MarkHistory(option) {
|
|
|
var task = taskList[i];
|
|
|
var row = getDom(this.history_row_dom, this.markControl).appendTo(this.container.list);
|
|
|
row.find('.history-secret-number').html(task.studentId);
|
|
|
-
|
|
|
+ if(task.tags!=undefined && task.tags!=null ){
|
|
|
+ row.find('.history-secret-number').addClass('tips');
|
|
|
+ }
|
|
|
var date = new Date();
|
|
|
date.setTime(task.markTime);
|
|
|
row.find('.history-time').html(date.format('hh:mm:ss'));
|
|
|
row.find('.history-score').html(task.totalScore);
|
|
|
row.attr('data-index', i);
|
|
|
+
|
|
|
|
|
|
//回评任务处理
|
|
|
task.previous = true;
|
|
@@ -58,7 +64,8 @@ function MarkHistory(option) {
|
|
|
markHistory.onTaskSelect(index);
|
|
|
});
|
|
|
this.pageNumber = data.pageNumber;
|
|
|
- this.updateHeader();
|
|
|
+ this.updatePage();
|
|
|
+ this.updateSort(this.order,this.sort);
|
|
|
|
|
|
if (this.taskList.length > 0) {
|
|
|
this.onTaskSelect(0);
|
|
@@ -80,10 +87,11 @@ function MarkHistory(option) {
|
|
|
MarkHistory.prototype.init = function() {
|
|
|
this.container.empty();
|
|
|
|
|
|
- this.container.header = getDom(this.header_dom, this.markControl).appendTo(this.container);
|
|
|
this.container.paginator = getDom(this.paginator_dom, this.markControl).appendTo(this.container);
|
|
|
+ this.container.header = getDom(this.header_dom, this.markControl).appendTo(this.container);
|
|
|
+ this.container.search = getDom(this.history_search_dom, this.markControl).appendTo(this.container).find('#history-search');
|
|
|
this.container.list = getDom(this.history_list_dom, this.markControl).appendTo(this.container).find('#history-list');
|
|
|
-
|
|
|
+
|
|
|
var self = this;
|
|
|
this.container.header.find('#close-history-button').click(this, function(event) {
|
|
|
event.data.toggle(false);
|
|
@@ -92,14 +100,75 @@ MarkHistory.prototype.init = function() {
|
|
|
})
|
|
|
this.container.paginator.find('#last-page-button').click(this, function(event) {
|
|
|
var markHistory = event.data;
|
|
|
- markHistory.onSearch(markHistory.pageNumber + 1);
|
|
|
+ if (markHistory.taskList.length < markHistory.pageSize) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (self.container.search.find('#history-isTag').prop("checked")) {
|
|
|
+ markHistory.isTag=true;
|
|
|
+ } else{
|
|
|
+ markHistory.isTag=false;
|
|
|
+ }
|
|
|
+ markHistory.onSearch(markHistory.pageNumber + 1,markHistory.order,markHistory.sort,markHistory.isTag);
|
|
|
});
|
|
|
this.container.paginator.find('#next-page-button').click(this, function(event) {
|
|
|
var markHistory = event.data;
|
|
|
+ if (markHistory.pageNumber == 1) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
if (markHistory.pageNumber > 1) {
|
|
|
- markHistory.onSearch(markHistory.pageNumber - 1);
|
|
|
+ if (self.container.search.find('#history-isTag').prop("checked")) {
|
|
|
+ markHistory.isTag=true;
|
|
|
+ } else{
|
|
|
+ markHistory.isTag=false;
|
|
|
+ }
|
|
|
+ markHistory.onSearch(markHistory.pageNumber - 1,markHistory.order,markHistory.sort,markHistory.isTag);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.container.find('#studentId-search').click(this, function(event) {
|
|
|
+ var markHistory = event.data;
|
|
|
+ var studentId = self.container.find('#studentId-in').val();
|
|
|
+ var re = /^[1-9]+[0-9]*]*$/ ;
|
|
|
+ if(!re.test(studentId)){
|
|
|
+ alert("请输入数字");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (self.container.search.find('#history-isTag').prop("checked")) {
|
|
|
+ markHistory.isTag=true;
|
|
|
+ } else{
|
|
|
+ markHistory.isTag=false;
|
|
|
}
|
|
|
+ markHistory.onSearch(0,markHistory.order,markHistory.sort,markHistory.isTag,studentId);
|
|
|
+ });
|
|
|
+ this.container.find('#time-sort-th').click(this, function(event) {
|
|
|
+ self.orderSearch("time");
|
|
|
+ });
|
|
|
+ this.container.find('#studentId-sort-th').click(this, function(event) {
|
|
|
+ self.orderSearch("studentId");
|
|
|
+ });
|
|
|
+ this.container.find('#score-sort-th').click(this, function(event) {
|
|
|
+ self.orderSearch("score");
|
|
|
});
|
|
|
+
|
|
|
+ self.updateSort(self.order,self.sort);
|
|
|
+ self.updateLoading();
|
|
|
+
|
|
|
+ this.container.find('#studentId-in').click(this, function(event) {
|
|
|
+ self.markControl.trigger('mark.focus.change');
|
|
|
+ });
|
|
|
+}
|
|
|
+MarkHistory.prototype.orderSearch = function(order) {
|
|
|
+ this.order = order;
|
|
|
+ if(this.sort == "asc"){
|
|
|
+ this.sort = "desc";
|
|
|
+ }else if(this.sort == "desc"){
|
|
|
+ this.sort = "asc";
|
|
|
+ }
|
|
|
+ if (this.container.search.find('#history-isTag').prop("checked")) {
|
|
|
+ this.isTag=true;
|
|
|
+ } else{
|
|
|
+ this.isTag=false;
|
|
|
+ }
|
|
|
+ this.onSearch(this.pageNumber,this.order,this.sort,this.isTag);
|
|
|
}
|
|
|
|
|
|
MarkHistory.prototype.toggle = function(enable) {
|
|
@@ -110,45 +179,77 @@ MarkHistory.prototype.toggle = function(enable) {
|
|
|
this.markControl.setTask(undefined);
|
|
|
this.markControl.trigger('mark.sidebar.open');
|
|
|
this.markControl.trigger('mark.history.open');
|
|
|
- this.updateHeader();
|
|
|
+ this.updatePage();
|
|
|
this.container.list.empty();
|
|
|
- this.container.removeClass('hide');
|
|
|
+ this.container.show();
|
|
|
this.onSearch();
|
|
|
} else {
|
|
|
- this.container.addClass('hide');
|
|
|
+ this.container.hide();
|
|
|
this.markControl.trigger('mark.sidebar.close');
|
|
|
this.markControl.trigger('mark.history.close');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-MarkHistory.prototype.updateHeader = function() {
|
|
|
- this.container.header.find('#history-start').html(this.pageSize * (this.pageNumber - 1));
|
|
|
- this.container.header.find('#history-end').html(this.pageSize * this.pageNumber);
|
|
|
+MarkHistory.prototype.updatePage = function() {
|
|
|
+ this.container.paginator.find('#history-start').html(this.pageSize * (this.pageNumber - 1));
|
|
|
+ this.container.paginator.find('#history-end').html(this.pageSize * this.pageNumber);
|
|
|
|
|
|
- if (this.pageNumber == 1) {
|
|
|
- this.container.paginator.find('#next-page-label').show();
|
|
|
- this.container.paginator.find('#next-page-button').hide();
|
|
|
- } else {
|
|
|
- this.container.paginator.find('#next-page-label').hide();
|
|
|
- this.container.paginator.find('#next-page-button').show();
|
|
|
+// if (this.pageNumber == 1) {
|
|
|
+// this.container.paginator.find('#next-page-button').hide();
|
|
|
+// }else{
|
|
|
+// this.container.paginator.find('#next-page-button').show();
|
|
|
+// }
|
|
|
+// if (this.taskList.length < this.pageSize) {
|
|
|
+// this.container.paginator.find('#last-page-button').hide();
|
|
|
+// } else{
|
|
|
+// this.container.paginator.find('#last-page-button').show();
|
|
|
+// }
|
|
|
+
|
|
|
+}
|
|
|
+MarkHistory.prototype.updateLoading = function() {
|
|
|
+ if (this.loading) {
|
|
|
+ this.container.find('#history-loading').show();
|
|
|
+ }else{
|
|
|
+ this.container.find('#history-loading').hide();
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- if (this.taskList.length < this.pageSize) {
|
|
|
- this.container.paginator.find('#last-page-label').show();
|
|
|
- this.container.paginator.find('#last-page-button').hide();
|
|
|
- } else {
|
|
|
- this.container.paginator.find('#last-page-label').hide();
|
|
|
- this.container.paginator.find('#last-page-button').show();
|
|
|
- }
|
|
|
+MarkHistory.prototype.updateSort = function(order,sort) {
|
|
|
+ this.container.find('#time-sort').removeClass();
|
|
|
+ this.container.find('#studentId-sort').removeClass();
|
|
|
+ this.container.find('#score-sort').removeClass();
|
|
|
+ if(sort == 'desc'){
|
|
|
+ this.container.find('#'+order+'-sort').addClass("down");
|
|
|
+ }else{
|
|
|
+ this.container.find('#'+order+'-sort').addClass("up");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-MarkHistory.prototype.onSearch = function(pageNumber) {
|
|
|
+MarkHistory.prototype.onSearch = function(pageNumber,order,sort,isTag,studentId) {
|
|
|
if (pageNumber == undefined || pageNumber < 1) {
|
|
|
pageNumber = 1;
|
|
|
}
|
|
|
+ if (order == undefined ) {
|
|
|
+ order = "time";
|
|
|
+ }
|
|
|
+ if (sort == undefined ) {
|
|
|
+ sort = "desc";
|
|
|
+ }
|
|
|
+ if (isTag == undefined ) {
|
|
|
+ isTag = false;
|
|
|
+ }
|
|
|
+ if (studentId == undefined || studentId=="") {
|
|
|
+ studentId = null;
|
|
|
+ }
|
|
|
this.markControl.getHistory({
|
|
|
pageNumber: pageNumber,
|
|
|
- pageSize: this.pageSize
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ order : order,
|
|
|
+ sort : sort,
|
|
|
+ isTag : isTag,
|
|
|
+ studentId :studentId
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -172,18 +273,27 @@ MarkHistory.prototype.onTaskSelect = function(index) {
|
|
|
MarkHistory.prototype.toggle_button_dom = '<a href="#">回评</a>';
|
|
|
|
|
|
MarkHistory.prototype.header_dom = '<div class="header">\
|
|
|
-<p class="fl">前<i class="yellow" id="history-start"></i>-前<i class="yellow" id="history-end"></i></p>\
|
|
|
-<a href="#" id="close-history-button"><img src="{staticServer}/mark-new/images/hp-close.png"></a>\
|
|
|
+<p class="fl">回评</p>\
|
|
|
+<a href="#" id="close-history-button"><img src="{staticServer}/mark-new/images/hp-close.png" /></a>\
|
|
|
+</div>';
|
|
|
+
|
|
|
+MarkHistory.prototype.paginator_dom = '<div class="c-page">\
|
|
|
+<a class="back" id="last-page-button" href="#"></a>\
|
|
|
+<a class="next" id="next-page-button" href="#"></a>\
|
|
|
+<span>前<i class="yellow" id="history-start"></i>-前<i class="yellow" id="history-end"></i></span>\
|
|
|
</div>';
|
|
|
|
|
|
-MarkHistory.prototype.paginator_dom = '<div class="m-pagination"><a id="last-page-button" href="#">上一页</a>\
|
|
|
-<i id="last-page-label">上一页</i>\
|
|
|
-<a id="next-page-button" href="#">下一页</a>\
|
|
|
-<i id="next-page-label">下一页</i></div>';
|
|
|
+MarkHistory.prototype.history_search_dom = '<div class="c-scbar cl">\
|
|
|
+<table id="history-search" cellpadding="0" cellspacing="0" width="100%">\
|
|
|
+<tr><td class="sc"><span><input type="text" placeholder="查找试卷" id="studentId-in" maxlength="10"/><em id="studentId-search"></em></span></td>\
|
|
|
+</tr></table></div>';
|
|
|
|
|
|
-MarkHistory.prototype.history_list_dom = '<div class="sublist"><table class="table table-hover">\
|
|
|
-<thead><tr><th>编号</th><th>时间</th><th>总分</th></tr></thead>\
|
|
|
-<tbody id="history-list"></tbody></table></div>';
|
|
|
+MarkHistory.prototype.history_list_dom = '<div class="sublist"><div class="c-table">\
|
|
|
+<table class="table table-hover" cellpadding="0" cellspacing="0" width="100%">\
|
|
|
+<thead><tr><th id="studentId-sort-th">编号<em class="up" id="studentId-sort"></th>\
|
|
|
+<th id="time-sort-th">时间<em class="up" id="time-sort"></em></th><th id="score-sort-th">总分<em class="up" id="score-sort"></th></tr></thead>\
|
|
|
+<tbody class="loding" id="history-loading"><tr><td colspan="3"><div><img src="{staticServer}/mark-new/images/loding.gif"/></div><p>正在加载请稍候</p></td></tr></tbody>\
|
|
|
+<tbody id="history-list"></tbody></table></div></div>';
|
|
|
|
|
|
MarkHistory.prototype.history_row_dom = '<tr><td class="history-secret-number"></td>\
|
|
|
<td class="history-time"></td><td class="history-score"></td></tr>';
|