//多媒体显示模块 var json_loader = function (option, success) { var object = new JsonLoader(option); success(); return object; } function JsonLoader(option) { this.markControl = option.markControl; this.answerServer = option.answerServer; } JsonLoader.prototype.build = function (task, callback) { var self = this; if (task != undefined && task.answerUrl != undefined) { // TODO-测试代码,读取固定的json文件 // var result ='[{"mainNumber": 6,"subNumber": 1,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"},{"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"}]}]}}]'; // task.jsonData = JSON.parse(result); // callback(); var url = this.answerServer + task.answerUrl; $.get(url, function (result) { task.jsonData = result; callback(); }).error(function () { console.log('json load error:'+url); callback('json load error'); }); } }