Commit a81eb61b31ae0cc98469a39f519499d80e3f096a
1 parent
98d1b521
fixbug
Showing
4 changed files
with
46 additions
and
18 deletions
src/js/gb.js
| @@ -689,13 +689,12 @@ $(function() { | @@ -689,13 +689,12 @@ $(function() { | ||
| 689 | selectLang(langid); | 689 | selectLang(langid); |
| 690 | compileMode(langid); | 690 | compileMode(langid); |
| 691 | 691 | ||
| 692 | - $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl); | 692 | + // $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); |
| 693 | // $("#play_audio").attr('src', coderecords.audioUrl); | 693 | // $("#play_audio").attr('src', coderecords.audioUrl); |
| 694 | - | 694 | + console.log("http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl) |
| 695 | player.init({ | 695 | player.init({ |
| 696 | container: '#audioWrap', | 696 | container: '#audioWrap', |
| 697 | - source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl, | ||
| 698 | - source: coderecords.audioUrl, | 697 | + source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl, |
| 699 | imagePath: '../js/audioPlayer/image', | 698 | imagePath: '../js/audioPlayer/image', |
| 700 | debuggers: false, | 699 | debuggers: false, |
| 701 | allowSeek: false, | 700 | allowSeek: false, |
| @@ -738,6 +737,7 @@ $(function() { | @@ -738,6 +737,7 @@ $(function() { | ||
| 738 | for (var i = 0; i < coderecords.length; i++) { | 737 | for (var i = 0; i < coderecords.length; i++) { |
| 739 | if (!coderecords[i].trigger) coderecords[i].trigger = 0; | 738 | if (!coderecords[i].trigger) coderecords[i].trigger = 0; |
| 740 | coderecords[i].changeobj = jQuery.parseJSON(coderecords[i].changeobj); | 739 | coderecords[i].changeobj = jQuery.parseJSON(coderecords[i].changeobj); |
| 740 | + coderecords[i].treefile = jQuery.parseJSON(coderecords[i].treefile); | ||
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | GBCodePlayBack.records = coderecords; | 743 | GBCodePlayBack.records = coderecords; |
| @@ -1220,7 +1220,8 @@ $(function() { | @@ -1220,7 +1220,8 @@ $(function() { | ||
| 1220 | // 单个文件路径及内容 数组 | 1220 | // 单个文件路径及内容 数组 |
| 1221 | var programmingFileList = ZTREE.getTreeData(); | 1221 | var programmingFileList = ZTREE.getTreeData(); |
| 1222 | for (var i = 0; i < GBCodePlayBack.records.length; i++) { | 1222 | for (var i = 0; i < GBCodePlayBack.records.length; i++) { |
| 1223 | - GBCodePlayBack.records[i].changeobj = JSON.stringify(GBCodePlayBack.records[i].changeobj) | 1223 | + GBCodePlayBack.records[i].changeobj = JSON.stringify(GBCodePlayBack.records[i].changeobj); |
| 1224 | + GBCodePlayBack.records[i].treefile = JSON.stringify(GBCodePlayBack.records[i].treefile) || ''; | ||
| 1224 | } | 1225 | } |
| 1225 | 1226 | ||
| 1226 | var postData = { | 1227 | var postData = { |
| @@ -1237,6 +1238,7 @@ $(function() { | @@ -1237,6 +1238,7 @@ $(function() { | ||
| 1237 | "viewcount": "0", | 1238 | "viewcount": "0", |
| 1238 | "saveformat": saveformat, | 1239 | "saveformat": saveformat, |
| 1239 | "audioUrl": $('.audio-url').val(), | 1240 | "audioUrl": $('.audio-url').val(), |
| 1241 | + "programmingScore": 1, | ||
| 1240 | "programmingFileList": programmingFileList, | 1242 | "programmingFileList": programmingFileList, |
| 1241 | "codeRecordList": GBCodePlayBack.records | 1243 | "codeRecordList": GBCodePlayBack.records |
| 1242 | } | 1244 | } |
| @@ -1249,7 +1251,7 @@ $(function() { | @@ -1249,7 +1251,7 @@ $(function() { | ||
| 1249 | }else if (_role == 1) { | 1251 | }else if (_role == 1) { |
| 1250 | var roleUrl = gxb_api + "/programming/student/studentReplay/api" | 1252 | var roleUrl = gxb_api + "/programming/student/studentReplay/api" |
| 1251 | } | 1253 | } |
| 1252 | - | 1254 | + var keepTimer = $('.recording-time').val() |
| 1253 | $.ajax({ | 1255 | $.ajax({ |
| 1254 | type: "post", | 1256 | type: "post", |
| 1255 | url: roleUrl, | 1257 | url: roleUrl, |
| @@ -1259,9 +1261,25 @@ $(function() { | @@ -1259,9 +1261,25 @@ $(function() { | ||
| 1259 | success: function(data) { | 1261 | success: function(data) { |
| 1260 | console.log(data); | 1262 | console.log(data); |
| 1261 | $('.upload-tip').hide(); | 1263 | $('.upload-tip').hide(); |
| 1264 | + $(window).unbind('beforeunload'); | ||
| 1265 | + var _data = { | ||
| 1266 | + "programId": data.codeReplayId, | ||
| 1267 | + "programLanguageName": data.languageName, | ||
| 1268 | + "programLanguageId": data.languageid, | ||
| 1269 | + "programmingScore": data.programmingScore, | ||
| 1270 | + "programAudioLength": keepTimer | ||
| 1271 | + } | ||
| 1272 | + $('.upload-tip').hide(); | ||
| 1273 | + | ||
| 1274 | + $('#cancel').prop("disabled", false); | ||
| 1275 | + | ||
| 1276 | + window.opener.postMessage(_data, _source); | ||
| 1277 | + window.close(); | ||
| 1262 | }, | 1278 | }, |
| 1263 | error: function() { | 1279 | error: function() { |
| 1264 | $('.upload-tip').hide(); | 1280 | $('.upload-tip').hide(); |
| 1281 | + console.log(GBCodePlayBack.records) | ||
| 1282 | + | ||
| 1265 | alert('代码保存失败重新保存') | 1283 | alert('代码保存失败重新保存') |
| 1266 | } | 1284 | } |
| 1267 | }); | 1285 | }); |
| @@ -1680,7 +1698,6 @@ $(function() { | @@ -1680,7 +1698,6 @@ $(function() { | ||
| 1680 | var pausetatus = $('#pause').data('status'); | 1698 | var pausetatus = $('#pause').data('status'); |
| 1681 | 1699 | ||
| 1682 | if (_role == 0 && pausetatus == 1) { | 1700 | if (_role == 0 && pausetatus == 1) { |
| 1683 | - intervaltime = (currenttime - GBCodePlayBack.record_continue_time); | ||
| 1684 | $('#pause').data('status', '0'); | 1701 | $('#pause').data('status', '0'); |
| 1685 | } | 1702 | } |
| 1686 | 1703 | ||
| @@ -1738,7 +1755,7 @@ $(function() { | @@ -1738,7 +1755,7 @@ $(function() { | ||
| 1738 | error: record.error || '', | 1755 | error: record.error || '', |
| 1739 | code: record.code || '' | 1756 | code: record.code || '' |
| 1740 | }; | 1757 | }; |
| 1741 | - compileResult(resultData, record.stdin); | 1758 | + compileResult(resultData, record.runtimeArgus); |
| 1742 | // if (resultData.status) { | 1759 | // if (resultData.status) { |
| 1743 | // compileResult(resultData); | 1760 | // compileResult(resultData); |
| 1744 | // } | 1761 | // } |
| @@ -2137,6 +2154,8 @@ $(function() { | @@ -2137,6 +2154,8 @@ $(function() { | ||
| 2137 | GBCodePlayBack.records[length].code = GBCodePlayBack.compileResultData.code; | 2154 | GBCodePlayBack.records[length].code = GBCodePlayBack.compileResultData.code; |
| 2138 | 2155 | ||
| 2139 | contrlPause(); | 2156 | contrlPause(); |
| 2157 | + | ||
| 2158 | + GBCodePlayBack.record_startime = new Date().getTime(); | ||
| 2140 | }) | 2159 | }) |
| 2141 | 2160 | ||
| 2142 | // 不保存编译结果 | 2161 | // 不保存编译结果 |
| @@ -2171,7 +2190,7 @@ $(function() { | @@ -2171,7 +2190,7 @@ $(function() { | ||
| 2171 | line: 0, | 2190 | line: 0, |
| 2172 | } | 2191 | } |
| 2173 | }, | 2192 | }, |
| 2174 | - stdin: $(this).val(), | 2193 | + runtimeArgus: $(this).val(), |
| 2175 | trigger: 0, | 2194 | trigger: 0, |
| 2176 | playTime: 0 | 2195 | playTime: 0 |
| 2177 | }; | 2196 | }; |
| @@ -2187,7 +2206,6 @@ $(function() { | @@ -2187,7 +2206,6 @@ $(function() { | ||
| 2187 | Hourglass.pauseTimer(); | 2206 | Hourglass.pauseTimer(); |
| 2188 | $("#CompileBtn").data('run', 1); | 2207 | $("#CompileBtn").data('run', 1); |
| 2189 | GBCodePlayBack.record_startime = new Date().getTime(); | 2208 | GBCodePlayBack.record_startime = new Date().getTime(); |
| 2190 | - GBCodePlayBack.record_continue_time = new Date().getTime(); | ||
| 2191 | } | 2209 | } |
| 2192 | 2210 | ||
| 2193 | // 切换自动/手动运行代码 | 2211 | // 切换自动/手动运行代码 |
| @@ -2291,8 +2309,9 @@ $(function() { | @@ -2291,8 +2309,9 @@ $(function() { | ||
| 2291 | 2309 | ||
| 2292 | // 初始化页面 | 2310 | // 初始化页面 |
| 2293 | function initRecoding() { | 2311 | function initRecoding() { |
| 2294 | - console.log('initRecoding') | 2312 | + console.log('initRecoding'); |
| 2295 | GBCodePlayBack.recordinit(); | 2313 | GBCodePlayBack.recordinit(); |
| 2314 | + GBCodePlayBack.resetCodeMirrorValue(); | ||
| 2296 | $(".re-tips").hide(); | 2315 | $(".re-tips").hide(); |
| 2297 | $("#re-recoding").hide(); | 2316 | $("#re-recoding").hide(); |
| 2298 | $(".audio-play").removeClass('show').addClass('hidden'); | 2317 | $(".audio-play").removeClass('show').addClass('hidden'); |
| @@ -2301,6 +2320,7 @@ $(function() { | @@ -2301,6 +2320,7 @@ $(function() { | ||
| 2301 | $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true); | 2320 | $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true); |
| 2302 | var resultData = { | 2321 | var resultData = { |
| 2303 | status: 200, | 2322 | status: 200, |
| 2323 | + compilerInfo: '', | ||
| 2304 | content: '', | 2324 | content: '', |
| 2305 | error: '', | 2325 | error: '', |
| 2306 | code: '' | 2326 | code: '' |
| @@ -2310,11 +2330,11 @@ $(function() { | @@ -2310,11 +2330,11 @@ $(function() { | ||
| 2310 | 2330 | ||
| 2311 | // 编译结果 | 2331 | // 编译结果 |
| 2312 | function compileResult(data, value) { | 2332 | function compileResult(data, value) { |
| 2313 | - var stdinVlaue = value || ''; | 2333 | + var runtimeArgus = value || ''; |
| 2314 | console.log('********************************') | 2334 | console.log('********************************') |
| 2315 | if (value != '') { | 2335 | if (value != '') { |
| 2316 | $('#cmprun-tabs a[href="#stdin"]').tab('show'); | 2336 | $('#cmprun-tabs a[href="#stdin"]').tab('show'); |
| 2317 | - $('#stdin input').val(stdinVlaue); | 2337 | + $('#stdin input').val(runtimeArgus); |
| 2318 | }else{ | 2338 | }else{ |
| 2319 | return; | 2339 | return; |
| 2320 | } | 2340 | } |
src/js/gbreplayer.js
| @@ -358,6 +358,7 @@ $(function(){ | @@ -358,6 +358,7 @@ $(function(){ | ||
| 358 | 358 | ||
| 359 | if(document.URL.indexOf('player.htm')>=0){ | 359 | if(document.URL.indexOf('player.htm')>=0){ |
| 360 | if (_role == 0) { | 360 | if (_role == 0) { |
| 361 | + console.log('----========') | ||
| 361 | var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; | 362 | var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; |
| 362 | initPlayerPage(apiUrl) | 363 | initPlayerPage(apiUrl) |
| 363 | 364 | ||
| @@ -378,11 +379,11 @@ $(function(){ | @@ -378,11 +379,11 @@ $(function(){ | ||
| 378 | var langid = parseInt(coderecords.languageid); | 379 | var langid = parseInt(coderecords.languageid); |
| 379 | selectLang(langid); | 380 | selectLang(langid); |
| 380 | compileMode(langid); | 381 | compileMode(langid); |
| 381 | - | ||
| 382 | - $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl); | 382 | + console.log(coderecords); |
| 383 | + $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); | ||
| 383 | player.init({ | 384 | player.init({ |
| 384 | container: '#audioWrap' | 385 | container: '#audioWrap' |
| 385 | - ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl | 386 | + ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl |
| 386 | ,imagePath: 'js/audioPlayer/image' | 387 | ,imagePath: 'js/audioPlayer/image' |
| 387 | ,debuggers: false | 388 | ,debuggers: false |
| 388 | ,allowSeek: false | 389 | ,allowSeek: false |
| @@ -413,6 +414,7 @@ $(function(){ | @@ -413,6 +414,7 @@ $(function(){ | ||
| 413 | GBCodePlayBack.jsplayereditor.setValue(''); | 414 | GBCodePlayBack.jsplayereditor.setValue(''); |
| 414 | 415 | ||
| 415 | var starttime = 0; | 416 | var starttime = 0; |
| 417 | + console.log(coderecords); | ||
| 416 | for(var i=0;i<coderecords.length;i++){ | 418 | for(var i=0;i<coderecords.length;i++){ |
| 417 | if(!coderecords[i].trigger) coderecords[i].trigger = 0; | 419 | if(!coderecords[i].trigger) coderecords[i].trigger = 0; |
| 418 | coderecords[i].changeobj = jQuery.parseJSON(coderecords[i].changeobj); | 420 | coderecords[i].changeobj = jQuery.parseJSON(coderecords[i].changeobj); |
| @@ -897,7 +899,9 @@ $(function(){ | @@ -897,7 +899,9 @@ $(function(){ | ||
| 897 | 899 | ||
| 898 | recorddatas.push(recorddata); | 900 | recorddatas.push(recorddata); |
| 899 | } | 901 | } |
| 900 | - | 902 | + |
| 903 | + // 区分新版旧版 | ||
| 904 | + recorddatas.programmingScore = 0; | ||
| 901 | //回放入库 | 905 | //回放入库 |
| 902 | recorddatas.deleteFlag = 1 | 906 | recorddatas.deleteFlag = 1 |
| 903 | 907 | ||
| @@ -912,10 +916,13 @@ $(function(){ | @@ -912,10 +916,13 @@ $(function(){ | ||
| 912 | dataType: "json", | 916 | dataType: "json", |
| 913 | contentType: "application/json", | 917 | contentType: "application/json", |
| 914 | success: function(data){ | 918 | success: function(data){ |
| 919 | + console.log(data); | ||
| 915 | $(window).unbind('beforeunload'); | 920 | $(window).unbind('beforeunload'); |
| 916 | var _data = { | 921 | var _data = { |
| 917 | "programId": data.codeReplayId, | 922 | "programId": data.codeReplayId, |
| 918 | "programLanguageName": data.languageName, | 923 | "programLanguageName": data.languageName, |
| 924 | + "programLanguageId": data.languageid, | ||
| 925 | + "programmingScore": data.programmingScore, | ||
| 919 | "programAudioLength": keepTimer | 926 | "programAudioLength": keepTimer |
| 920 | } | 927 | } |
| 921 | $('.upload-tip').hide(); | 928 | $('.upload-tip').hide(); |
src/player.html
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | <link rel="stylesheet" href="js/audioPlayer/theme.default.css"> | 16 | <link rel="stylesheet" href="js/audioPlayer/theme.default.css"> |
| 17 | 17 | ||
| 18 | <script> | 18 | <script> |
| 19 | - var gxb_api = "https://restful.gaoxiaobang.com"; | 19 | + var gxb_api = "https://restful1.gaoxiaobang.com"; |
| 20 | // var gxb_api = "https://restful.gaoxiaobang.com" | 20 | // var gxb_api = "https://restful.gaoxiaobang.com" |
| 21 | </script> | 21 | </script> |
| 22 | 22 |
src/v1.1/index.html
| @@ -166,6 +166,7 @@ | @@ -166,6 +166,7 @@ | ||
| 166 | </div> | 166 | </div> |
| 167 | <div id="appFooter"> | 167 | <div id="appFooter"> |
| 168 | <!-- 录音控制条 --> | 168 | <!-- 录音控制条 --> |
| 169 | + <input type="hidden" class="audio-url" value=""> | ||
| 169 | <div class="recording-ctrl-bar"> | 170 | <div class="recording-ctrl-bar"> |
| 170 | <button id="start-recording" class="btn new-recording" type="button" data="1" title="开始录制"></button> | 171 | <button id="start-recording" class="btn new-recording" type="button" data="1" title="开始录制"></button> |
| 171 | <button id="re-recoding" class="btn new-recording" type="button" data="1" title="重新录制" style="display: none;"></button> | 172 | <button id="re-recoding" class="btn new-recording" type="button" data="1" title="重新录制" style="display: none;"></button> |