|
@@ -10,24 +10,21 @@ $(document).ready(function() {
|
|
});
|
|
});
|
|
|
|
|
|
function initSheetTagPopover(id, title, sheetServer, sheetUrl, answerUrl) {
|
|
function initSheetTagPopover(id, title, sheetServer, sheetUrl, answerUrl) {
|
|
- $.post('${ctx}/admin/exam/student/sheetTag', {id: id}, function(tags){
|
|
|
|
- //暂时屏蔽答案PDF显示
|
|
|
|
- initSheetTagPopoverContent(sheetServer, sheetUrl.split(','), '', tags, function(){
|
|
|
|
- sheetTagModal.setTitle(title);
|
|
|
|
- sheetTagModal.setContent($('#sheet-tag-content'));
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
$('#sheet-tag-tab-nav').empty();
|
|
$('#sheet-tag-tab-nav').empty();
|
|
$('#sheet-tag-tab-content').empty();
|
|
$('#sheet-tag-tab-content').empty();
|
|
|
|
|
|
sheetTagModal.setWidth($(window).width()*0.9);
|
|
sheetTagModal.setWidth($(window).width()*0.9);
|
|
sheetTagModal.setHeight($(window).height()*0.85);
|
|
sheetTagModal.setHeight($(window).height()*0.85);
|
|
sheetTagModal.setTitle('正在加载');
|
|
sheetTagModal.setTitle('正在加载');
|
|
|
|
+ //暂时屏蔽答案PDF显示
|
|
|
|
+ initSheetTagPopoverContent(sheetServer, sheetUrl.split(','), '', function(){
|
|
|
|
+ sheetTagModal.setTitle(title);
|
|
|
|
+ sheetTagModal.setContent($('#sheet-tag-content'));
|
|
|
|
+ });
|
|
sheetTagModal.open();
|
|
sheetTagModal.open();
|
|
}
|
|
}
|
|
|
|
|
|
-function initSheetTagPopoverContent(sheetServer, sheetUrls, answerUrl, tags, callback){
|
|
|
|
|
|
+function initSheetTagPopoverContent(sheetServer, sheetUrls, answerUrl, callback){
|
|
var leftDiv = $('#sheet-tag-left');
|
|
var leftDiv = $('#sheet-tag-left');
|
|
var rightDiv = $('#sheet-tag-right');
|
|
var rightDiv = $('#sheet-tag-right');
|
|
var tabNav = $('#sheet-tag-tab-nav');
|
|
var tabNav = $('#sheet-tag-tab-nav');
|
|
@@ -46,34 +43,18 @@ function initSheetTagPopoverContent(sheetServer, sheetUrls, answerUrl, tags, cal
|
|
|
|
|
|
tabNav.empty();
|
|
tabNav.empty();
|
|
tabContent.empty();
|
|
tabContent.empty();
|
|
- var loadCount=0;
|
|
|
|
for(var i=0;i<sheetUrls.length;i++){
|
|
for(var i=0;i<sheetUrls.length;i++){
|
|
tabNav.append($('<li><a href="#sheet_tag_'+i+'" data-toggle="tab">第'+(i+1)+'页</a></li>'));
|
|
tabNav.append($('<li><a href="#sheet_tag_'+i+'" data-toggle="tab">第'+(i+1)+'页</a></li>'));
|
|
- tabContent.append($('<div class="tab-pane fade" id="sheet_tag_'+i+'" style="overflow: scroll;"><canvas id="sheet-tag-canvas-'+i+'"></canvas></div>'));
|
|
|
|
-
|
|
|
|
|
|
+ tabContent.append($('<div class="tab-pane fade" id="sheet_tag_'+i+'" style="overflow: scroll;"></div>'));
|
|
var image = new Image();
|
|
var image = new Image();
|
|
- image.tagList = tags[i+1] || [];
|
|
|
|
- image.canvas = $('#sheet-tag-canvas-'+i)[0];
|
|
|
|
|
|
+ image.src = sheetServer + sheetUrls[i];
|
|
image.onload = function(){
|
|
image.onload = function(){
|
|
- this.canvas.width = Math.min(this.width, tabContent.width()>0?tabContent.width():($(window).width()*0.9-40));
|
|
|
|
- this.scaleRate = this.canvas.width / this.width;
|
|
|
|
- this.canvas.height = this.height * this.scaleRate;
|
|
|
|
- this.ctx = this.canvas.getContext("2d");
|
|
|
|
- this.ctx.drawImage(this, 0, 0, this.width, this.height, 0, 0, this.canvas.width, this.canvas.height);
|
|
|
|
- this.ctx.font ="20px Arial";
|
|
|
|
- this.ctx.fillStyle ='red';
|
|
|
|
- for(var j=0;j<this.tagList.length;j++) {
|
|
|
|
- var tag = this.tagList[j];
|
|
|
|
- this.ctx.fillText(tag.content, tag.left * this.scaleRate, tag.top * this.scaleRate);
|
|
|
|
- }
|
|
|
|
- loadCount++;
|
|
|
|
- if(loadCount==sheetUrls.length) {
|
|
|
|
- callback();
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- image.src = sheetServer + sheetUrls[i] + '?' + new Date().getTime();
|
|
|
|
|
|
+ this.width = Math.min(this.width, tabContent.width()>0?tabContent.width():($(window).width()*0.9-40));
|
|
|
|
+ }
|
|
|
|
+ $(image).appendTo($('#sheet_tag_'+i));
|
|
}
|
|
}
|
|
tabNav.find('a:first').trigger('click');
|
|
tabNav.find('a:first').trigger('click');
|
|
|
|
+ callback();
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
<div id="sheet-tag-content" class="container-fluid" style="display:none">
|
|
<div id="sheet-tag-content" class="container-fluid" style="display:none">
|