Commit b2d21f2dafb07de6a86137ed220d5bb5c9cc0c7b
1 parent
cc43c306
fix bug
Showing
5 changed files
with
85 additions
and
31 deletions
src/gxb-ide/CodingEditer.js
| ... | ... | @@ -138,7 +138,6 @@ |
| 138 | 138 | // } |
| 139 | 139 | starttime = parseInt(starttime) + parseInt(replayinterval); |
| 140 | 140 | } |
| 141 | - // starttime = parseInt(starttime) + parseInt(replayinterval); | |
| 142 | 141 | |
| 143 | 142 | timeoutcontroller = setTimeout(changeValueCallback(playbackrecord[i]), starttime/CodingEditer.speed); |
| 144 | 143 | CodingEditer.recordtimeoutcontrolls.push(timeoutcontroller); |
| ... | ... | @@ -247,7 +246,7 @@ |
| 247 | 246 | console.log('------------------------------------------------') |
| 248 | 247 | console.log(treeLinkEditor) |
| 249 | 248 | console.log('------------------------------------------------') |
| 250 | - | |
| 249 | + | |
| 251 | 250 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 252 | 251 | if(treeLinkEditor[i].CodeMirrorRecord){ |
| 253 | 252 | Dir.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); | ... | ... |
src/gxb-ide/Dir.js
| ... | ... | @@ -50,34 +50,74 @@ |
| 50 | 50 | init: function(){ |
| 51 | 51 | console.log('======================='); |
| 52 | 52 | }, |
| 53 | - initIdePage: function(el, id){ | |
| 53 | + initIdePage: function(el, id, isPlayPage, role){ | |
| 54 | 54 | var _url = "../data/" + id + ".json"; |
| 55 | 55 | var _lang = getLangName(id); |
| 56 | 56 | // console.log(id); |
| 57 | - // console.log(_lang); | |
| 58 | - $.ajax({ | |
| 59 | - type: "GET", | |
| 60 | - url: _url, | |
| 61 | - dataType: "json", | |
| 62 | - contentType: "application/json", | |
| 63 | - success: function(res) { | |
| 64 | - console.log(res); | |
| 65 | - | |
| 66 | - treeData = res[_lang]; | |
| 67 | - console.log(treeData); | |
| 68 | - treeObj = $.fn.zTree.init($(el), setting, treeData); | |
| 69 | - Dir.treeObj = $.fn.zTree.init($(el), setting, treeData); | |
| 70 | - | |
| 71 | - addTextareaPage(treeData); | |
| 72 | - | |
| 73 | - CodingEditer.initCodeMirror(treeLinkEditor); | |
| 74 | - | |
| 75 | - }, | |
| 76 | - error: function(XMLHttpRequest, textStatus, errorThrown) { | |
| 77 | - console.log('Ajax langs.json error'); | |
| 78 | - console.log(XMLHttpRequest); | |
| 57 | + console.log('======================='); | |
| 58 | + console.log(isPlayPage); | |
| 59 | + console.log(role); | |
| 60 | + | |
| 61 | + if (isPlayPage == 0) { | |
| 62 | + $.ajax({ | |
| 63 | + type: "GET", | |
| 64 | + url: _url, | |
| 65 | + dataType: "json", | |
| 66 | + contentType: "application/json", | |
| 67 | + success: function(res) { | |
| 68 | + console.log(res); | |
| 69 | + | |
| 70 | + treeData = res[_lang]; | |
| 71 | + console.log(treeData); | |
| 72 | + treeObj = $.fn.zTree.init($(el), setting, treeData); | |
| 73 | + Dir.treeObj = $.fn.zTree.init($(el), setting, treeData); | |
| 74 | + | |
| 75 | + addTextareaPage(treeData); | |
| 76 | + | |
| 77 | + CodingEditer.initCodeMirror(treeLinkEditor); | |
| 78 | + | |
| 79 | + }, | |
| 80 | + error: function(XMLHttpRequest, textStatus, errorThrown) { | |
| 81 | + console.log('Ajax langs.json error'); | |
| 82 | + console.log(XMLHttpRequest); | |
| 83 | + } | |
| 84 | + }); | |
| 85 | + }else if(isPlayPage == 1){ | |
| 86 | + var _codeReplayId = getQuery('codeReplayId'); | |
| 87 | + var _studentReplayId = getQuery('studentReplayId'); | |
| 88 | + | |
| 89 | + if (role == 0) { | |
| 90 | + playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; | |
| 91 | + } else if (role == 1) { | |
| 92 | + playUrl = gxb_api + "/programming/student/studentReplay/" + _codeReplayId + "/api"; | |
| 79 | 93 | } |
| 80 | - }); | |
| 94 | + | |
| 95 | + $.ajax({ | |
| 96 | + type: "GET", | |
| 97 | + url: playUrl, | |
| 98 | + dataType: "json", | |
| 99 | + contentType: "application/json", | |
| 100 | + success: function(res) { | |
| 101 | + console.log(res); | |
| 102 | + | |
| 103 | + treeData = res[_lang]; | |
| 104 | + console.log(treeData); | |
| 105 | + treeObj = $.fn.zTree.init($(el), setting, treeData); | |
| 106 | + Dir.treeObj = $.fn.zTree.init($(el), setting, treeData); | |
| 107 | + | |
| 108 | + addTextareaPage(treeData); | |
| 109 | + | |
| 110 | + CodingEditer.initCodeMirror(treeLinkEditor); | |
| 111 | + | |
| 112 | + }, | |
| 113 | + error: function(XMLHttpRequest, textStatus, errorThrown) { | |
| 114 | + console.log('Ajax langs.json error'); | |
| 115 | + console.log(XMLHttpRequest); | |
| 116 | + } | |
| 117 | + }); | |
| 118 | + | |
| 119 | + } | |
| 120 | + | |
| 81 | 121 | }, |
| 82 | 122 | showEdite: function(obj){ |
| 83 | 123 | |
| ... | ... | @@ -479,6 +519,7 @@ |
| 479 | 519 | }); |
| 480 | 520 | |
| 481 | 521 | window.Dir = Dir; |
| 522 | + window.DirSetting = setting; | |
| 482 | 523 | |
| 483 | 524 | })(window) |
| 484 | 525 | ... | ... |
src/gxb-ide/Ide.js
| ... | ... | @@ -15,19 +15,24 @@ |
| 15 | 15 | constructor: GxbIde, |
| 16 | 16 | options: { |
| 17 | 17 | el: "#dir", |
| 18 | + role: 0, | |
| 18 | 19 | userId: null, |
| 19 | - languageid: null | |
| 20 | + languageid: null, | |
| 21 | + isPlayPage: 0 | |
| 20 | 22 | }, |
| 21 | 23 | init: function(options){ |
| 22 | 24 | console.log(this); |
| 23 | 25 | var _this = this; |
| 24 | 26 | _this.options = $.extend(_this.options, options); |
| 25 | - _el = _this.options.el; | |
| 26 | - _langid = _this.options.languageid; | |
| 27 | + var _el = _this.options.el; | |
| 28 | + var _langid = _this.options.languageid; | |
| 29 | + var _isPlayPage = _this.options.isPlayPage; | |
| 30 | + var _role = _this.options.role; | |
| 31 | + | |
| 27 | 32 | console.log(this.options) |
| 28 | 33 | console.log(_el); |
| 29 | 34 | |
| 30 | - _this.dir.initIdePage(_el, _langid); | |
| 35 | + _this.dir.initIdePage(_el, _langid, _isPlayPage, _role); | |
| 31 | 36 | // Dir.init(); |
| 32 | 37 | |
| 33 | 38 | if (_this.options.languageid === 35) { | ... | ... |
src/js/c.js
| ... | ... | @@ -11,6 +11,7 @@ $(function(){ |
| 11 | 11 | // new一个基本IDE结构 |
| 12 | 12 | var ide = new GxbIde({ |
| 13 | 13 | el: '#folder', |
| 14 | + isPlayPage: 0, | |
| 14 | 15 | languageid: parseInt(_languageid) |
| 15 | 16 | }); |
| 16 | 17 | |
| ... | ... | @@ -21,13 +22,19 @@ $(function(){ |
| 21 | 22 | userId: _userId, |
| 22 | 23 | languageId: _languageid, |
| 23 | 24 | startCallback: function(){ |
| 25 | + // 禁止重命名 | |
| 26 | + setTimeout(function(){ | |
| 27 | + DirSetting.edit.showRenameBtn = false; | |
| 28 | + DirSetting.edit.enable = false; | |
| 29 | + $('.button.edit').hide(); | |
| 30 | + }, 0) | |
| 31 | + | |
| 24 | 32 | $("#countdown").show() |
| 25 | 33 | .find('img').attr('src', '../img/ready-go.gif') |
| 26 | 34 | .load(function() { |
| 27 | 35 | recordReady() |
| 28 | 36 | }) |
| 29 | 37 | iterm.compileResult() |
| 30 | - | |
| 31 | 38 | }, |
| 32 | 39 | stopCallback: function(){ |
| 33 | 40 | $("#countdown").find('img').attr('src', '') | ... | ... |