//评卷状态模块 var mark_status = function(option, success) { var object = new MarkStatus(option); success(); return object; } function MarkStatus(option) { this.markControl = option.markControl; this.init(option); this.markControl.on('task.get.before', this, function(event, context, statusInfo) { this.topStatus.find('#stage-name').html('正在加载'); }); this.markControl.on('task.get.success', this, function(event, context, eventObject) { var task = context.task; //修改页面显示 this.topStatus.find('#stage-name').html(''); this.topStatus.find('#student-number').html(task.studentId); this.studentTitle.show(); if (task.objectiveScore != undefined) { this.objectiveArea.find('#objective-score').html(task.objectiveScore); this.objectiveArea.show(); } else { this.objectiveArea.hide(); } this.checkTopCount(task); }); this.markControl.on('task.get.none', this, function(event, context, status) { this.topStatus.find('#stage-name').html(''); this.topStatus.find('#student-number').html(''); this.studentTitle.hide(); this.objectiveArea.hide(); }); this.markControl.on('task.get.finish', this, function(event, context, status) { this.topStatus.find('#stage-name').html(''); this.topStatus.find('#student-number').html(''); this.studentTitle.hide(); this.objectiveArea.hide(); }); this.markControl.on('mark.status.change', this, function(event, context, status) { this.status = status; this.render(status); }); this.markControl.on('view.sidebar.open', this, function(event, context, eventObject) { this.blockProgress.hide(); }); this.markControl.on('view.sidebar.close', this, function(event, context, eventObject) { this.blockProgress.show(); }); } MarkStatus.prototype.init = function(option) { this.topStatus = getDom(this.status_dom, this.markControl).prependTo(this.markControl.container.header); this.blockProgress = getDom(this.progress_dom, this.markControl).insertAfter(this.topStatus); this.subjectTitle = this.topStatus.find('#subject-title'); this.studentTitle = this.topStatus.find('#student-title'); this.objectiveArea = this.topStatus.find('#objective-area'); this.popover = getDom(this.popover_dom, this.markControl); this.popover.hide(); this.popover.appendTo(this.markControl.container); var self = this; this.popover.find('#continue-button').click(function() { self.ignoreTopCount = true; self.popover.hide(); }); this.subjectTitle.find('#subject-name').html(option.subjectName); if (option.subjectSelectUrl != undefined) { this.subjectTitle.click(function() { window.location.href = option.subjectSelectUrl; }); } } MarkStatus.prototype.checkTopCount = function(task) { //任务限额提示 if (task != undefined && task.previous != true && this.status != undefined && this.status.topCount > 0 && this.status.markedCount >= this.status.topCount && this.ignoreTopCount != true) { this.popover.show(); } else { this.popover.hide(); } } MarkStatus.prototype.render = function(status) { if (status != undefined && status.valid === true) { var topCount = status.topCount; this.topStatus.find('#mark-count').html(status.personCount); //大题进度信息区域 if (this.blockProgress != undefined) { var totalCount = status.totalCount; var markedCount = status.markedCount; var exceptionCount = status.exceptionCount; var leftCount = totalCount > (markedCount + exceptionCount) ? (totalCount - markedCount - exceptionCount) : 0; var markedPercent = totalCount > 0 ? new Number((totalCount - leftCount) * 100 / totalCount).toFixed(0) : '0'; if (markedPercent == '100' && leftCount > 0) { markedPercent = '99'; } else if (markedPercent == '0' && markedCount > 0) { markedPercent = '1'; } if(topCount > 0){ if(this.blockProgress.find('#top-count').length == 0){ this.blockProgress.find('#todo-count').after('任务数'); this.blockProgress.find('#top-count').html(topCount); } } this.blockProgress.find('#total-count').html(totalCount); this.blockProgress.find('#marked-count').html(markedCount); this.blockProgress.find('#todo-count').html(leftCount); this.blockProgress.find('#exception-count').html(exceptionCount); this.blockProgress.find('#marked-percent').html(markedPercent + '%'); } if (status.totalCount > 0 && status.totalCount == status.markedCount) { this.markControl.context.isFinish = true; } } } MarkStatus.prototype.status_dom = '

\ \ \ 考生编号\ 客观得分\ 评卷数\

'; MarkStatus.prototype.progress_dom = '

\ 未评\ 进度\

'; MarkStatus.prototype.block_progress_bak_dom = '

\ 总数\ 已评\ 未评\ 异常\ 进度\

'; MarkStatus.prototype.popover_dom = '
\

分配任务已评完,是否继续?

\ 继续\ 退出\
';