Commit 93108b72432e9c9058bdcc07e764b2e7a28bd97d

Authored by ykxie
1 parent b38cf273

add some file

src/data/10.json 0 → 100644
  1 +{
  2 + "java": [
  3 + { "id": 1, "pId": 0, "name": "package1", "open": true, "isParent": true, "collapse": false },
  4 + { "id": 11, "pId": 1, "name": "default1.java", "type": "java" },
  5 + { "id": 12, "pId": 1, "name": "default2.java", "type": "java" },
  6 + { "id": 13, "pId": 1, "name": "default3.java", "type": "java" },
  7 + { "id": 14, "pId": 1, "name": "default4.java", "type": "java" },
  8 + { "id": 15, "pId": 1, "name": "default5.java", "type": "java" },
  9 + { "id": 2, "pId": 0, "name": "package2", "open": true, "isParent": true, "expand": true },
  10 + { "id": 21, "pId": 2, "name": "defaultA.java", "type": "java" },
  11 + { "id": 22, "pId": 2, "name": "defaultB.java", "type": "java" },
  12 + { "id": 23, "pId": 2, "name": "defaultC.java", "type": "java" },
  13 + { "id": 24, "pId": 2, "name": "defaultD.java", "type": "java" },
  14 + { "id": 25, "pId": 2, "name": "defaultE.java", "type": "java" }
  15 + ]
  16 +}
0 \ No newline at end of file 17 \ No newline at end of file
src/data/29.json 0 → 100644
  1 +{
  2 + "php": [
  3 + { "id": 1, "pId": 0, "name": "package1", "open": true, "isParent": true, "collapse": false },
  4 + { "id": 11, "pId": 1, "name": "default1.php", "type": "php" },
  5 + { "id": 12, "pId": 1, "name": "default2.php", "type": "php" },
  6 + { "id": 13, "pId": 1, "name": "default3.php", "type": "php" },
  7 + { "id": 14, "pId": 1, "name": "default4.php", "type": "php" },
  8 + { "id": 15, "pId": 1, "name": "default5.php", "type": "php" },
  9 + { "id": 2, "pId": 0, "name": "package2", "open": true, "isParent": true, "expand": true },
  10 + { "id": 21, "pId": 2, "name": "defaultA.php", "type": "php" },
  11 + { "id": 22, "pId": 2, "name": "defaultB.php", "type": "php" },
  12 + { "id": 23, "pId": 2, "name": "defaultC.php", "type": "php" },
  13 + { "id": 24, "pId": 2, "name": "defaultD.php", "type": "php" },
  14 + { "id": 25, "pId": 2, "name": "defaultE.php", "type": "php" }
  15 + ]
  16 +}
0 \ No newline at end of file 17 \ No newline at end of file
src/data/35.json 0 → 100644
  1 +{
  2 + "html": [
  3 + { "id": 1, "pId": 0, "name": "package1", "open": true, "isParent": true, "collapse": false },
  4 + { "id": 11, "pId": 1, "name": "index.html", "type": "html" },
  5 + { "id": 12, "pId": 1, "name": "style.css", "type": "html" },
  6 + { "id": 13, "pId": 1, "name": "script.js", "type": "js" }
  7 + ]
  8 +}
0 \ No newline at end of file 9 \ No newline at end of file
src/data/4.json 0 → 100644
  1 +{
  2 + "python": [
  3 + { "id": 1, "pId": 0, "name": "package1", "open": true, "isParent": true, "collapse": false },
  4 + { "id": 11, "pId": 1, "name": "default1.py", "type": "py" },
  5 + { "id": 12, "pId": 1, "name": "default2.py", "type": "py" },
  6 + { "id": 13, "pId": 1, "name": "default3.py", "type": "py" },
  7 + { "id": 14, "pId": 1, "name": "default4.py", "type": "py" },
  8 + { "id": 15, "pId": 1, "name": "default5.py", "type": "py" },
  9 + { "id": 2, "pId": 0, "name": "package2", "open": true, "isParent": true, "expand": true },
  10 + { "id": 21, "pId": 2, "name": "defaultA.py", "type": "py" },
  11 + { "id": 22, "pId": 2, "name": "defaultB.py", "type": "py" },
  12 + { "id": 23, "pId": 2, "name": "defaultC.py", "type": "py" },
  13 + { "id": 24, "pId": 2, "name": "defaultD.py", "type": "py" },
  14 + { "id": 25, "pId": 2, "name": "defaultE.py", "type": "py" }
  15 + ]
  16 +}
