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