Commit 748a1649092d37b049cc4bd9b47ed62f9e0cff0a

Authored by ykxie
1 parent 87e44f0d

修改不同步问题

gulp/config.js
@@ -24,7 +24,7 @@ module.exports = { @@ -24,7 +24,7 @@ module.exports = {
24 } 24 }
25 }, 25 },
26 html: { 26 html: {
27 - src: src + "/*.html", 27 + src: src + "/**/*.html",
28 dest: dest 28 dest: dest
29 }, 29 },
30 css: { 30 css: {
src/js/gb.js
@@ -87,31 +87,32 @@ $(function() { @@ -87,31 +87,32 @@ $(function() {
87 } 87 }
88 treeObj = $.fn.zTree.getZTreeObj("folder"); 88 treeObj = $.fn.zTree.getZTreeObj("folder");
89 treeObj.expandNode(treeNode); 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 console.log(GBCodePlayBack.records); 115 console.log(GBCodePlayBack.records);
113 - GBCodePlayBack.record_startime = GBCodePlayBack.check_tree_time;  
114 -  
115 // 处理显示目录树对应的编辑器目录 116 // 处理显示目录树对应的编辑器目录
116 ZTREE.showEdite({'treeNode': treeNode}); 117 ZTREE.showEdite({'treeNode': treeNode});
117 } 118 }
@@ -332,6 +333,7 @@ $(function() { @@ -332,6 +333,7 @@ $(function() {
332 continue_recording: 0, //是否继续自动保`存的录制 333 continue_recording: 0, //是否继续自动保`存的录制
333 recording_status: 1, //当前是否在录制 334 recording_status: 1, //当前是否在录制
334 times: 0, // 播放次数 335 times: 0, // 播放次数
  336 + isRecordPlay: 1, // 录制时播放:1:录制中,0:播放中
335 isPause: 1, // 是否暂停 1:不暂停,0:暂停 337 isPause: 1, // 是否暂停 1:不暂停,0:暂停
336 isRcording: 0, // 是否录制 1:录制中,0:暂停中 338 isRcording: 0, // 是否录制 1:录制中,0:暂停中
337 recordinit: function(codereplaytype, preload) { 339 recordinit: function(codereplaytype, preload) {
@@ -693,6 +695,7 @@ $(function() { @@ -693,6 +695,7 @@ $(function() {
693 // $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); 695 // $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl);
694 // $("#play_audio").attr('src', coderecords.audioUrl); 696 // $("#play_audio").attr('src', coderecords.audioUrl);
695 console.log("http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl) 697 console.log("http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl)
  698 + var flag = true;
696 player.init({ 699 player.init({
697 container: '#audioWrap', 700 container: '#audioWrap',
698 source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl, 701 source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl,
@@ -701,15 +704,21 @@ $(function() { @@ -701,15 +704,21 @@ $(function() {
701 allowSeek: false, 704 allowSeek: false,
702 playCallback: function() { // 播放 705 playCallback: function() { // 播放
703 console.log('++++++++') 706 console.log('++++++++')
704 - playCode(); 707 + if(flag){
  708 + playCode();
  709 + }
  710 +
705 // $('#play').trigger('click'); 711 // $('#play').trigger('click');
706 // GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); 712 // GBCodePlayBack.htmlplayereditor.setOption('readOnly', true);
707 }, 713 },
708 pauseCallback: function() { // 暂停 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 // GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); 722 // GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue();
714 // GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); 723 // GBCodePlayBack.htmlplayereditor.setOption('readOnly', false);
715 724
@@ -1224,7 +1233,7 @@ $(function() { @@ -1224,7 +1233,7 @@ $(function() {
1224 GBCodePlayBack.records[i].changeobj = JSON.stringify(GBCodePlayBack.records[i].changeobj); 1233 GBCodePlayBack.records[i].changeobj = JSON.stringify(GBCodePlayBack.records[i].changeobj);
1225 GBCodePlayBack.records[i].treefile = JSON.stringify(GBCodePlayBack.records[i].treefile) || ''; 1234 GBCodePlayBack.records[i].treefile = JSON.stringify(GBCodePlayBack.records[i].treefile) || '';
1226 } 1235 }
1227 - 1236 + var keepTimer = $('.recording-time').val()
1228 var postData = { 1237 var postData = {
1229 "mainPath": mainPath, 1238 "mainPath": mainPath,
1230 "mainArgus": "lixxx", 1239 "mainArgus": "lixxx",
@@ -1241,7 +1250,8 @@ $(function() { @@ -1241,7 +1250,8 @@ $(function() {
1241 "audioUrl": $('.audio-url').val(), 1250 "audioUrl": $('.audio-url').val(),
1242 "programmingSource": 1, 1251 "programmingSource": 1,
1243 "programmingFileList": programmingFileList, 1252 "programmingFileList": programmingFileList,
1244 - "codeRecordList": GBCodePlayBack.records 1253 + "codeRecordList": GBCodePlayBack.records,
  1254 + "totaltime": keepTimer
1245 } 1255 }
1246 1256
1247 console.log('============'); 1257 console.log('============');
@@ -1252,7 +1262,7 @@ $(function() { @@ -1252,7 +1262,7 @@ $(function() {
1252 }else if (_role == 1) { 1262 }else if (_role == 1) {
1253 var roleUrl = gxb_api + "/programming/student/studentReplay/api" 1263 var roleUrl = gxb_api + "/programming/student/studentReplay/api"
1254 } 1264 }
1255 - var keepTimer = $('.recording-time').val() 1265 +
1256 $.ajax({ 1266 $.ajax({
1257 type: "post", 1267 type: "post",
1258 url: roleUrl, 1268 url: roleUrl,
@@ -2164,6 +2174,7 @@ $(function() { @@ -2164,6 +2174,7 @@ $(function() {
2164 console.info('$(\'#cancel_compile\').unbind(\'click\')'); 2174 console.info('$(\'#cancel_compile\').unbind(\'click\')');
2165 recodingConf(); 2175 recodingConf();
2166 contrlPause(); 2176 contrlPause();
  2177 + GBCodePlayBack.record_startime = new Date().getTime();
2167 }) 2178 })
2168 2179
2169 // 插入标准输入 2180 // 插入标准输入
@@ -2176,7 +2187,6 @@ $(function() { @@ -2176,7 +2187,6 @@ $(function() {
2176 console.log('blur'); 2187 console.log('blur');
2177 console.log('blur'); 2188 console.log('blur');
2178 console.log('blur'); 2189 console.log('blur');
2179 -  
2180 var recordobj = { 2190 var recordobj = {
2181 intervaltime: GBCodePlayBack.input_focus_time - GBCodePlayBack.record_startime, 2191 intervaltime: GBCodePlayBack.input_focus_time - GBCodePlayBack.record_startime,
2182 editor: 'runtimeArgus', 2192 editor: 'runtimeArgus',
@@ -2195,6 +2205,8 @@ $(function() { @@ -2195,6 +2205,8 @@ $(function() {
2195 trigger: 0, 2205 trigger: 0,
2196 playTime: 0 2206 playTime: 0
2197 }; 2207 };
  2208 +
  2209 + GBCodePlayBack.record_startime = GBCodePlayBack.input_focus_time; // 获取焦点的时间
2198 GBCodePlayBack.records.push(recordobj); 2210 GBCodePlayBack.records.push(recordobj);
2199 console.log(GBCodePlayBack.records); 2211 console.log(GBCodePlayBack.records);
2200 }) 2212 })
@@ -2374,6 +2386,9 @@ $(function() { @@ -2374,6 +2386,9 @@ $(function() {
2374 // }else{ 2386 // }else{
2375 // $('#cmpinfo').prepend('<p class="alert alert-success"><i class="glyphicon glyphicon-ok-sign"></i> 等待编译 </p>'); 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 }else{ 2392 }else{
2378 $('#cmpinfo').html('<p class="alert alert-danger"><i class="glyphicon glyphicon-exclamation-sign"></i> 请求失败 </p>'); 2393 $('#cmpinfo').html('<p class="alert alert-danger"><i class="glyphicon glyphicon-exclamation-sign"></i> 请求失败 </p>');
2379 $('#cmprun-tabs a[href="#cmpinfo"]').tab('show'); 2394 $('#cmprun-tabs a[href="#cmpinfo"]').tab('show');
@@ -2402,6 +2417,7 @@ $(function() { @@ -2402,6 +2417,7 @@ $(function() {
2402 // 结束录制 2417 // 结束录制
2403 function stopReacoder() { 2418 function stopReacoder() {
2404 console.info('stopReacoder'); 2419 console.info('stopReacoder');
  2420 + GBCodePlayBack.isRecordPlay = 0;
2405 console.log(GBCodePlayBack.records); 2421 console.log(GBCodePlayBack.records);
2406 2422
2407 $('#start-recording').removeClass('recording').addClass('new-recording').attr('data', '1').attr('data-original-title', '重新录制'); 2423 $('#start-recording').removeClass('recording').addClass('new-recording').attr('data', '1').attr('data-original-title', '重新录制');
src/js/tree.json
1 { 1 {
2 "tree": [ 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 { "id": 11, "pId": 1, "name": "Class1.java", "type": "java" }, 4 { "id": 11, "pId": 1, "name": "Class1.java", "type": "java" },
5 { "id": 12, "pId": 1, "name": "Class2.java", "type": "java" }, 5 { "id": 12, "pId": 1, "name": "Class2.java", "type": "java" },
6 { "id": 13, "pId": 1, "name": "Class3.java", "type": "java" }, 6 { "id": 13, "pId": 1, "name": "Class3.java", "type": "java" },
7 { "id": 14, "pId": 1, "name": "Class4.java", "type": "java" }, 7 { "id": 14, "pId": 1, "name": "Class4.java", "type": "java" },
8 { "id": 15, "pId": 1, "name": "Class5.java", "type": "java" }, 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 { "id": 21, "pId": 2, "name": "ClassA.java", "type": "java" }, 10 { "id": 21, "pId": 2, "name": "ClassA.java", "type": "java" },
11 { "id": 22, "pId": 2, "name": "ClassB.java", "type": "java" }, 11 { "id": 22, "pId": 2, "name": "ClassB.java", "type": "java" },
12 { "id": 23, "pId": 2, "name": "ClassC.java", "type": "java" }, 12 { "id": 23, "pId": 2, "name": "ClassC.java", "type": "java" },