Commit f5dbd4b7a07117944408fa043eb0061fb32235e2

Authored by 商艳涛
1 parent 19349ade

设置作业添加模板内容

dist/gxb-ide/CodingEditer.js
@@ -254,18 +254,21 @@ @@ -254,18 +254,21 @@
254 var _this = this; 254 var _this = this;
255 var _thisNum = num; 255 var _thisNum = num;
256 var treeLinkEditor = Dir.treeLinkEditor; 256 var treeLinkEditor = Dir.treeLinkEditor;
  257 + // TODO 如何设置模板
  258 + // 此方法仅限 作业自动打分时候设置 CodingEditer.template
  259 + var _template = CodingEditer.template || "";
257 if (_thisNum == 0) { 260 if (_thisNum == 0) {
258 for (var i = 0; i < treeLinkEditor.length; i++) { 261 for (var i = 0; i < treeLinkEditor.length; i++) {
259 var _path = treeLinkEditor[i].filePath; 262 var _path = treeLinkEditor[i].filePath;
260 console.log(treeLinkEditor) 263 console.log(treeLinkEditor)
261 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); 264 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}});
262 - treeLinkEditor[i].CodeMirrorRecord.setValue(""); 265 + treeLinkEditor[i].CodeMirrorRecord.setValue(_template);
263 } 266 }
264 } else if (_thisNum == 1) { 267 } else if (_thisNum == 1) {
265 for (var i = 0; i < treeLinkEditor.length; i++) { 268 for (var i = 0; i < treeLinkEditor.length; i++) {
266 if (treeLinkEditor[i].CodeMirrorReplay.getValue()) { 269 if (treeLinkEditor[i].CodeMirrorReplay.getValue()) {
267 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); 270 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true});
268 - treeLinkEditor[i].CodeMirrorReplay.setValue(""); 271 + treeLinkEditor[i].CodeMirrorReplay.setValue(_template);
269 } 272 }
270 } 273 }
271 } else { 274 } else {
@@ -276,10 +279,10 @@ @@ -276,10 +279,10 @@
276 for (var i = 0; i < treeLinkEditor.length; i++) { 279 for (var i = 0; i < treeLinkEditor.length; i++) {
277 if(treeLinkEditor[i].CodeMirrorRecord){ 280 if(treeLinkEditor[i].CodeMirrorRecord){
278 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); 281 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}});
279 - treeLinkEditor[i].CodeMirrorRecord.setValue(''); 282 + treeLinkEditor[i].CodeMirrorRecord.setValue(_template);
280 }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){ 283 }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){
281 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); 284 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true});
282 - treeLinkEditor[i].CodeMirrorReplay.setValue(""); 285 + treeLinkEditor[i].CodeMirrorReplay.setValue(_template);
283 } 286 }
284 } 287 }
285 } 288 }
dist/gxb-ide/Dir.js
@@ -639,6 +639,7 @@ @@ -639,6 +639,7 @@
639 console.log(res); 639 console.log(res);
640 // TODO 如何设置模板内容 640 // TODO 如何设置模板内容
641 if(getQuery('autoscore')){ 641 if(getQuery('autoscore')){
  642 + CodingEditer.template = res.programmingList[0].codeModel;
642 Dir.treeLinkEditor[0].CodeMirrorRecord.setValue(res.programmingList[0].codeModel); 643 Dir.treeLinkEditor[0].CodeMirrorRecord.setValue(res.programmingList[0].codeModel);
643 } 644 }
644 questionTitle.html(res.programmingList[0].title) 645 questionTitle.html(res.programmingList[0].title)
src/gxb-ide/CodingEditer.js
@@ -254,18 +254,21 @@ @@ -254,18 +254,21 @@
254 var _this = this; 254 var _this = this;
255 var _thisNum = num; 255 var _thisNum = num;
256 var treeLinkEditor = Dir.treeLinkEditor; 256 var treeLinkEditor = Dir.treeLinkEditor;
  257 + // TODO 如何设置模板
  258 + // 此方法仅限 作业自动打分时候设置 CodingEditer.template
  259 + var _template = CodingEditer.template || "";
257 if (_thisNum == 0) { 260 if (_thisNum == 0) {
258 for (var i = 0; i < treeLinkEditor.length; i++) { 261 for (var i = 0; i < treeLinkEditor.length; i++) {
259 var _path = treeLinkEditor[i].filePath; 262 var _path = treeLinkEditor[i].filePath;
260 console.log(treeLinkEditor) 263 console.log(treeLinkEditor)
261 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); 264 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}});
262 - treeLinkEditor[i].CodeMirrorRecord.setValue(""); 265 + treeLinkEditor[i].CodeMirrorRecord.setValue(_template);
263 } 266 }
264 } else if (_thisNum == 1) { 267 } else if (_thisNum == 1) {
265 for (var i = 0; i < treeLinkEditor.length; i++) { 268 for (var i = 0; i < treeLinkEditor.length; i++) {
266 if (treeLinkEditor[i].CodeMirrorReplay.getValue()) { 269 if (treeLinkEditor[i].CodeMirrorReplay.getValue()) {
267 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); 270 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true});
268 - treeLinkEditor[i].CodeMirrorReplay.setValue(""); 271 + treeLinkEditor[i].CodeMirrorReplay.setValue(_template);
269 } 272 }
270 } 273 }
271 } else { 274 } else {
@@ -276,10 +279,10 @@ @@ -276,10 +279,10 @@
276 for (var i = 0; i < treeLinkEditor.length; i++) { 279 for (var i = 0; i < treeLinkEditor.length; i++) {
277 if(treeLinkEditor[i].CodeMirrorRecord){ 280 if(treeLinkEditor[i].CodeMirrorRecord){
278 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); 281 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}});
279 - treeLinkEditor[i].CodeMirrorRecord.setValue(''); 282 + treeLinkEditor[i].CodeMirrorRecord.setValue(_template);
280 }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){ 283 }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){
281 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); 284 Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true});
282 - treeLinkEditor[i].CodeMirrorReplay.setValue(""); 285 + treeLinkEditor[i].CodeMirrorReplay.setValue(_template);
283 } 286 }
284 } 287 }
285 } 288 }
src/gxb-ide/Dir.js
@@ -639,6 +639,7 @@ @@ -639,6 +639,7 @@
639 console.log(res); 639 console.log(res);
640 // TODO 如何设置模板内容 640 // TODO 如何设置模板内容
641 if(getQuery('autoscore')){ 641 if(getQuery('autoscore')){
  642 + CodingEditer.template = res.programmingList[0].codeModel;
642 Dir.treeLinkEditor[0].CodeMirrorRecord.setValue(res.programmingList[0].codeModel); 643 Dir.treeLinkEditor[0].CodeMirrorRecord.setValue(res.programmingList[0].codeModel);
643 } 644 }
644 questionTitle.html(res.programmingList[0].title) 645 questionTitle.html(res.programmingList[0].title)