1
0
Просмотр исходного кода

新增多媒体阅卷字数统计和json读取loading

ting.yin 5 лет назад
Родитель
Сommit
48ef91032b

+ 1 - 1
stmms-web/src/main/webapp/WEB-INF/views/modules/mark/markJson.jsp

@@ -35,8 +35,8 @@
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/mark-status.js"></script>
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/warning-info.js"></script>
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/change-name.js"></script>
-    <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/tag-process.js"></script>
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/view-sidebar.js"></script>
+    <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/problem-process.js"></script>
 
 </head>
 <body>

+ 16 - 3
stmms-web/src/main/webapp/static/mark-json/js/json-view.js

@@ -7,6 +7,7 @@ var json_view = function (option, success) {
 
 function JsonView(option) {
     this.markControl = option.markControl;
+    this.loading = false;
     this.init();
     this.markControl.on('step.board.show', this, function (event, context, eventObject) {
         this.container.removeClass('span12');
@@ -39,13 +40,14 @@ function JsonView(option) {
 JsonView.prototype.init = function () {
     var self = this;
     this.container = this.markControl.container.imageContent;
+    this.container.empty();
     this.container.height(this.markControl.container.centerContent.height());
     this.container.css('overflow', 'scroll');
     this.container.addClass('rich-text');
+    this.container.loading = getDom(this.loading_dom, this.markControl).appendTo(this.container);
 }
 
 JsonView.prototype.render = function () {
-    this.container.empty();
     if (this.task != undefined && this.task.jsonData != undefined) {
     	var questionNumberArr = new Array();
     	for (var i in this.task.markStepList) {
@@ -62,7 +64,7 @@ JsonView.prototype.render = function () {
  		 	var questionTitle = '<span>题号:'+ question.mainNumber+'-'+question.subNumber +'<span><br/>';
  			$(questionTitle).appendTo($(this.container)); 
  			$("<span>题干:<span>"+renderRichText(question.body)).appendTo($(this.container));
-        	$("<span>考生答案:<span>"+renderRichText(question.studentAnswer)).appendTo(this.container);
+        	$("<span>考生答案:<span>"+renderRichText(question.studentAnswer,true)).appendTo(this.container);
             $("<span>标准答案:<span>"+renderRichText(question.answer)).appendTo(this.container);
         });
         var viewer = new Viewer($('.image-content')[0], {
@@ -70,6 +72,17 @@ JsonView.prototype.render = function () {
         viewer.destroy();
         viewer = new Viewer($('.image-content')[0], {
         });
+        this.loading = false;
+        this.updateLoading();
         this.markControl.trigger('task.load.finish');
     }
-}
+}
+
+JsonView.prototype.updateLoading = function() {
+    if (this.loading) {
+        this.container.find('#json-loading').show();
+    } else {
+        this.container.find('#json-loading').hide();
+    }
+}
+JsonView.prototype.loading_dom = '<div id="json-loading"><img src="{staticServer}/mark-new/images/loding.gif"/><p>正在加载请稍候</p></div>';

+ 10 - 3
stmms-web/src/main/webapp/static/rich-text/js/render.js

@@ -1,19 +1,26 @@
-function renderRichText(body) {
+function renderRichText(body,isCount) {
     let sections = body.sections || [];
     let html = [];
     sections.forEach(section => {
-        html.push(renderSection(section));
+        html.push(renderSection(section,isCount));
     });
     return html.join('');
 }
 
-function renderSection(section) {
+function renderSection(section,isCount) {
     let blocks = section.blocks || [];
     let inline = blocks.length > 1;
     let html = [];
+    let count = 0;
     blocks.forEach(block => {
         html.push(renderBlock(block, inline));
+        if(isCount && block.type === 'text'){
+        	count = count + block.value.length;
+        }
     });
+    if(isCount){
+    	html.push("(字数统计:" + count + ")")
+    }
     return '<p>' + html.join('') + '</p>';
 }