Commit 98d1b5212f36ed33afdee77f0b858893f05b0769
1 parent
8686c152
解决输入显示和tab切换
Showing
6 changed files
with
155 additions
and
48 deletions
src/js/codedata.json
| @@ -25,6 +25,6 @@ | @@ -25,6 +25,6 @@ | ||
| 25 | "unitPosition": null, | 25 | "unitPosition": null, |
| 26 | "average": null, | 26 | "average": null, |
| 27 | "programmingFileList":[{"path":"package1/Class1.java","content":"12345"}], | 27 | "programmingFileList":[{"path":"package1/Class1.java","content":"12345"}], |
| 28 | - "codeRecordMultiList":[{"intervaltime":1621,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":0},\"to\":{\"line\":0,\"ch\":0},\"text\":[\"1\"]}","trigger":0,"playTime":0,"currenttime":1486462520945},{"intervaltime":553,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":1},\"to\":{\"line\":0,\"ch\":1},\"text\":[\"2\"]}","trigger":0,"playTime":0,"currenttime":1486462521498},{"intervaltime":710,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":2},\"to\":{\"line\":0,\"ch\":2},\"text\":[\"3\"]}","trigger":0,"playTime":0,"currenttime":1486462522208},{"intervaltime":681,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":3},\"to\":{\"line\":0,\"ch\":3},\"text\":[\"4\"]}","trigger":0,"playTime":0,"currenttime":1486462522889},{"intervaltime":837,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":4},\"to\":{\"line\":0,\"ch\":4},\"text\":[\"5\"]}","trigger":0,"playTime":0,"currenttime":1486462523726}] | 28 | + "codeRecordMultiList":[{"intervaltime":1621,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":0},\"to\":{\"line\":0,\"ch\":0},\"text\":[\"1\"]}","trigger":0,"playTime":0,"currenttime":1486462520945},{"intervaltime":553,"editor":"Class2","changeobj":"{\"from\":{\"line\":0,\"ch\":1},\"to\":{\"line\":0,\"ch\":1},\"text\":[\"2\"]}","trigger":0,"playTime":0,"currenttime":1486462521498},{"intervaltime":710,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":2},\"to\":{\"line\":0,\"ch\":2},\"text\":[\"3\"]}","trigger":0,"playTime":0,"currenttime":1486462522208},{"intervaltime":681,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":3},\"to\":{\"line\":0,\"ch\":3},\"text\":[\"4\"]}","trigger":0,"playTime":0,"currenttime":1486462522889},{"intervaltime":837,"editor":"Class1","changeobj":"{\"from\":{\"line\":0,\"ch\":4},\"to\":{\"line\":0,\"ch\":4},\"text\":[\"5\"]}","trigger":0,"playTime":0,"currenttime":1486462523726}] |
| 29 | } | 29 | } |
| 30 | 30 |
src/js/gb.js
| @@ -87,6 +87,30 @@ $(function() { | @@ -87,6 +87,30 @@ $(function() { | ||
| 87 | treeObj = $.fn.zTree.getZTreeObj("folder"); | 87 | treeObj = $.fn.zTree.getZTreeObj("folder"); |
| 88 | treeObj.expandNode(treeNode); | 88 | treeObj.expandNode(treeNode); |
| 89 | 89 | ||
| 90 | + GBCodePlayBack.check_tree_time = new Date().getTime(); // 获取焦点的时间 | ||
| 91 | + | ||
| 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 | + } | ||
| 105 | + }, | ||
| 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 | + | ||
| 90 | // 处理显示目录树对应的编辑器目录 | 114 | // 处理显示目录树对应的编辑器目录 |
| 91 | ZTREE.showEdite({'treeNode': treeNode}); | 115 | ZTREE.showEdite({'treeNode': treeNode}); |
| 92 | } | 116 | } |
| @@ -295,7 +319,7 @@ $(function() { | @@ -295,7 +319,7 @@ $(function() { | ||
| 295 | autorun: 1, | 319 | autorun: 1, |
| 296 | triggertotal: 0, | 320 | triggertotal: 0, |
| 297 | firstPlay: 1, // 第一次播放 | 321 | firstPlay: 1, // 第一次播放 |
| 298 | - pauseValue: '', // 存储暂停时内容 | 322 | + pauseValue: [], // 存储暂停时内容 |
| 299 | triggeroffset: 0, //判断拖动进度条的偏移量 | 323 | triggeroffset: 0, //判断拖动进度条的偏移量 |
| 300 | excercise_triggertotal: 0, | 324 | excercise_triggertotal: 0, |
| 301 | replay_enhancement:1, //是否优化播放,即匀速播放 | 325 | replay_enhancement:1, //是否优化播放,即匀速播放 |
| @@ -634,16 +658,16 @@ $(function() { | @@ -634,16 +658,16 @@ $(function() { | ||
| 634 | 658 | ||
| 635 | if (document.URL.indexOf('player.htm') >= 0) { | 659 | if (document.URL.indexOf('player.htm') >= 0) { |
| 636 | if (_role == 0) { | 660 | if (_role == 0) { |
| 637 | - // var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; | 661 | + var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; |
| 638 | // var apiUrl = gxb_api + "/gxb-web/programmingMulti/" + _codeReplayId + "/api"; | 662 | // var apiUrl = gxb_api + "/gxb-web/programmingMulti/" + _codeReplayId + "/api"; |
| 639 | - var apiUrl = "../js/codedata.json"; | 663 | + // var apiUrl = "../js/codedata.json"; |
| 640 | 664 | ||
| 641 | initPlayerPage(apiUrl) | 665 | initPlayerPage(apiUrl) |
| 642 | 666 | ||
| 643 | } else if (_role == 1) { | 667 | } else if (_role == 1) { |
| 644 | - // var apiUrl = gxb_api + "/programming/student/studentReplay/" + _codeReplayId + "/api"; | 668 | + var apiUrl = gxb_api + "/programming/student/studentReplay/" + _codeReplayId + "/api"; |
| 645 | // var apiUrl = gxb_api + "/gxb-web/programmingMulti/" + _codeReplayId + "/api"; | 669 | // var apiUrl = gxb_api + "/gxb-web/programmingMulti/" + _codeReplayId + "/api"; |
| 646 | - var apiUrl = "../js/codedata.json"; | 670 | + // var apiUrl = "../js/codedata.json"; |
| 647 | 671 | ||
| 648 | initPlayerPage(apiUrl) | 672 | initPlayerPage(apiUrl) |
| 649 | } | 673 | } |
| @@ -665,12 +689,12 @@ $(function() { | @@ -665,12 +689,12 @@ $(function() { | ||
| 665 | selectLang(langid); | 689 | selectLang(langid); |
| 666 | compileMode(langid); | 690 | compileMode(langid); |
| 667 | 691 | ||
| 668 | - // $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl); | ||
| 669 | - $("#play_audio").attr('src', coderecords.audioUrl); | 692 | + $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl); |
| 693 | + // $("#play_audio").attr('src', coderecords.audioUrl); | ||
| 670 | 694 | ||
| 671 | player.init({ | 695 | player.init({ |
| 672 | container: '#audioWrap', | 696 | container: '#audioWrap', |
| 673 | - // source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl, | 697 | + source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl, |
| 674 | source: coderecords.audioUrl, | 698 | source: coderecords.audioUrl, |
| 675 | imagePath: '../js/audioPlayer/image', | 699 | imagePath: '../js/audioPlayer/image', |
| 676 | debuggers: false, | 700 | debuggers: false, |
| @@ -685,8 +709,11 @@ $(function() { | @@ -685,8 +709,11 @@ $(function() { | ||
| 685 | GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | 709 | GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) |
| 686 | pauseCode(); | 710 | pauseCode(); |
| 687 | GBCodePlayBack.firstPlay = 0; | 711 | GBCodePlayBack.firstPlay = 0; |
| 688 | - GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | ||
| 689 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | 712 | + GBCodePlayBack.getCodeMirrorValue(); |
| 713 | + // GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | ||
| 714 | + // GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | ||
| 715 | + | ||
| 716 | + console.log(GBCodePlayBack.pauseValue); | ||
| 690 | }, | 717 | }, |
| 691 | seekedCallback: function() { // 拖拽 | 718 | seekedCallback: function() { // 拖拽 |
| 692 | 719 | ||
| @@ -696,7 +723,7 @@ $(function() { | @@ -696,7 +723,7 @@ $(function() { | ||
| 696 | } | 723 | } |
| 697 | }); | 724 | }); |
| 698 | 725 | ||
| 699 | - var coderecords = coderecords.codeRecordMultiList; | 726 | + var coderecords = coderecords.codeRecordList; |
| 700 | console.log(coderecords); | 727 | console.log(coderecords); |
| 701 | // if (_role == 0) { | 728 | // if (_role == 0) { |
| 702 | // var coderecords = coderecords.codeRecordList; | 729 | // var coderecords = coderecords.codeRecordList; |
| @@ -1142,10 +1169,8 @@ $(function() { | @@ -1142,10 +1169,8 @@ $(function() { | ||
| 1142 | }) | 1169 | }) |
| 1143 | // 保存代码 | 1170 | // 保存代码 |
| 1144 | $('#savecorde').unbind('click').click(function() { | 1171 | $('#savecorde').unbind('click').click(function() { |
| 1145 | - console.info('$(\'#savecorde\').unbind(\'click\')'); | ||
| 1146 | - | ||
| 1147 | $('#savemsg').addClass('hidden'); | 1172 | $('#savemsg').addClass('hidden'); |
| 1148 | - $('.upload-tip').show(); | 1173 | + // $('.upload-tip').show(); |
| 1149 | 1174 | ||
| 1150 | $('#uploading2').css('display', 'inline-block') | 1175 | $('#uploading2').css('display', 'inline-block') |
| 1151 | 1176 | ||
| @@ -1213,15 +1238,21 @@ $(function() { | @@ -1213,15 +1238,21 @@ $(function() { | ||
| 1213 | "saveformat": saveformat, | 1238 | "saveformat": saveformat, |
| 1214 | "audioUrl": $('.audio-url').val(), | 1239 | "audioUrl": $('.audio-url').val(), |
| 1215 | "programmingFileList": programmingFileList, | 1240 | "programmingFileList": programmingFileList, |
| 1216 | - "codeRecordMultiList": GBCodePlayBack.records | 1241 | + "codeRecordList": GBCodePlayBack.records |
| 1217 | } | 1242 | } |
| 1218 | 1243 | ||
| 1219 | console.log('============'); | 1244 | console.log('============'); |
| 1220 | console.log(postData); | 1245 | console.log(postData); |
| 1221 | 1246 | ||
| 1247 | + if (_role == 0) { | ||
| 1248 | + var roleUrl = gxb_api + "/programming/codeReplay/api" | ||
| 1249 | + }else if (_role == 1) { | ||
| 1250 | + var roleUrl = gxb_api + "/programming/student/studentReplay/api" | ||
| 1251 | + } | ||
| 1252 | + | ||
| 1222 | $.ajax({ | 1253 | $.ajax({ |
| 1223 | type: "post", | 1254 | type: "post", |
| 1224 | - url: gxb_api + "/gxb-web/programmingMulti/api", | 1255 | + url: roleUrl, |
| 1225 | data: JSON.stringify(postData), | 1256 | data: JSON.stringify(postData), |
| 1226 | dataType: "json", | 1257 | dataType: "json", |
| 1227 | contentType: "application/json", | 1258 | contentType: "application/json", |
| @@ -1679,9 +1710,12 @@ $(function() { | @@ -1679,9 +1710,12 @@ $(function() { | ||
| 1679 | GBCodePlayBack.active_editor = editor; | 1710 | GBCodePlayBack.active_editor = editor; |
| 1680 | } | 1711 | } |
| 1681 | 1712 | ||
| 1713 | + // 播放 | ||
| 1682 | for (var i = 0; i < treeLinkEditor.length; i++) { | 1714 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 1683 | - if(editor == treeLinkEditor[i].name){ | 1715 | + if(editor == treeLinkEditor[i].name){ // 播放代码 |
| 1684 | processChangeObject(treeLinkEditor[i].CodeMirrorReplay, obj); | 1716 | processChangeObject(treeLinkEditor[i].CodeMirrorReplay, obj); |
| 1717 | + }else if(record.treefile){ // 切换tree目录 | ||
| 1718 | + ZTREE.showEdite({'treeNode': record.treefile, 'replay': true}); | ||
| 1685 | } | 1719 | } |
| 1686 | } | 1720 | } |
| 1687 | 1721 | ||
| @@ -1704,10 +1738,10 @@ $(function() { | @@ -1704,10 +1738,10 @@ $(function() { | ||
| 1704 | error: record.error || '', | 1738 | error: record.error || '', |
| 1705 | code: record.code || '' | 1739 | code: record.code || '' |
| 1706 | }; | 1740 | }; |
| 1707 | - | ||
| 1708 | - if (resultData.compilerInfo) { | ||
| 1709 | - compileResult(resultData); | ||
| 1710 | - } | 1741 | + compileResult(resultData, record.stdin); |
| 1742 | + // if (resultData.status) { | ||
| 1743 | + // compileResult(resultData); | ||
| 1744 | + // } | ||
| 1711 | 1745 | ||
| 1712 | if (replay_type) { | 1746 | if (replay_type) { |
| 1713 | GBCodePlayBack.excercise_triggertotal += 1; | 1747 | GBCodePlayBack.excercise_triggertotal += 1; |
| @@ -1825,35 +1859,67 @@ $(function() { | @@ -1825,35 +1859,67 @@ $(function() { | ||
| 1825 | }, | 1859 | }, |
| 1826 | /** | 1860 | /** |
| 1827 | * 重置编辑器值 | 1861 | * 重置编辑器值 |
| 1828 | - * @Author syantao | ||
| 1829 | * Created by Keystion on 2017-02-06 | 1862 | * Created by Keystion on 2017-02-06 |
| 1830 | - * @param {[type]} num 0: 重置所有录制CodeMirror的值; 0: 重置所有播放CodeMirror的值; | 1863 | + * @param {[type]} num 0: 重置所有录制CodeMirror的值; 1: 重置所有播放CodeMirror的值; |
| 1831 | * @return {[type]} [description] | 1864 | * @return {[type]} [description] |
| 1832 | */ | 1865 | */ |
| 1833 | resetCodeMirrorValue: function(num) { | 1866 | resetCodeMirrorValue: function(num) { |
| 1834 | - // console.info('GBCodePlayBack.resetCodeMirrorValue'); | ||
| 1835 | var _this = this; | 1867 | var _this = this; |
| 1836 | - var _thisNum = num || -1; | ||
| 1837 | - // console.log(_this.records); | 1868 | + var _thisNum = num; |
| 1838 | if (_thisNum == 0) { | 1869 | if (_thisNum == 0) { |
| 1839 | - // _this.resetRecordCodeMirrorValue(); | ||
| 1840 | for (var i = 0; i < treeLinkEditor.length; i++) { | 1870 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 1841 | if (treeLinkEditor[i].CodeMirrorRecord.getValue() != undefined) { | 1871 | if (treeLinkEditor[i].CodeMirrorRecord.getValue() != undefined) { |
| 1842 | treeLinkEditor[i].CodeMirrorRecord.setValue(""); | 1872 | treeLinkEditor[i].CodeMirrorRecord.setValue(""); |
| 1843 | } | 1873 | } |
| 1844 | } | 1874 | } |
| 1845 | } else if (_thisNum == 1) { | 1875 | } else if (_thisNum == 1) { |
| 1846 | - // _this.resetReplayCodeMirrorValue(); | ||
| 1847 | for (var i = 0; i < treeLinkEditor.length; i++) { | 1876 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| 1848 | if (treeLinkEditor[i].CodeMirrorReplay.getValue() != undefined) { | 1877 | if (treeLinkEditor[i].CodeMirrorReplay.getValue() != undefined) { |
| 1849 | treeLinkEditor[i].CodeMirrorReplay.setValue(""); | 1878 | treeLinkEditor[i].CodeMirrorReplay.setValue(""); |
| 1850 | } | 1879 | } |
| 1851 | } | 1880 | } |
| 1852 | } else { | 1881 | } else { |
| 1853 | - return false; | 1882 | + for (var i = 0; i < treeLinkEditor.length; i++) { |
| 1883 | + if (treeLinkEditor[i].CodeMirrorRecord.getValue() != undefined) { | ||
| 1884 | + treeLinkEditor[i].CodeMirrorRecord.setValue(""); | ||
| 1885 | + } | ||
| 1886 | + if (treeLinkEditor[i].CodeMirrorReplay.getValue() != undefined) { | ||
| 1887 | + treeLinkEditor[i].CodeMirrorReplay.setValue(""); | ||
| 1888 | + } | ||
| 1889 | + } | ||
| 1890 | + } | ||
| 1891 | + }, | ||
| 1892 | + /** | ||
| 1893 | + * 获取各个文件中的代码 | ||
| 1894 | + * Created by Kira on 2017-02-08 | ||
| 1895 | + */ | ||
| 1896 | + getCodeMirrorValue: function(){ | ||
| 1897 | + for (var i = 0; i < treeLinkEditor.length; i++) { | ||
| 1898 | + console.log(treeLinkEditor[i].CodeMirrorReplay.getValue()) | ||
| 1899 | + GBCodePlayBack.pauseValue.push(treeLinkEditor[i].CodeMirrorReplay.getValue()); | ||
| 1900 | + } | ||
| 1901 | + }, | ||
| 1902 | + setCodeMirrorValue: function(){ | ||
| 1903 | + for (var i = 0; i < treeLinkEditor.length; i++) { | ||
| 1904 | + reeLinkEditor[i].CodeMirrorReplay.setValue(GBCodePlayBack.pauseValue[i]); | ||
| 1905 | + } | ||
| 1906 | + }, | ||
| 1907 | + /** | ||
| 1908 | + * 设置编辑器读写状态 | ||
| 1909 | + * Created by Kira on 2017-02-08 | ||
| 1910 | + * status=0 只读;status=1 可编辑 | ||
| 1911 | + */ | ||
| 1912 | + editable: function(status){ | ||
| 1913 | + if (status == 1) { | ||
| 1914 | + for (var i = 0; i < treeLinkEditor.length; i++) { | ||
| 1915 | + reeLinkEditor[i].CodeMirrorReplay.setOption('readOnly', false); | ||
| 1916 | + } | ||
| 1917 | + }else{ | ||
| 1918 | + for (var i = 0; i < treeLinkEditor.length; i++) { | ||
| 1919 | + reeLinkEditor[i].CodeMirrorReplay.setOption('readOnly', true); | ||
| 1920 | + } | ||
| 1854 | } | 1921 | } |
| 1855 | } | 1922 | } |
| 1856 | - | ||
| 1857 | } | 1923 | } |
| 1858 | 1924 | ||
| 1859 | $('.record-before').hide(); | 1925 | $('.record-before').hide(); |
| @@ -1923,8 +1989,7 @@ $(function() { | @@ -1923,8 +1989,7 @@ $(function() { | ||
| 1923 | 1989 | ||
| 1924 | // 开始录制 | 1990 | // 开始录制 |
| 1925 | $('#start-recording').click(function() { | 1991 | $('#start-recording').click(function() { |
| 1926 | - console.info('$(\'#start-recording\').click('); | ||
| 1927 | - | 1992 | + console.log('-=======------------log'); |
| 1928 | // 切换到录制区域 | 1993 | // 切换到录制区域 |
| 1929 | $('#recordertab a:eq(0)').tab('show'); | 1994 | $('#recordertab a:eq(0)').tab('show'); |
| 1930 | 1995 | ||
| @@ -1953,6 +2018,7 @@ $(function() { | @@ -1953,6 +2018,7 @@ $(function() { | ||
| 1953 | if (seconds == 2) { | 2018 | if (seconds == 2) { |
| 1954 | $("#countdown").hide(); | 2019 | $("#countdown").hide(); |
| 1955 | startReacoder(); | 2020 | startReacoder(); |
| 2021 | + GBCodePlayBack.resetCodeMirrorValue(0); | ||
| 1956 | compileResult(resultData); | 2022 | compileResult(resultData); |
| 1957 | } | 2023 | } |
| 1958 | }, 1000); | 2024 | }, 1000); |
| @@ -1965,7 +2031,6 @@ $(function() { | @@ -1965,7 +2031,6 @@ $(function() { | ||
| 1965 | treeLinkEditor[i].CodeMirrorRecord.setOption('readOnly', true); | 2031 | treeLinkEditor[i].CodeMirrorRecord.setOption('readOnly', true); |
| 1966 | treeLinkEditor[i].CodeMirrorReplay.setOption('readOnly', true); | 2032 | treeLinkEditor[i].CodeMirrorReplay.setOption('readOnly', true); |
| 1967 | } | 2033 | } |
| 1968 | - // GBCodePlayBack.htmleditor.setOption('readOnly', true); | ||
| 1969 | $("#countdown").hide(); | 2034 | $("#countdown").hide(); |
| 1970 | $("#re-recoding").show(); | 2035 | $("#re-recoding").show(); |
| 1971 | $("#start-recording").hide(); | 2036 | $("#start-recording").hide(); |
| @@ -2029,7 +2094,7 @@ $(function() { | @@ -2029,7 +2094,7 @@ $(function() { | ||
| 2029 | GBCodePlayBack.record_pause_time = new Date().getTime(); // 暂停的时间 | 2094 | GBCodePlayBack.record_pause_time = new Date().getTime(); // 暂停的时间 |
| 2030 | var recordobj = { | 2095 | var recordobj = { |
| 2031 | intervaltime: GBCodePlayBack.record_pause_time - GBCodePlayBack.record_startime, | 2096 | intervaltime: GBCodePlayBack.record_pause_time - GBCodePlayBack.record_startime, |
| 2032 | - // editor: 'Class1', | 2097 | + editor: 'compiler', |
| 2033 | changeobj: { | 2098 | changeobj: { |
| 2034 | from: { | 2099 | from: { |
| 2035 | ch: 0, | 2100 | ch: 0, |
| @@ -2081,6 +2146,41 @@ $(function() { | @@ -2081,6 +2146,41 @@ $(function() { | ||
| 2081 | contrlPause(); | 2146 | contrlPause(); |
| 2082 | }) | 2147 | }) |
| 2083 | 2148 | ||
| 2149 | + // 插入标准输入 | ||
| 2150 | + $(document).on('focus', '#runtimeArgus', function(){ | ||
| 2151 | + console.log('focus'); | ||
| 2152 | + GBCodePlayBack.input_focus_time = new Date().getTime(); // 获取焦点的时间 | ||
| 2153 | + console.log(GBCodePlayBack.records); | ||
| 2154 | + }) | ||
| 2155 | + $(document).on('blur', '#runtimeArgus', function(){ | ||
| 2156 | + console.log('blur'); | ||
| 2157 | + console.log('blur'); | ||
| 2158 | + console.log('blur'); | ||
| 2159 | + | ||
| 2160 | + var recordobj = { | ||
| 2161 | + intervaltime: GBCodePlayBack.input_focus_time - GBCodePlayBack.record_startime, | ||
| 2162 | + editor: 'runtimeArgus', | ||
| 2163 | + changeobj: { | ||
| 2164 | + from: { | ||
| 2165 | + ch: 0, | ||
| 2166 | + line: 0, | ||
| 2167 | + }, | ||
| 2168 | + text: '', | ||
| 2169 | + to: { | ||
| 2170 | + ch: 0, | ||
| 2171 | + line: 0, | ||
| 2172 | + } | ||
| 2173 | + }, | ||
| 2174 | + stdin: $(this).val(), | ||
| 2175 | + trigger: 0, | ||
| 2176 | + playTime: 0 | ||
| 2177 | + }; | ||
| 2178 | + GBCodePlayBack.records.push(recordobj); | ||
| 2179 | + console.log(GBCodePlayBack.records); | ||
| 2180 | + }) | ||
| 2181 | + | ||
| 2182 | + | ||
| 2183 | + | ||
| 2084 | // 继续录制配置 | 2184 | // 继续录制配置 |
| 2085 | function recodingConf(){ | 2185 | function recodingConf(){ |
| 2086 | console.info('recodingConf') | 2186 | console.info('recodingConf') |
| @@ -2199,7 +2299,6 @@ $(function() { | @@ -2199,7 +2299,6 @@ $(function() { | ||
| 2199 | $("#start-recording").show(); | 2299 | $("#start-recording").show(); |
| 2200 | $('.recording-time').html('00:00:00'); | 2300 | $('.recording-time').html('00:00:00'); |
| 2201 | $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true); | 2301 | $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true); |
| 2202 | - GBCodePlayBack.htmleditor.setValue(''); | ||
| 2203 | var resultData = { | 2302 | var resultData = { |
| 2204 | status: 200, | 2303 | status: 200, |
| 2205 | content: '', | 2304 | content: '', |
| @@ -2210,7 +2309,16 @@ $(function() { | @@ -2210,7 +2309,16 @@ $(function() { | ||
| 2210 | } | 2309 | } |
| 2211 | 2310 | ||
| 2212 | // 编译结果 | 2311 | // 编译结果 |
| 2213 | - function compileResult(data) { | 2312 | + function compileResult(data, value) { |
| 2313 | + var stdinVlaue = value || ''; | ||
| 2314 | + console.log('********************************') | ||
| 2315 | + if (value != '') { | ||
| 2316 | + $('#cmprun-tabs a[href="#stdin"]').tab('show'); | ||
| 2317 | + $('#stdin input').val(stdinVlaue); | ||
| 2318 | + }else{ | ||
| 2319 | + return; | ||
| 2320 | + } | ||
| 2321 | + | ||
| 2214 | if (data.status == 200) { | 2322 | if (data.status == 200) { |
| 2215 | 2323 | ||
| 2216 | $('#cmpinfo').html('<p class="text-warning">' + data.compilerInfo.replace(/\n/g, "<br />") + "</p>"); | 2324 | $('#cmpinfo').html('<p class="text-warning">' + data.compilerInfo.replace(/\n/g, "<br />") + "</p>"); |
| @@ -2258,7 +2366,7 @@ $(function() { | @@ -2258,7 +2366,7 @@ $(function() { | ||
| 2258 | recorder = rec; | 2366 | recorder = rec; |
| 2259 | recorder.start(); | 2367 | recorder.start(); |
| 2260 | 2368 | ||
| 2261 | - GBCodePlayBack.resetCodeMirrorValue(0); | 2369 | + // GBCodePlayBack.resetCodeMirrorValue(0); |
| 2262 | GBCodePlayBack.records = []; | 2370 | GBCodePlayBack.records = []; |
| 2263 | GBCodePlayBack.record_startime = new Date().getTime(); | 2371 | GBCodePlayBack.record_startime = new Date().getTime(); |
| 2264 | 2372 |
src/js/recorder/Myna.js
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" }, |
src/v1.1/index.html
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <link rel="stylesheet" href="../js/zTree_v3-3.5.27/css/zTreeStyle/zTreeStyle.css"> | 19 | <link rel="stylesheet" href="../js/zTree_v3-3.5.27/css/zTreeStyle/zTreeStyle.css"> |
| 20 | 20 | ||
| 21 | <script> | 21 | <script> |
| 22 | - var gxb_api = "https://restful.gaoxiaobang.com"; | 22 | + var gxb_api = "https://restful1.gaoxiaobang.com"; |
| 23 | // var gxb_api = "http://192.168.80.223:8080" | 23 | // var gxb_api = "http://192.168.80.223:8080" |
| 24 | 24 | ||
| 25 | </script> | 25 | </script> |
| @@ -181,9 +181,9 @@ | @@ -181,9 +181,9 @@ | ||
| 181 | <audio id="audio" autoplay></audio> | 181 | <audio id="audio" autoplay></audio> |
| 182 | </div> | 182 | </div> |
| 183 | <div class="save-wrap"> | 183 | <div class="save-wrap"> |
| 184 | - <input type="button" id="upload" class="upload-teach" disabled="disabled" value="保存 - upload"> | ||
| 185 | - <input type="button" id="savecorde" class="upload-stud" style="display: none;" disabled="disabled" value="保存 - savecorde"> | ||
| 186 | - <input type="button" id="cancel" value="关闭 - cancel"> | 184 | + <input type="button" id="upload" class="upload-teach" disabled="disabled" value="保存"> |
| 185 | + <input type="button" id="savecorde" class="upload-stud" style="display: none;" disabled="disabled" value="保存"> | ||
| 186 | + <input type="button" id="cancel" value="关闭"> | ||
| 187 | </div> | 187 | </div> |
| 188 | </div> | 188 | </div> |
| 189 | </div> | 189 | </div> |
| @@ -245,10 +245,9 @@ | @@ -245,10 +245,9 @@ | ||
| 245 | uploadAudio() | 245 | uploadAudio() |
| 246 | }) | 246 | }) |
| 247 | 247 | ||
| 248 | - function uploadAudio(ob) { | 248 | + function uploadAudio() { |
| 249 | $('.upload-tip').show(); | 249 | $('.upload-tip').show(); |
| 250 | recorder.upload(); | 250 | recorder.upload(); |
| 251 | - $('#savecorde').trigger('click'); | ||
| 252 | } | 251 | } |
| 253 | </script> | 252 | </script> |
| 254 | </body> | 253 | </body> |
src/v1.1/player.html
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | <link rel="stylesheet" href="../js/zTree_v3-3.5.27/css/zTreeStyle/zTreeStyle.css"> | 20 | <link rel="stylesheet" href="../js/zTree_v3-3.5.27/css/zTreeStyle/zTreeStyle.css"> |
| 21 | 21 | ||
| 22 | <script> | 22 | <script> |
| 23 | - // var gxb_api = "https://restful.gaoxiaobang.com"; | 23 | + var gxb_api = "https://restful1.gaoxiaobang.com"; |
| 24 | // var gxb_api = "http://192.168.80.223:8080" | 24 | // var gxb_api = "http://192.168.80.223:8080" |
| 25 | 25 | ||
| 26 | </script> | 26 | </script> |