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,6 +87,7 @@ $(function() { | ||
| 87 | } | 87 | } |
| 88 | treeObj = $.fn.zTree.getZTreeObj("folder"); | 88 | treeObj = $.fn.zTree.getZTreeObj("folder"); |
| 89 | treeObj.expandNode(treeNode); | 89 | treeObj.expandNode(treeNode); |
| 90 | + console.log(GBCodePlayBack.isRecordPlay); | ||
| 90 | if (GBCodePlayBack.isRecordPlay == 1) { | 91 | if (GBCodePlayBack.isRecordPlay == 1) { |
| 91 | GBCodePlayBack.check_tree_time = new Date().getTime(); // 获取焦点的时间 | 92 | GBCodePlayBack.check_tree_time = new Date().getTime(); // 获取焦点的时间 |
| 92 | var recordobj = { | 93 | var recordobj = { |
| @@ -875,7 +876,8 @@ $(function() { | @@ -875,7 +876,8 @@ $(function() { | ||
| 875 | var data = $(this).attr('data'); | 876 | var data = $(this).attr('data'); |
| 876 | if (_role == 0) { | 877 | if (_role == 0) { |
| 877 | $('.audio-play').attr('disabled', true); | 878 | $('.audio-play').attr('disabled', true); |
| 878 | - recorder.play(audio); | 879 | + $('#audio')[0].play(); |
| 880 | + // recorder.play(audio); | ||
| 879 | } | 881 | } |
| 880 | $(this).attr('data', 0).attr('data-original-title', '播放录音'); | 882 | $(this).attr('data', 0).attr('data-original-title', '播放录音'); |
| 881 | 883 | ||
| @@ -1230,8 +1232,10 @@ $(function() { | @@ -1230,8 +1232,10 @@ $(function() { | ||
| 1230 | // 单个文件路径及内容 数组 | 1232 | // 单个文件路径及内容 数组 |
| 1231 | var programmingFileList = ZTREE.getTreeData(); | 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 | var postData = { | 1239 | var postData = { |
| 1236 | "mainPath": mainPath, | 1240 | "mainPath": mainPath, |
| 1237 | "mainArgus": "lixxx", | 1241 | "mainArgus": "lixxx", |
| @@ -1707,12 +1711,14 @@ $(function() { | @@ -1707,12 +1711,14 @@ $(function() { | ||
| 1707 | }, | 1711 | }, |
| 1708 | onChange: function(editor, changeobj) { // 监听输入事件 editor: 输入语言;changeobj:输入内容{from,text,to} | 1712 | onChange: function(editor, changeobj) { // 监听输入事件 editor: 输入语言;changeobj:输入内容{from,text,to} |
| 1709 | // console.info('GBCodePlayBack.onChange'); | 1713 | // console.info('GBCodePlayBack.onChange'); |
| 1710 | - var intervaltime = 100, | 1714 | + var intervaltime, |
| 1711 | currenttime = new Date().getTime(); | 1715 | currenttime = new Date().getTime(); |
| 1712 | // if(!GBCodePlayBack.record_startime) GBCodePlayBack.record_startime = currenttime; | 1716 | // if(!GBCodePlayBack.record_startime) GBCodePlayBack.record_startime = currenttime; |
| 1713 | // 根据不同的身份设置录制代码的时间间隔,当学生端输入的时候,重置间隔为100毫秒 | 1717 | // 根据不同的身份设置录制代码的时间间隔,当学生端输入的时候,重置间隔为100毫秒 |
| 1714 | if (_role == 0 && GBCodePlayBack.record_startime) { | 1718 | if (_role == 0 && GBCodePlayBack.record_startime) { |
| 1715 | intervaltime = currenttime - GBCodePlayBack.record_startime; | 1719 | intervaltime = currenttime - GBCodePlayBack.record_startime; |
| 1720 | + }else{ | ||
| 1721 | + intervaltime = 100; | ||
| 1716 | } | 1722 | } |
| 1717 | 1723 | ||
| 1718 | var pausetatus = $('#pause').data('status'); | 1724 | var pausetatus = $('#pause').data('status'); |
| @@ -1913,20 +1919,34 @@ $(function() { | @@ -1913,20 +1919,34 @@ $(function() { | ||
| 1913 | } | 1919 | } |
| 1914 | } else if (_thisNum == 1) { | 1920 | } else if (_thisNum == 1) { |
| 1915 | for (var i = 0; i < treeLinkEditor.length; i++) { | 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 | } else { | 1932 | } else { |
| 1933 | + console.log(treeLinkEditor) | ||
| 1922 | for (var i = 0; i < treeLinkEditor.length; i++) { | 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 | ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[0].file}}); | 1952 | ZTREE.showEdite({'treeNode': {'name': treeLinkEditor[0].file}}); |
| @@ -2051,7 +2071,8 @@ $(function() { | @@ -2051,7 +2071,8 @@ $(function() { | ||
| 2051 | 2071 | ||
| 2052 | if (data == 1) { | 2072 | if (data == 1) { |
| 2053 | console.log('开始录制'); | 2073 | console.log('开始录制'); |
| 2054 | - | 2074 | + GBCodePlayBack.resetCodeMirrorValue(); |
| 2075 | + compileResult(resultData); | ||
| 2055 | GBCodePlayBack.isRcording = 1; | 2076 | GBCodePlayBack.isRcording = 1; |
| 2056 | $("#countdown").find('img').attr('src', '../img/ready-go.gif'); | 2077 | $("#countdown").find('img').attr('src', '../img/ready-go.gif'); |
| 2057 | $("#countdown").find('img').load(function() { | 2078 | $("#countdown").find('img').load(function() { |
| @@ -2060,8 +2081,6 @@ $(function() { | @@ -2060,8 +2081,6 @@ $(function() { | ||
| 2060 | if (seconds == 2) { | 2081 | if (seconds == 2) { |
| 2061 | $("#countdown").hide(); | 2082 | $("#countdown").hide(); |
| 2062 | startReacoder(); | 2083 | startReacoder(); |
| 2063 | - GBCodePlayBack.resetCodeMirrorValue(); | ||
| 2064 | - compileResult(resultData); | ||
| 2065 | } | 2084 | } |
| 2066 | }, 1000); | 2085 | }, 1000); |
| 2067 | }) | 2086 | }) |
| @@ -2090,7 +2109,8 @@ $(function() { | @@ -2090,7 +2109,8 @@ $(function() { | ||
| 2090 | }) | 2109 | }) |
| 2091 | 2110 | ||
| 2092 | $('#re-sure').click(function() { | 2111 | $('#re-sure').click(function() { |
| 2093 | - initRecoding() | 2112 | + initRecoding(); |
| 2113 | + GBCodePlayBack.isRecordPlay = 1; | ||
| 2094 | $('#start-recording').trigger('click'); | 2114 | $('#start-recording').trigger('click'); |
| 2095 | }) | 2115 | }) |
| 2096 | 2116 | ||
| @@ -2444,6 +2464,7 @@ $(function() { | @@ -2444,6 +2464,7 @@ $(function() { | ||
| 2444 | $('#pause').data('pause', '0'); | 2464 | $('#pause').data('pause', '0'); |
| 2445 | if (_role == 0) { | 2465 | if (_role == 0) { |
| 2446 | recorder.stop(); | 2466 | recorder.stop(); |
| 2467 | + recorder.getBlobData(); | ||
| 2447 | $('#upload').show(); | 2468 | $('#upload').show(); |
| 2448 | 2469 | ||
| 2449 | } else if (_role == 1) { | 2470 | } else if (_role == 1) { |
| @@ -2469,6 +2490,8 @@ $(function() { | @@ -2469,6 +2490,8 @@ $(function() { | ||
| 2469 | if(!_datalist[i].isParent){ | 2490 | if(!_datalist[i].isParent){ |
| 2470 | var _file = _datalist[i].name; | 2491 | var _file = _datalist[i].name; |
| 2471 | var _name = ZTREE.manageName(_file); | 2492 | var _name = ZTREE.manageName(_file); |
| 2493 | + var defaultValue; | ||
| 2494 | + defaultValue = 'package '+ ZTREE.getTreePath(_file).split('/')[0] +';'; | ||
| 2472 | treeLinkEditor.push({ | 2495 | treeLinkEditor.push({ |
| 2473 | "name": _name, | 2496 | "name": _name, |
| 2474 | "file": _file, | 2497 | "file": _file, |
| @@ -2478,7 +2501,7 @@ $(function() { | @@ -2478,7 +2501,7 @@ $(function() { | ||
| 2478 | }); | 2501 | }); |
| 2479 | // 判断是否是播放页面,如果是则不显示录制区相关dom | 2502 | // 判断是否是播放页面,如果是则不显示录制区相关dom |
| 2480 | if(!isReplayPage){ | 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 | replayTemplate += '<div id="'+ _name +'ReplayWrap"><textarea id="'+ _name + 'Replay" title="'+ _name +'" style="display: none;"></textarea></div>' | 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,6 +143,7 @@ | ||
| 143 | context.close().then(function(){ | 143 | context.close().then(function(){ |
| 144 | recorder.disconnect(); | 144 | recorder.disconnect(); |
| 145 | }); | 145 | }); |
| 146 | + | ||
| 146 | console.log(this.getBlob); | 147 | console.log(this.getBlob); |
| 147 | } | 148 | } |
| 148 | 149 | ||
| @@ -155,7 +156,8 @@ | @@ -155,7 +156,8 @@ | ||
| 155 | // 获取音频文件 | 156 | // 获取音频文件 |
| 156 | this.getBlobData = function(){ | 157 | this.getBlobData = function(){ |
| 157 | console.log(audioData.encodeWAV()); | 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
| @@ -41,6 +41,6 @@ getCDNFile = function (cdnUrl) { | @@ -41,6 +41,6 @@ getCDNFile = function (cdnUrl) { | ||
| 41 | $w.utils = $w.utils || utils; | 41 | $w.utils = $w.utils || utils; |
| 42 | })(window, jQuery) | 42 | })(window, jQuery) |
| 43 | 43 | ||
| 44 | -window.console.log = function(){} | ||
| 45 | -window.console.info = function(){} | 44 | +// window.console.log = function(){} |
| 45 | +// window.console.info = function(){} | ||
| 46 | 46 |
src/v1.1/index.html
| @@ -179,7 +179,7 @@ | @@ -179,7 +179,7 @@ | ||
| 179 | </button> | 179 | </button> |
| 180 | <div class="recording-time" id="timer" value="">00:00:00</div> | 180 | <div class="recording-time" id="timer" value="">00:00:00</div> |
| 181 | <div class="audio-view" style="display: none;"> | 181 | <div class="audio-view" style="display: none;"> |
| 182 | - <audio id="audio" autoplay></audio> | 182 | + <audio id="audio"></audio> |
| 183 | </div> | 183 | </div> |
| 184 | <div class="save-wrap"> | 184 | <div class="save-wrap"> |
| 185 | <input type="button" id="upload" class="upload-teach" disabled="disabled" value="保存"> | 185 | <input type="button" id="upload" class="upload-teach" disabled="disabled" value="保存"> |