//多媒体显示模块 var json_loader = function (option, success) { var object = new JsonLoader(option); success(); return object; } function JsonLoader(option) { this.markControl = option.markControl; this.jsonServer = option.jsonServer; } JsonLoader.prototype.build = function (task, callback) { var self = this; if (task != undefined && task.jsonUrl != undefined) { // TODO-测试代码,读取固定的json文件 // var result = '[{"mainNumber": 2,"subNumber": 10,"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"}]},{"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"},{"type": "text","value": "我是答案答案daan"}]}]}}]'; // task.jsonData = JSON.parse(result); // callback(); var url = this.jsonServer + task.jsonUrl; $.get(url, function (result) { task.jsonData = result; callback(); }).error(function () { console.log('json load error:' + url); callback('json load error'); }); } }