Commit f5dbd4b7a07117944408fa043eb0061fb32235e2
1 parent
19349ade
设置作业添加模板内容
Showing
4 changed files
with
16 additions
and
8 deletions
dist/gxb-ide/CodingEditer.js
| ... | ... | @@ -254,18 +254,21 @@ |
| 254 | 254 | var _this = this; |
| 255 | 255 | var _thisNum = num; |
| 256 | 256 | var treeLinkEditor = Dir.treeLinkEditor; |
| 257 | + // TODO 如何设置模板 | |
| 258 | + // 此方法仅限 作业自动打分时候设置 CodingEditer.template | |
| 259 | + var _template = CodingEditer.template || ""; | |
| 257 | 260 | if (_thisNum == 0) { |
| 258 | 261 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 259 | 262 | var _path = treeLinkEditor[i].filePath; |
| 260 | 263 | console.log(treeLinkEditor) |
| 261 | 264 | Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); |
| 262 | - treeLinkEditor[i].CodeMirrorRecord.setValue(""); | |
| 265 | + treeLinkEditor[i].CodeMirrorRecord.setValue(_template); | |
| 263 | 266 | } |
| 264 | 267 | } else if (_thisNum == 1) { |
| 265 | 268 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 266 | 269 | if (treeLinkEditor[i].CodeMirrorReplay.getValue()) { |
| 267 | 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 | 274 | } else { |
| ... | ... | @@ -276,10 +279,10 @@ |
| 276 | 279 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 277 | 280 | if(treeLinkEditor[i].CodeMirrorRecord){ |
| 278 | 281 | Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); |
| 279 | - treeLinkEditor[i].CodeMirrorRecord.setValue(''); | |
| 282 | + treeLinkEditor[i].CodeMirrorRecord.setValue(_template); | |
| 280 | 283 | }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){ |
| 281 | 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 | 639 | console.log(res); |
| 640 | 640 | // TODO 如何设置模板内容 |
| 641 | 641 | if(getQuery('autoscore')){ |
| 642 | + CodingEditer.template = res.programmingList[0].codeModel; | |
| 642 | 643 | Dir.treeLinkEditor[0].CodeMirrorRecord.setValue(res.programmingList[0].codeModel); |
| 643 | 644 | } |
| 644 | 645 | questionTitle.html(res.programmingList[0].title) | ... | ... |
src/gxb-ide/CodingEditer.js
| ... | ... | @@ -254,18 +254,21 @@ |
| 254 | 254 | var _this = this; |
| 255 | 255 | var _thisNum = num; |
| 256 | 256 | var treeLinkEditor = Dir.treeLinkEditor; |
| 257 | + // TODO 如何设置模板 | |
| 258 | + // 此方法仅限 作业自动打分时候设置 CodingEditer.template | |
| 259 | + var _template = CodingEditer.template || ""; | |
| 257 | 260 | if (_thisNum == 0) { |
| 258 | 261 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 259 | 262 | var _path = treeLinkEditor[i].filePath; |
| 260 | 263 | console.log(treeLinkEditor) |
| 261 | 264 | Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); |
| 262 | - treeLinkEditor[i].CodeMirrorRecord.setValue(""); | |
| 265 | + treeLinkEditor[i].CodeMirrorRecord.setValue(_template); | |
| 263 | 266 | } |
| 264 | 267 | } else if (_thisNum == 1) { |
| 265 | 268 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 266 | 269 | if (treeLinkEditor[i].CodeMirrorReplay.getValue()) { |
| 267 | 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 | 274 | } else { |
| ... | ... | @@ -276,10 +279,10 @@ |
| 276 | 279 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 277 | 280 | if(treeLinkEditor[i].CodeMirrorRecord){ |
| 278 | 281 | Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); |
| 279 | - treeLinkEditor[i].CodeMirrorRecord.setValue(''); | |
| 282 | + treeLinkEditor[i].CodeMirrorRecord.setValue(_template); | |
| 280 | 283 | }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){ |
| 281 | 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 | 639 | console.log(res); |
| 640 | 640 | // TODO 如何设置模板内容 |
| 641 | 641 | if(getQuery('autoscore')){ |
| 642 | + CodingEditer.template = res.programmingList[0].codeModel; | |
| 642 | 643 | Dir.treeLinkEditor[0].CodeMirrorRecord.setValue(res.programmingList[0].codeModel); |
| 643 | 644 | } |
| 644 | 645 | questionTitle.html(res.programmingList[0].title) | ... | ... |