Commit a34e130fc7d64dac5b9663697551dc58a18010b9
1 parent
0144613b
添加默认package值
Showing
4 changed files
with
49 additions
and
24 deletions
src/js/gb.js
| ... | ... | @@ -87,6 +87,7 @@ $(function() { |
| 87 | 87 | } |
| 88 | 88 | treeObj = $.fn.zTree.getZTreeObj("folder"); |
| 89 | 89 | treeObj.expandNode(treeNode); |
| 90 | + console.log(GBCodePlayBack.isRecordPlay); | |
| 90 | 91 | if (GBCodePlayBack.isRecordPlay == 1) { |
| 91 | 92 | GBCodePlayBack.check_tree_time = new Date().getTime(); // 获取焦点的时间 |
| 92 | 93 | var recordobj = { |
| ... | ... | @@ -875,7 +876,8 @@ $(function() { |
| 875 | 876 | var data = $(this).attr('data'); |
| 876 | 877 | if (_role == 0) { |
| 877 | 878 | $('.audio-play').attr('disabled', true); |
| 878 | - recorder.play(audio); | |
| 879 | + $('#audio')[0].play(); | |
| 880 | + // recorder.play(audio); | |
| 879 | 881 | } |
| 880 | 882 | $(this).attr('data', 0).attr('data-original-title', '播放录音'); |
| 881 | 883 | |
| ... | ... | @@ -1230,8 +1232,10 @@ $(function() { |
| 1230 | 1232 | // 单个文件路径及内容 数组 |
| 1231 | 1233 | var programmingFileList = ZTREE.getTreeData(); |
| 1232 | 1234 | |
| 1233 | - | |
| 1234 | - var keepTimer = round($('#audio')[0].duration); | |
| 1235 | + var timeLength = $('#audio')[0].duration; | |
| 1236 | + var keepTimer = Math.round(timeLength); | |
| 1237 | + console.log(timeLength); | |
| 1238 | + | |
| 1235 | 1239 | var postData = { |
| 1236 | 1240 | "mainPath": mainPath, |
| 1237 | 1241 | "mainArgus": "lixxx", |
| ... | ... | @@ -1707,12 +1711,14 @@ $(function() { |
| 1707 | 1711 | }, |
| 1708 | 1712 | onChange: function(editor, changeobj) { // 监听输入事件 editor: 输入语言;changeobj:输入内容{from,text,to} |
| 1709 | 1713 | // console.info('GBCodePlayBack.onChange'); |
| 1710 | - var intervaltime = 100, | |
| 1714 | + var intervaltime, | |
| 1711 | 1715 | currenttime = new Date().getTime(); |
| 1712 | 1716 | // if(!GBCodePlayBack.record_startime) GBCodePlayBack.record_startime = currenttime; |
| 1713 | 1717 | // 根据不同的身份设置录制代码的时间间隔,当学生端输入的时候,重置间隔为100毫秒 |
| 1714 | 1718 | if (_role == 0 && GBCodePlayBack.record_startime) { |
| 1715 | 1719 | intervaltime = currenttime - GBCodePlayBack.record_startime; |
| 1720 | + }else{ | |
| 1721 | + intervaltime = 100; | |
| 1716 | 1722 | } |
| 1717 | 1723 | |
| 1718 | 1724 | var pausetatus = $('#pause').data('status'); |
| ... | ... | @@ -1913,20 +1919,34 @@ $(function() { |
| 1913 | 1919 | } |
| 1914 | 1920 | } else if (_thisNum == 1) { |
| 1915 | 1921 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 1916 | - if (treeLinkEditor[i].CodeMirrorReplay.getValue()) { | |
| 1917 | - ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); | |
| 1918 | - treeLinkEditor[i].CodeMirrorReplay.setValue(""); | |
| 1919 | - } | |
| 1922 | + var _path = treeLinkEditor[i].filePath; | |
| 1923 | + var defaultValue; | |
| 1924 | + defaultValue = 'package '+ _path.split('/')[0] +';\n'; | |
| 1925 | + ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); | |
| 1926 | + treeLinkEditor[i].CodeMirrorReplay.setValue(defaultValue); | |
| 1927 | + // if (treeLinkEditor[i].CodeMirrorReplay.getValue()) { | |
| 1928 | + // ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); | |
| 1929 | + // treeLinkEditor[i].CodeMirrorReplay.setValue(""); | |
| 1930 | + // } | |
| 1920 | 1931 | } |
| 1921 | 1932 | } else { |
| 1933 | + console.log(treeLinkEditor) | |
| 1922 | 1934 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 1923 | - if(treeLinkEditor[i].CodeMirrorRecord.getValue()){ | |
| 1924 | - ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); | |
| 1925 | - treeLinkEditor[i].CodeMirrorRecord.setValue(""); | |
| 1926 | - }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){ | |
| 1927 | - ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); | |
| 1928 | - treeLinkEditor[i].CodeMirrorReplay.setValue(""); | |
| 1929 | - } | |
| 1935 | + var _path = treeLinkEditor[i].filePath; | |
| 1936 | + var defaultValue; | |
| 1937 | + defaultValue = 'package '+ _path.split('/')[0] +';\n'; | |
| 1938 | + console.log(treeLinkEditor) | |
| 1939 | + ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); | |
| 1940 | + treeLinkEditor[i].CodeMirrorRecord.setValue(defaultValue); | |
| 1941 | + ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); | |
| 1942 | + treeLinkEditor[i].CodeMirrorReplay.setValue(defaultValue); | |
| 1943 | + // if(treeLinkEditor[i].CodeMirrorRecord){ | |
| 1944 | + // ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}}); | |
| 1945 | + // treeLinkEditor[i].CodeMirrorRecord.setValue(''); | |
| 1946 | + // }else if(treeLinkEditor[i].CodeMirrorReplay.getValue()){ | |
| 1947 | + // ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[i].file}, 'replay': true}); | |
| 1948 | + // treeLinkEditor[i].CodeMirrorReplay.setValue(""); | |
| 1949 | + // } | |
| 1930 | 1950 | } |
| 1931 | 1951 | } |
| 1932 | 1952 | ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[0].file}}); |
| ... | ... | @@ -2051,7 +2071,8 @@ $(function() { |
| 2051 | 2071 | |
| 2052 | 2072 | if (data == 1) { |
| 2053 | 2073 | console.log('开始录制'); |
| 2054 | - | |
| 2074 | + GBCodePlayBack.resetCodeMirrorValue(); | |
| 2075 | + compileResult(resultData); | |
| 2055 | 2076 | GBCodePlayBack.isRcording = 1; |
| 2056 | 2077 | $("#countdown").find('img').attr('src', '../img/ready-go.gif'); |
| 2057 | 2078 | $("#countdown").find('img').load(function() { |
| ... | ... | @@ -2060,8 +2081,6 @@ $(function() { |
| 2060 | 2081 | if (seconds == 2) { |
| 2061 | 2082 | $("#countdown").hide(); |
| 2062 | 2083 | startReacoder(); |
| 2063 | - GBCodePlayBack.resetCodeMirrorValue(); | |
| 2064 | - compileResult(resultData); | |
| 2065 | 2084 | } |
| 2066 | 2085 | }, 1000); |
| 2067 | 2086 | }) |
| ... | ... | @@ -2090,7 +2109,8 @@ $(function() { |
| 2090 | 2109 | }) |
| 2091 | 2110 | |
| 2092 | 2111 | $('#re-sure').click(function() { |
| 2093 | - initRecoding() | |
| 2112 | + initRecoding(); | |
| 2113 | + GBCodePlayBack.isRecordPlay = 1; | |
| 2094 | 2114 | $('#start-recording').trigger('click'); |
| 2095 | 2115 | }) |
| 2096 | 2116 | |
| ... | ... | @@ -2444,6 +2464,7 @@ $(function() { |
| 2444 | 2464 | $('#pause').data('pause', '0'); |
| 2445 | 2465 | if (_role == 0) { |
| 2446 | 2466 | recorder.stop(); |
| 2467 | + recorder.getBlobData(); | |
| 2447 | 2468 | $('#upload').show(); |
| 2448 | 2469 | |
| 2449 | 2470 | } else if (_role == 1) { |
| ... | ... | @@ -2469,6 +2490,8 @@ $(function() { |
| 2469 | 2490 | if(!_datalist[i].isParent){ |
| 2470 | 2491 | var _file = _datalist[i].name; |
| 2471 | 2492 | var _name = ZTREE.manageName(_file); |
| 2493 | + var defaultValue; | |
| 2494 | + defaultValue = 'package '+ ZTREE.getTreePath(_file).split('/')[0] +';'; | |
| 2472 | 2495 | treeLinkEditor.push({ |
| 2473 | 2496 | "name": _name, |
| 2474 | 2497 | "file": _file, |
| ... | ... | @@ -2478,7 +2501,7 @@ $(function() { |
| 2478 | 2501 | }); |
| 2479 | 2502 | // 判断是否是播放页面,如果是则不显示录制区相关dom |
| 2480 | 2503 | if(!isReplayPage){ |
| 2481 | - recordTemplate += '<div id="'+ _name +'RecordWrap"><textarea id="'+ _name + 'Record" title="'+ _name +'" style="display: none;"></textarea></div>' | |
| 2504 | + recordTemplate += '<div id="'+ _name +'RecordWrap"><textarea id="'+ _name + 'Record" title="'+ _name +'" style="display: none;">'+defaultValue+'</textarea></div>' | |
| 2482 | 2505 | } |
| 2483 | 2506 | |
| 2484 | 2507 | replayTemplate += '<div id="'+ _name +'ReplayWrap"><textarea id="'+ _name + 'Replay" title="'+ _name +'" style="display: none;"></textarea></div>' | ... | ... |
src/js/recorder/Myna.js
| ... | ... | @@ -143,6 +143,7 @@ |
| 143 | 143 | context.close().then(function(){ |
| 144 | 144 | recorder.disconnect(); |
| 145 | 145 | }); |
| 146 | + | |
| 146 | 147 | console.log(this.getBlob); |
| 147 | 148 | } |
| 148 | 149 | |
| ... | ... | @@ -155,7 +156,8 @@ |
| 155 | 156 | // 获取音频文件 |
| 156 | 157 | this.getBlobData = function(){ |
| 157 | 158 | console.log(audioData.encodeWAV()); |
| 158 | - return audioData.encodeWAV(); | |
| 159 | + // return audioData.encodeWAV(); | |
| 160 | + $('#audio').attr('src', window.URL.createObjectURL(this.getBlob())); | |
| 159 | 161 | } |
| 160 | 162 | |
| 161 | 163 | //回放 | ... | ... |
src/js/util/util.js
src/v1.1/index.html
| ... | ... | @@ -179,7 +179,7 @@ |
| 179 | 179 | </button> |
| 180 | 180 | <div class="recording-time" id="timer" value="">00:00:00</div> |
| 181 | 181 | <div class="audio-view" style="display: none;"> |
| 182 | - <audio id="audio" autoplay></audio> | |
| 182 | + <audio id="audio"></audio> | |
| 183 | 183 | </div> |
| 184 | 184 | <div class="save-wrap"> |
| 185 | 185 | <input type="button" id="upload" class="upload-teach" disabled="disabled" value="保存"> | ... | ... |