Commit 748a1649092d37b049cc4bd9b47ed62f9e0cff0a
1 parent
87e44f0d
修改不同步问题
Showing
3 changed files
with
51 additions
and
35 deletions
gulp/config.js
src/js/gb.js
| ... | ... | @@ -87,31 +87,32 @@ $(function() { |
| 87 | 87 | } |
| 88 | 88 | treeObj = $.fn.zTree.getZTreeObj("folder"); |
| 89 | 89 | treeObj.expandNode(treeNode); |
| 90 | - | |
| 91 | - GBCodePlayBack.check_tree_time = new Date().getTime(); // 获取焦点的时间 | |
| 92 | - | |
| 93 | - var recordobj = { | |
| 94 | - intervaltime: GBCodePlayBack.check_tree_time - GBCodePlayBack.record_startime, | |
| 95 | - editor: 'tab', | |
| 96 | - changeobj: { | |
| 97 | - from: { | |
| 98 | - ch: 0, | |
| 99 | - line: 0, | |
| 90 | + if (GBCodePlayBack.isRecordPlay == 1) { | |
| 91 | + GBCodePlayBack.check_tree_time = new Date().getTime(); // 获取焦点的时间 | |
| 92 | + var recordobj = { | |
| 93 | + intervaltime: GBCodePlayBack.check_tree_time - GBCodePlayBack.record_startime, | |
| 94 | + editor: 'tab', | |
| 95 | + changeobj: { | |
| 96 | + from: { | |
| 97 | + ch: 0, | |
| 98 | + line: 0, | |
| 99 | + }, | |
| 100 | + text: '', | |
| 101 | + to: { | |
| 102 | + ch: 0, | |
| 103 | + line: 0, | |
| 104 | + } | |
| 100 | 105 | }, |
| 101 | - text: '', | |
| 102 | - to: { | |
| 103 | - ch: 0, | |
| 104 | - line: 0, | |
| 105 | - } | |
| 106 | - }, | |
| 107 | - treefile: treeNode, | |
| 108 | - trigger: 0, | |
| 109 | - playTime: 0 | |
| 110 | - }; | |
| 111 | - GBCodePlayBack.records.push(recordobj); | |
| 106 | + treefile: treeNode, | |
| 107 | + trigger: 0, | |
| 108 | + playTime: 0 | |
| 109 | + }; | |
| 110 | + GBCodePlayBack.records.push(recordobj); | |
| 111 | + console.log(GBCodePlayBack.records); | |
| 112 | + GBCodePlayBack.record_startime = GBCodePlayBack.check_tree_time; | |
| 113 | + } | |
| 114 | + | |
| 112 | 115 | console.log(GBCodePlayBack.records); |
| 113 | - GBCodePlayBack.record_startime = GBCodePlayBack.check_tree_time; | |
| 114 | - | |
| 115 | 116 | // 处理显示目录树对应的编辑器目录 |
| 116 | 117 | ZTREE.showEdite({'treeNode': treeNode}); |
| 117 | 118 | } |
| ... | ... | @@ -332,6 +333,7 @@ $(function() { |
| 332 | 333 | continue_recording: 0, //是否继续自动保`存的录制 |
| 333 | 334 | recording_status: 1, //当前是否在录制 |
| 334 | 335 | times: 0, // 播放次数 |
| 336 | + isRecordPlay: 1, // 录制时播放:1:录制中,0:播放中 | |
| 335 | 337 | isPause: 1, // 是否暂停 1:不暂停,0:暂停 |
| 336 | 338 | isRcording: 0, // 是否录制 1:录制中,0:暂停中 |
| 337 | 339 | recordinit: function(codereplaytype, preload) { |
| ... | ... | @@ -693,6 +695,7 @@ $(function() { |
| 693 | 695 | // $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); |
| 694 | 696 | // $("#play_audio").attr('src', coderecords.audioUrl); |
| 695 | 697 | console.log("http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl) |
| 698 | + var flag = true; | |
| 696 | 699 | player.init({ |
| 697 | 700 | container: '#audioWrap', |
| 698 | 701 | source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl, |
| ... | ... | @@ -701,15 +704,21 @@ $(function() { |
| 701 | 704 | allowSeek: false, |
| 702 | 705 | playCallback: function() { // 播放 |
| 703 | 706 | console.log('++++++++') |
| 704 | - playCode(); | |
| 707 | + if(flag){ | |
| 708 | + playCode(); | |
| 709 | + } | |
| 710 | + | |
| 705 | 711 | // $('#play').trigger('click'); |
| 706 | 712 | // GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); |
| 707 | 713 | }, |
| 708 | 714 | pauseCallback: function() { // 暂停 |
| 709 | - GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 710 | - pauseCode(); | |
| 711 | - GBCodePlayBack.firstPlay = 0; | |
| 712 | - GBCodePlayBack.getCodeMirrorValue(); | |
| 715 | + flag = false; | |
| 716 | + player.play(); | |
| 717 | + // GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 718 | + // pauseCode(); | |
| 719 | + // GBCodePlayBack.firstPlay = 0; | |
| 720 | + // GBCodePlayBack.getCodeMirrorValue(); | |
| 721 | + | |
| 713 | 722 | // GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); |
| 714 | 723 | // GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); |
| 715 | 724 | |
| ... | ... | @@ -1224,7 +1233,7 @@ $(function() { |
| 1224 | 1233 | GBCodePlayBack.records[i].changeobj = JSON.stringify(GBCodePlayBack.records[i].changeobj); |
| 1225 | 1234 | GBCodePlayBack.records[i].treefile = JSON.stringify(GBCodePlayBack.records[i].treefile) || ''; |
| 1226 | 1235 | } |
| 1227 | - | |
| 1236 | + var keepTimer = $('.recording-time').val() | |
| 1228 | 1237 | var postData = { |
| 1229 | 1238 | "mainPath": mainPath, |
| 1230 | 1239 | "mainArgus": "lixxx", |
| ... | ... | @@ -1241,7 +1250,8 @@ $(function() { |
| 1241 | 1250 | "audioUrl": $('.audio-url').val(), |
| 1242 | 1251 | "programmingSource": 1, |
| 1243 | 1252 | "programmingFileList": programmingFileList, |
| 1244 | - "codeRecordList": GBCodePlayBack.records | |
| 1253 | + "codeRecordList": GBCodePlayBack.records, | |
| 1254 | + "totaltime": keepTimer | |
| 1245 | 1255 | } |
| 1246 | 1256 | |
| 1247 | 1257 | console.log('============'); |
| ... | ... | @@ -1252,7 +1262,7 @@ $(function() { |
| 1252 | 1262 | }else if (_role == 1) { |
| 1253 | 1263 | var roleUrl = gxb_api + "/programming/student/studentReplay/api" |
| 1254 | 1264 | } |
| 1255 | - var keepTimer = $('.recording-time').val() | |
| 1265 | + | |
| 1256 | 1266 | $.ajax({ |
| 1257 | 1267 | type: "post", |
| 1258 | 1268 | url: roleUrl, |
| ... | ... | @@ -2164,6 +2174,7 @@ $(function() { |
| 2164 | 2174 | console.info('$(\'#cancel_compile\').unbind(\'click\')'); |
| 2165 | 2175 | recodingConf(); |
| 2166 | 2176 | contrlPause(); |
| 2177 | + GBCodePlayBack.record_startime = new Date().getTime(); | |
| 2167 | 2178 | }) |
| 2168 | 2179 | |
| 2169 | 2180 | // 插入标准输入 |
| ... | ... | @@ -2176,7 +2187,6 @@ $(function() { |
| 2176 | 2187 | console.log('blur'); |
| 2177 | 2188 | console.log('blur'); |
| 2178 | 2189 | console.log('blur'); |
| 2179 | - | |
| 2180 | 2190 | var recordobj = { |
| 2181 | 2191 | intervaltime: GBCodePlayBack.input_focus_time - GBCodePlayBack.record_startime, |
| 2182 | 2192 | editor: 'runtimeArgus', |
| ... | ... | @@ -2195,6 +2205,8 @@ $(function() { |
| 2195 | 2205 | trigger: 0, |
| 2196 | 2206 | playTime: 0 |
| 2197 | 2207 | }; |
| 2208 | + | |
| 2209 | + GBCodePlayBack.record_startime = GBCodePlayBack.input_focus_time; // 获取焦点的时间 | |
| 2198 | 2210 | GBCodePlayBack.records.push(recordobj); |
| 2199 | 2211 | console.log(GBCodePlayBack.records); |
| 2200 | 2212 | }) |
| ... | ... | @@ -2374,6 +2386,9 @@ $(function() { |
| 2374 | 2386 | // }else{ |
| 2375 | 2387 | // $('#cmpinfo').prepend('<p class="alert alert-success"><i class="glyphicon glyphicon-ok-sign"></i> 等待编译 </p>'); |
| 2376 | 2388 | // } |
| 2389 | + }else if(data.status == 500){ | |
| 2390 | + $('#cmprun-tabs a[href="#stderr"]').tab('show'); | |
| 2391 | + $('#stderr').html('<p class="text-danger">' + data.error.replace(/\n/g, "<br />") + "</p>"); | |
| 2377 | 2392 | }else{ |
| 2378 | 2393 | $('#cmpinfo').html('<p class="alert alert-danger"><i class="glyphicon glyphicon-exclamation-sign"></i> 请求失败 </p>'); |
| 2379 | 2394 | $('#cmprun-tabs a[href="#cmpinfo"]').tab('show'); |
| ... | ... | @@ -2402,6 +2417,7 @@ $(function() { |
| 2402 | 2417 | // 结束录制 |
| 2403 | 2418 | function stopReacoder() { |
| 2404 | 2419 | console.info('stopReacoder'); |
| 2420 | + GBCodePlayBack.isRecordPlay = 0; | |
| 2405 | 2421 | console.log(GBCodePlayBack.records); |
| 2406 | 2422 | |
| 2407 | 2423 | $('#start-recording').removeClass('recording').addClass('new-recording').attr('data', '1').attr('data-original-title', '重新录制'); | ... | ... |
src/js/tree.json
| 1 | 1 | { |
| 2 | 2 | "tree": [ |
| 3 | - { "id": 1, "pId": 0, "name": "Package1", "open": true, "isParent": true, "collapse": false }, | |
| 3 | + { "id": 1, "pId": 0, "name": "package1", "open": true, "isParent": true, "collapse": false }, | |
| 4 | 4 | { "id": 11, "pId": 1, "name": "Class1.java", "type": "java" }, |
| 5 | 5 | { "id": 12, "pId": 1, "name": "Class2.java", "type": "java" }, |
| 6 | 6 | { "id": 13, "pId": 1, "name": "Class3.java", "type": "java" }, |
| 7 | 7 | { "id": 14, "pId": 1, "name": "Class4.java", "type": "java" }, |
| 8 | 8 | { "id": 15, "pId": 1, "name": "Class5.java", "type": "java" }, |
| 9 | - { "id": 2, "pId": 0, "name": "Package2", "open": true, "isParent": true, "expand": true }, | |
| 9 | + { "id": 2, "pId": 0, "name": "package2", "open": true, "isParent": true, "expand": true }, | |
| 10 | 10 | { "id": 21, "pId": 2, "name": "ClassA.java", "type": "java" }, |
| 11 | 11 | { "id": 22, "pId": 2, "name": "ClassB.java", "type": "java" }, |
| 12 | 12 | { "id": 23, "pId": 2, "name": "ClassC.java", "type": "java" }, | ... | ... |