0 \ No newline at end of file 17 \ No newline at end of file
src/gxb-ide/Ide.js
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 constructor: GxbIde, 15 constructor: GxbIde,
16 options: { 16 options: {
17 el: "#dir", 17 el: "#dir",
  18 + userId: null,
18 languageid: null 19 languageid: null
19 }, 20 },
20 init: function(options){ 21 init: function(options){
src/gxb-ide/Iterm.js 0 → 100644
  1 +;(function(window){
  2 +
  3 + function Iterm(){
  4 + this.initIterm.apply(this, arguments);
  5 + }
  6 +
  7 + Iterm.prototype = {
  8 + constructor: Iterm,
  9 + options: {
  10 + userId: 826920,
  11 + languageId: null,
  12 + compileCallback: null // 编译回调
  13 + },
  14 + initIterm: function(options){
  15 + var _this = this;
  16 + // _this.options = $.extend(this.options, options);
  17 + _this.options = Object.assign(this.options, options);
  18 + _this.events();
  19 + },
  20 + events: function(){
  21 + var _this = this;
  22 + $('#compileBtn').on('click', function(){ _this.compileMode(); })
  23 + },
  24 + compileMode: function(){
  25 + console.log('========================');
  26 +
  27 + var _this = this;
  28 + console.log(_this.options)
  29 + // 获取标准输入值
  30 + var runtimeArgus = $('#runtimeArgus').val() || '';
  31 + var mainPath = Dir.mainPath;
  32 + var _fileList = Dir.getTreeData();
  33 + var userId = _this.options.userId;
  34 + var languageId = _this.options.languageId;
  35 +
  36 + var compileData = {
  37 + "userId": userId,
  38 + "langId": languageId,
  39 + "mainPath": mainPath,
  40 + "mainArgus": "",
  41 + "runtimeArgus": runtimeArgus,
  42 + "rand": "123456",
  43 + "fileList": _fileList || []
  44 + }
  45 + console.log(compileData);
  46 + $.ajax({
  47 + type: "POST",
  48 + url: gxb_api + "/gxb-web/programmingMulti/codeRun/api",
  49 + data: JSON.stringify(compileData),
  50 + dataType: "json",
  51 + contentType: "application/json",
  52 + success: function(data) {
  53 + console.log(data);
  54 + compileResult(data)
  55 + // ladda.remove();
  56 + CodingEditer.compileResultData = data;
  57 + },
  58 + error: function(XMLHttpRequest, textStatus, errorThrown) {
  59 + // ladda.remove();
  60 + alert('错误');
  61 + console.log(XMLHttpRequest);
  62 + },
  63 + });
  64 + }
  65 + }
  66 +
  67 + // 编译结果
  68 + function compileResult(data, value) {
  69 + var runtimeArgus = value || '';
  70 + console.info('compileResult')
  71 + if (value != '') {
  72 + $('#cmprun-tabs a[href="#stdin"]').tab('show');
  73 + $('#stdin input').val(runtimeArgus);
  74 + }else{
  75 + return;
  76 + }
  77 +
  78 + if (data.status == 200) {
  79 +
  80 + $('#cmpinfo').html('<p class="text-warning">' + data.compilerInfo.replace(/\n/g, "<br />") + "</p>");
  81 + $('#stderr').html('<p class="text-danger">' + data.error.replace(/\n/g, "<br />") + "</p>");
  82 + $('#output').html('<p class="text-success">' + data.content.replace(/\n/g, "<br />") + "</p>");
  83 +
  84 + if(data.compilerInfo.length){
  85 + $('#cmprun-tabs a[href="#cmpinfo"]').tab('show');
  86 + }else if(data.error.length){
  87 + $('#cmprun-tabs a[href="#stderr"]').tab('show');
  88 + }else if(data.content.length){
  89 + $('#cmprun-tabs a[href="#output"]').tab('show');
  90 + }
  91 +
  92 + if(!data.compilerInfo.length){
  93 + $('#cmpinfo').prepend('<p class="alert alert-success"><i class="glyphicon glyphicon-ok-sign"></i> 编译已成功</p>');
  94 + }
  95 + }else if(data.status == 500){
  96 + $('#cmprun-tabs a[href="#stderr"]').tab('show');
  97 + $('#stderr').html('<p class="text-danger">' + data.error.replace(/\n/g, "<br />") + "</p>");
  98 + }else{
  99 + $('#cmpinfo').html('<p class="alert alert-danger"><i class="glyphicon glyphicon-exclamation-sign"></i> 请求失败 </p>');
  100 + $('#cmprun-tabs a[href="#cmpinfo"]').tab('show');
  101 + }
  102 + }
  103 +
  104 + window.Iterm = Iterm
  105 +})(window)
0 \ No newline at end of file 106 \ No newline at end of file
src/gxb-ide/ToolBox.js
@@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
18 '</div>'; 18 '</div>';
19 19
20 function ToolBox(){ 20 function ToolBox(){
  21 + this.userId = getQuery('languageid');
  22 + this.languageid = getQuery('languageid');
21 this.template = template; 23 this.template = template;
22 this.init.apply(this, arguments); 24 this.init.apply(this, arguments);
23 } 25 }
@@ -34,7 +36,6 @@ @@ -34,7 +36,6 @@
34 uploadCallback: null, // 上传音频 36 uploadCallback: null, // 上传音频
35 saveCallback: null, // 上传代码 37 saveCallback: null, // 上传代码
36 cancelCallback: null, // 关闭 38 cancelCallback: null, // 关闭
37 - compileCallback: null // 编译  
38 }, 39 },
39 init: function(options){ 40 init: function(options){
40 var _this = this; 41 var _this = this;
@@ -60,7 +61,6 @@ @@ -60,7 +61,6 @@
60 $('#upload').on('click', function(){ _this.uploadAudio(); }) 61 $('#upload').on('click', function(){ _this.uploadAudio(); })
61 $('#savecode').on('click', function(){ _this.saveCode(); }) 62 $('#savecode').on('click', function(){ _this.saveCode(); })
62 $('#cancel').on('click', function(){ _this.cancel(); }) 63 $('#cancel').on('click', function(){ _this.cancel(); })
63 - $('#compileBtn').on('click', function(){ _this.compileMode(); })  
64 }, 64 },
65 startRecording: function(callback){ 65 startRecording: function(callback){
66 console.log('startRecord'); 66 console.log('startRecord');
@@ -117,114 +117,9 @@ @@ -117,114 +117,9 @@
117 }, 117 },
118 cancel: function(){ 118 cancel: function(){
119 console.log('cancel'); 119 console.log('cancel');
120 - },  
121 - compileMode: function(userId, languageid){  
122 - // 获取标准输入值  
123 - var runtimeArgus = $('#runtimeArgus').val() || '';  
124 - var mainPath = Dir.mainPath;  
125 - var _fileList = Dir.getTreeData();  
126 -  
127 - var compileData = {  
128 - "userId": userId,  
129 - "langId": languageid,  
130 - "mainPath": mainPath,  
131 - "mainArgus": "",  
132 - "runtimeArgus": runtimeArgus,  
133 - "rand": "123456",  
134 - "fileList": _fileList || []  
135 - }  
136 - console.log(compileData);  
137 - $.ajax({  
138 - type: "POST",  
139 - url: gxb_api + "/gxb-web/programmingMulti/codeRun/api",  
140 - data: JSON.stringify(compileData),  
141 - dataType: "json",  
142 - contentType: "application/json",  
143 - success: function(data) {  
144 - console.log(data);  
145 - compileResult(data)  
146 - // ladda.remove();  
147 - CodingEditer.compileResultData = data;  
148 - },  
149 - error: function(XMLHttpRequest, textStatus, errorThrown) {  
150 - // ladda.remove();  
151 - alert('错误');  
152 - console.log(XMLHttpRequest);  
153 - },  
154 - });  
155 } 120 }
156 -  
157 -  
158 }; 121 };
159 122
160 - // ToolBox.prototype = {  
161 - // // constructor: ToolBox,  
162 - // options: {  
163 - // el: "#toolBox",  
164 - // role: 0  
165 - // },  
166 - // init: function(options){  
167 - // this.options = $.extend(this.options, options);  
168 - // var toolBox = this.options.el;  
169 - // console.log(toolBox)  
170 - // $(toolBox).html(template)  
171 - // },  
172 - // startRecord: function(){  
173 - // console.log('-----------')  
174 - // console.log(this.template)  
175 - // },  
176 - // stopRecord: function(){  
177 - // console.log('停止录制')  
178 - // },  
179 - // pauseRecord: function(){  
180 - // console.log('暂停录制')  
181 - // }  
182 - // }  
183 -  
184 - // var ToolBox = {  
185 - // template: $('<div><h1>播放</h1></div>'),  
186 - // compileMode: function(userId, languageid){  
187 - // // 获取标准输入值  
188 - // var runtimeArgus = $('#runtimeArgus').val() || '';  
189 - // var mainPath = Dir.mainPath;  
190 - // var _fileList = Dir.getTreeData();  
191 -  
192 - // var compileData = {  
193 - // "userId": userId,  
194 - // "langId": languageid,  
195 - // "mainPath": mainPath,  
196 - // "mainArgus": "",  
197 - // "runtimeArgus": runtimeArgus,  
198 - // "rand": "123456",  
199 - // "fileList": _fileList || []  
200 - // }  
201 -  
202 - // console.log(compileData);  
203 -  
204 - // $.ajax({  
205 - // type: "POST",  
206 - // url: gxb_api + "/gxb-web/programmingMulti/codeRun/api",  
207 - // data: JSON.stringify(compileData),  
208 - // dataType: "json",  
209 - // contentType: "application/json",  
210 - // success: function(data) {  
211 - // console.log(data);  
212 -  
213 - // compileResult(data)  
214 - // ladda.remove();  
215 -  
216 - // CodingEditer.compileResultData = data;  
217 -  
218 - // },  
219 - // error: function(XMLHttpRequest, textStatus, errorThrown) {  
220 - // ladda.remove();  
221 - // alert('错误');  
222 - // console.log(XMLHttpRequest);  
223 - // },  
224 - // });  
225 - // }  
226 - // }  
227 -  
228 // 编译结果 123 // 编译结果
229 function compileResult(data, value) { 124 function compileResult(data, value) {
230 var runtimeArgus = value || ''; 125 var runtimeArgus = value || '';
@@ -264,52 +159,3 @@ @@ -264,52 +159,3 @@
264 159
265 window.ToolBox = ToolBox; 160 window.ToolBox = ToolBox;
266 })(window) 161 })(window)
267 -  
268 -  
269 -  
270 -// 云编译  
271 -// function compileRun(ladda){  
272 -// // 获取标准输入值  
273 -// var runtimeArgus = $('#runtimeArgus').val() || '';  
274 -  
275 -// fileList = ZTREE.getTreeData();  
276 -// console.log(fileList);  
277 -// if(!fileList){  
278 -// alert('请输入代码');  
279 -// ladda.remove();  
280 -// return false;  
281 -// }  
282 -// var compileData = {  
283 -// "userId": _userId,  
284 -// "langId": _languageid,  
285 -// "mainPath": mainPath,  
286 -// "mainArgus": "",  
287 -// "runtimeArgus": runtimeArgus,  
288 -// "rand": "123456",  
289 -// "fileList": fileList  
290 -// }  
291 -// console.log(compileData);  
292 -// $.ajax({  
293 -// type: "POST",  
294 -// url: gxb_api + "/gxb-web/programmingMulti/codeRun/api",  
295 -// data: JSON.stringify(compileData),  
296 -// dataType: "json",  
297 -// contentType: "application/json",  
298 -// success: function(data) {  
299 -// console.log(data);  
300 -  
301 -// compileResult(data)  
302 -// ladda.remove();  
303 -  
304 -// $('.compile-loading').hide();  
305 -// $('.compile-reslut').show();  
306 -// GBCodePlayBack.compileResultData = data;  
307 -  
308 -// },  
309 -// error: function(XMLHttpRequest, textStatus, errorThrown) {  
310 -// ladda.remove();  
311 -// alert('错误');  
312 -// console.log(XMLHttpRequest);  
313 -// },  
314 -// });  
315 -// }  
316 \ No newline at end of file 162 \ No newline at end of file
src/js/c.js
@@ -26,28 +26,6 @@ $(function(){ @@ -26,28 +26,6 @@ $(function(){
26 // ToolBox.compileMode(userId, languageid); 26 // ToolBox.compileMode(userId, languageid);
27 // }) 27 // })
28 28
29 - // 录制代码  
30 - $('#start-recording').click(function() {  
31 - var _recording = $(this).attr('data');  
32 -  
33 - if (_recording == 1) {  
34 - console.log('==========');  
35 - HZRecorder.get(function(rec) {  
36 - console.log(rec);  
37 - recorder = rec;  
38 - recorder.start();  
39 - $('#start-recording').removeClass('new-recording').addClass('recording').attr('data', '0').attr('data-original-title', '结束录制');  
40 - CodingEditer.initRecodesValue();  
41 -  
42 - });  
43 - }else{  
44 - console.log('-------------');  
45 - recorder.stop();  
46 - recorder.getBlobData();  
47 - $('#start-recording').removeClass('new-recording').addClass('recording').attr('data', '1').attr('data-original-title', '结束录制');  
48 - }  
49 -  
50 - })  
51 29
52 // 播放代码 30 // 播放代码
53 $('.audio-play').click(function() { 31 $('.audio-play').click(function() {
src/v1.1/c.html
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
28 <script src="../js/recorder/Myna.js"></script> 28 <script src="../js/recorder/Myna.js"></script>
29 <script src="../gxb-ide/Dir.js"></script> 29 <script src="../gxb-ide/Dir.js"></script>
30 <script src="../gxb-ide/CodingEditer.js"></script> 30 <script src="../gxb-ide/CodingEditer.js"></script>
  31 + <script src="../gxb-ide/Iterm.js"></script>
31 <script src="../gxb-ide/ToolBox.js"></script> 32 <script src="../gxb-ide/ToolBox.js"></script>
32 <script src="../gxb-ide/Ide.js"></script> 33 <script src="../gxb-ide/Ide.js"></script>
33 34
@@ -43,13 +44,25 @@ @@ -43,13 +44,25 @@
43 var gxb_api = "https://restful1.gaoxiaobang.com"; 44 var gxb_api = "https://restful1.gaoxiaobang.com";
44 // var gxb_api = "http://192.168.80.223:8080" 45 // var gxb_api = "http://192.168.80.223:8080"
45 $(function(){ 46 $(function(){
  47 + var _languageid = getQuery('languageid');
  48 + var _userId = getQuery('userId');
  49 +
  50 + console.log('--------------------')
  51 + console.log(_languageid)
  52 + console.log(_userId)
  53 +
46 var techTool = new ToolBox({ 54 var techTool = new ToolBox({
47 el: '#toolBox', 55 el: '#toolBox',
48 startCallback: function(){ 56 startCallback: function(){
49 - console.log('--------------------') 57 +
50 } 58 }
51 }); 59 });
52 60
  61 + var iterm = new Iterm({
  62 + userId: _userId,
  63 + languageId: _languageid
  64 + });
  65 +
53 console.log(techTool) 66 console.log(techTool)
54 67
55 $('#text').click(function(){ 68 $('#text').click(function(){