|
@@ -44,78 +44,78 @@
|
|
|
dataType: "json",
|
|
|
success: function (data) {
|
|
|
paperqQuestions = data.questions;
|
|
|
- }
|
|
|
- })
|
|
|
- $.ajax({
|
|
|
- type: "GET",
|
|
|
- url: answerUrl,
|
|
|
- dataType: "json",
|
|
|
- success: function (data) {
|
|
|
- //var data ='[{"mainNumber": 6,"subNumber": 1,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "audio","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/19/3_8_19_15748452552644264.mp3"}]}]},"studentAnswer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"},{"type": "image","value": "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582709869784&di=39683b1330bd09bebd93c95fe925ca70&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10108%2F170%2Fw600h370%2F20190222%2Fd6de-htknpmh2595255.jpg"}]}]}}]';
|
|
|
- //data = JSON.parse(data);
|
|
|
- let questions = data || [];
|
|
|
- for (var j in questions) {
|
|
|
- var question = questions[j];
|
|
|
- var paperQuestion = paperqQuestions[j];
|
|
|
- // 按题号过滤
|
|
|
- if (questionArr[question.mainNumber + "." + question.subNumber] === true || questionNumbers == "") {
|
|
|
- let numberTitle = {
|
|
|
- "blocks": [{
|
|
|
- "type": "text",
|
|
|
- "param": {"bold": true},
|
|
|
- "value": "题号:" + question.mainNumber + "-" + question.subNumber
|
|
|
- }]
|
|
|
- };
|
|
|
- let bodyTitle = {
|
|
|
- "blocks": [{
|
|
|
- "type": "text",
|
|
|
- "param": {"bold": true},
|
|
|
- "value": "题干:"
|
|
|
- }]
|
|
|
- };
|
|
|
- let answerTitle = {
|
|
|
- "blocks": [{
|
|
|
- "type": "text",
|
|
|
- "param": {"bold": true},
|
|
|
- "value": "考生答案:"
|
|
|
- }, {
|
|
|
- "type": "text",
|
|
|
- "param": {
|
|
|
- "italic": true,
|
|
|
- "danger": true
|
|
|
- },
|
|
|
- "value": "(字数统计:" + textCount(question.answer) + ")"
|
|
|
- }]
|
|
|
- };
|
|
|
- let standardTitle = {
|
|
|
- "blocks": [{
|
|
|
- "type": "text",
|
|
|
- "param": {"bold": true},
|
|
|
- "value": "标准答案:"
|
|
|
- }]
|
|
|
- };
|
|
|
- this.holder = $('#json-view-content');
|
|
|
- $(renderSection(numberTitle)).appendTo(this.holder);
|
|
|
- $(renderSection(bodyTitle)).appendTo(this.holder);
|
|
|
- if (paperQuestion.parentBody != null && paperQuestion.parentBody != undefined) {
|
|
|
- $(renderRichText(paperQuestion.parentBody)).appendTo(this.holder);
|
|
|
+ $.ajax({
|
|
|
+ type: "GET",
|
|
|
+ url: answerUrl,
|
|
|
+ dataType: "json",
|
|
|
+ success: function (data) {
|
|
|
+ //var data ='[{"mainNumber": 6,"subNumber": 1,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "audio","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/19/3_8_19_15748452552644264.mp3"}]}]},"studentAnswer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"},{"type": "image","value": "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582709869784&di=39683b1330bd09bebd93c95fe925ca70&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10108%2F170%2Fw600h370%2F20190222%2Fd6de-htknpmh2595255.jpg"}]}]}}]';
|
|
|
+ //data = JSON.parse(data);
|
|
|
+ let questions = data || [];
|
|
|
+ for (var j in questions) {
|
|
|
+ var question = questions[j];
|
|
|
+ var paperQuestion = paperqQuestions[j];
|
|
|
+ // 按题号过滤
|
|
|
+ if (questionArr[question.mainNumber + "." + question.subNumber] === true || questionNumbers == "") {
|
|
|
+ let numberTitle = {
|
|
|
+ "blocks": [{
|
|
|
+ "type": "text",
|
|
|
+ "param": {"bold": true},
|
|
|
+ "value": "题号:" + question.mainNumber + "-" + question.subNumber
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ let bodyTitle = {
|
|
|
+ "blocks": [{
|
|
|
+ "type": "text",
|
|
|
+ "param": {"bold": true},
|
|
|
+ "value": "题干:"
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ let answerTitle = {
|
|
|
+ "blocks": [{
|
|
|
+ "type": "text",
|
|
|
+ "param": {"bold": true},
|
|
|
+ "value": "考生答案:"
|
|
|
+ }, {
|
|
|
+ "type": "text",
|
|
|
+ "param": {
|
|
|
+ "italic": true,
|
|
|
+ "danger": true
|
|
|
+ },
|
|
|
+ "value": "(字数统计:" + textCount(question.answer) + ")"
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ let standardTitle = {
|
|
|
+ "blocks": [{
|
|
|
+ "type": "text",
|
|
|
+ "param": {"bold": true},
|
|
|
+ "value": "标准答案:"
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ this.holder = $('#json-view-content');
|
|
|
+ $(renderSection(numberTitle)).appendTo(this.holder);
|
|
|
+ $(renderSection(bodyTitle)).appendTo(this.holder);
|
|
|
+ if (paperQuestion.parentBody != null && paperQuestion.parentBody != undefined) {
|
|
|
+ $(renderRichText(paperQuestion.parentBody)).appendTo(this.holder);
|
|
|
+ }
|
|
|
+ $(renderRichText(paperQuestion.body)).appendTo(this.holder);
|
|
|
+ $(renderSection(answerTitle)).appendTo(this.holder);
|
|
|
+ $(renderRichText(question.answer)).appendTo(this.holder);
|
|
|
+ $(renderSection(standardTitle)).appendTo(this.holder);
|
|
|
+ $(renderRichText(paperQuestion.answer)).appendTo(this.holder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.viewer != undefined) {
|
|
|
+ this.viewer.destroy();
|
|
|
}
|
|
|
- $(renderRichText(paperQuestion.body)).appendTo(this.holder);
|
|
|
- $(renderSection(answerTitle)).appendTo(this.holder);
|
|
|
- $(renderRichText(question.answer)).appendTo(this.holder);
|
|
|
- $(renderSection(standardTitle)).appendTo(this.holder);
|
|
|
- $(renderRichText(paperQuestion.answer)).appendTo(this.holder);
|
|
|
+ const viewer = new Viewer($('#json-view-content')[0], {});
|
|
|
}
|
|
|
- }
|
|
|
- if (this.viewer != undefined) {
|
|
|
- this.viewer.destroy();
|
|
|
- }
|
|
|
- const viewer = new Viewer($('#json-view-content')[0], {});
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
+
|
|
|
function textCount(jsonBody) {
|
|
|
let sections = jsonBody.sections || [];
|
|
|
let count = 0;
|