Commit 02c72ae0a05990ab4811b8ec8254a02515997422
Merge branch 'feature/20170418_webIDE' into develop
Showing
3 changed files
with
93 additions
and
62 deletions
src/css/recording.css
| ... | ... | @@ -359,7 +359,8 @@ button { |
| 359 | 359 | height: 34px; |
| 360 | 360 | line-height: 34px; |
| 361 | 361 | padding: 0; |
| 362 | - border-radius: 21px; } | |
| 362 | + border-radius: 21px; | |
| 363 | + color: #666; } | |
| 363 | 364 | |
| 364 | 365 | .recording-page #previewpanel .nav-tabs > li.active > a { |
| 365 | 366 | background: #fff !important; | ... | ... |
src/js/gbreplayer.js
| ... | ... | @@ -11,6 +11,7 @@ $(function(){ |
| 11 | 11 | var $recording_time = $('.recording-time'); |
| 12 | 12 | var tag = 1; // 标记第一次暂停 |
| 13 | 13 | var player = $.AudioPlayer; |
| 14 | + var coderecordsData; | |
| 14 | 15 | |
| 15 | 16 | // 根据不同的角色渲染页面 |
| 16 | 17 | if(_role == 1){ |
| ... | ... | @@ -22,6 +23,39 @@ $(function(){ |
| 22 | 23 | $('#upload').show(); |
| 23 | 24 | } |
| 24 | 25 | |
| 26 | + if(document.URL.indexOf('player.htm')>=0){ | |
| 27 | + if (_role == 0) { | |
| 28 | + var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; | |
| 29 | + getLangid(apiUrl); | |
| 30 | + } else if (_role == 1) { | |
| 31 | + var apiUrl = gxb_api + "/programming/student/studentReplay/" + _codeReplayId + "/api"; | |
| 32 | + getLangid(apiUrl); | |
| 33 | + } | |
| 34 | + } | |
| 35 | + console.log(_languageid) | |
| 36 | + | |
| 37 | + function getLangid(apiUrl){ | |
| 38 | + $.ajax({ | |
| 39 | + type: "get", | |
| 40 | + url: apiUrl, | |
| 41 | + async: false, | |
| 42 | + success: function(coderecords) { | |
| 43 | + _languageid = parseInt(coderecords.languageid); | |
| 44 | + if(coderecords){ | |
| 45 | + coderecordsData = coderecords; | |
| 46 | + }else{ | |
| 47 | + // TODO 提示错误信息 | |
| 48 | + alert('错误') | |
| 49 | + } | |
| 50 | + }, | |
| 51 | + error: function(){ | |
| 52 | + alert('错误') | |
| 53 | + } | |
| 54 | + }); | |
| 55 | + } | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 25 | 59 | var GBCodePlayBack = { |
| 26 | 60 | records: [], |
| 27 | 61 | excercise_records: [], |
| ... | ... | @@ -361,75 +395,70 @@ $(function(){ |
| 361 | 395 | if(document.URL.indexOf('player.htm')>=0){ |
| 362 | 396 | if (_role == 0) { |
| 363 | 397 | console.log('----========') |
| 364 | - var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; | |
| 365 | - initPlayerPage(apiUrl); | |
| 398 | + // var apiUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; | |
| 399 | + initPlayerPage(); | |
| 366 | 400 | |
| 367 | 401 | } else if (_role == 1) { |
| 368 | - var apiUrl = gxb_api + "/programming/student/studentReplay/" + _codeReplayId + "/api"; | |
| 369 | - initPlayerPage(apiUrl) | |
| 402 | + // var apiUrl = gxb_api + "/programming/student/studentReplay/" + _codeReplayId + "/api"; | |
| 403 | + initPlayerPage() | |
| 370 | 404 | } |
| 371 | 405 | }else { |
| 372 | 406 | compileMode(_languageid) |
| 373 | 407 | } |
| 374 | 408 | |
| 375 | 409 | // 初始化渲染页面 |
| 376 | - function initPlayerPage(apiUrl){ | |
| 377 | - $.ajax({ | |
| 378 | - type: "get", | |
| 379 | - url: apiUrl, | |
| 380 | - success: function(coderecords) { | |
| 381 | - var langid = parseInt(coderecords.languageid); | |
| 382 | - selectLang(langid); | |
| 383 | - compileMode(langid); | |
| 384 | - console.log(coderecords); | |
| 385 | - $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); | |
| 386 | - if (_role ==0) { | |
| 387 | - player.init({ | |
| 388 | - container: '#audioWrap' | |
| 389 | - ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl | |
| 390 | - ,imagePath: 'js/audioPlayer/image' | |
| 391 | - ,debuggers: false | |
| 392 | - ,allowSeek: false | |
| 393 | - ,playCallback: function(){ // 播放 | |
| 394 | - playCode(); | |
| 395 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | |
| 396 | - } | |
| 397 | - ,pauseCallback: function(){ // 暂停 | |
| 398 | - GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 399 | - pauseCode(); | |
| 400 | - GBCodePlayBack.firstPlay = 0; | |
| 401 | - GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | |
| 402 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | |
| 403 | - } | |
| 404 | - ,seekedCallback: function(){} // 拖拽 | |
| 405 | - ,endedCallback: function(){ // 结束播放 | |
| 406 | - playEnd() | |
| 407 | - } | |
| 408 | - }); | |
| 409 | - var coderecords = coderecords.codeRecordList; | |
| 410 | - | |
| 411 | - }else{ | |
| 412 | - $('.play-code').show(); | |
| 413 | - var coderecords = coderecords.studentRecordList; | |
| 414 | - } | |
| 415 | - | |
| 416 | - GBCodePlayBack.htmlplayereditor.setValue(''); | |
| 417 | - GBCodePlayBack.cssplayereditor.setValue(''); | |
| 418 | - GBCodePlayBack.jsplayereditor.setValue(''); | |
| 419 | - | |
| 420 | - var starttime = 0; | |
| 421 | - console.log(coderecords); | |
| 422 | - for(var i=0;i<coderecords.length;i++){ | |
| 423 | - if(!coderecords[i].trigger) coderecords[i].trigger = 0; | |
| 424 | - coderecords[i].changeobj = jQuery.parseJSON(coderecords[i].changeobj); | |
| 425 | - } | |
| 426 | - | |
| 427 | - GBCodePlayBack.records = coderecords; | |
| 428 | - }, | |
| 429 | - error: function(){ | |
| 430 | - alert('错误') | |
| 431 | - } | |
| 432 | - }); | |
| 410 | + function initPlayerPage(){ | |
| 411 | + var langid = _languageid; | |
| 412 | + var coderecords = coderecordsData; | |
| 413 | + selectLang(langid); | |
| 414 | + compileMode(langid); | |
| 415 | + console.log(coderecords); | |
| 416 | + $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); | |
| 417 | + if (_languageid == 35) { | |
| 418 | + $('#cmprun-tabs').hide(); | |
| 419 | + } | |
| 420 | + if (_role ==0) { | |
| 421 | + player.init({ | |
| 422 | + container: '#audioWrap' | |
| 423 | + ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl | |
| 424 | + ,imagePath: 'js/audioPlayer/image' | |
| 425 | + ,debuggers: false | |
| 426 | + ,allowSeek: false | |
| 427 | + ,playCallback: function(){ // 播放 | |
| 428 | + playCode(); | |
| 429 | + GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | |
| 430 | + } | |
| 431 | + ,pauseCallback: function(){ // 暂停 | |
| 432 | + GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 433 | + pauseCode(); | |
| 434 | + GBCodePlayBack.firstPlay = 0; | |
| 435 | + GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | |
| 436 | + GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | |
| 437 | + } | |
| 438 | + ,seekedCallback: function(){} // 拖拽 | |
| 439 | + ,endedCallback: function(){ // 结束播放 | |
| 440 | + playEnd() | |
| 441 | + } | |
| 442 | + }); | |
| 443 | + var coderecords = coderecords.codeRecordList; | |
| 444 | + }else{ | |
| 445 | + $('.play-code').show(); | |
| 446 | + var coderecords = coderecords.studentRecordList; | |
| 447 | + } | |
| 448 | + | |
| 449 | + GBCodePlayBack.htmlplayereditor.setValue(''); | |
| 450 | + GBCodePlayBack.cssplayereditor.setValue(''); | |
| 451 | + GBCodePlayBack.jsplayereditor.setValue(''); | |
| 452 | + | |
| 453 | + var starttime = 0; | |
| 454 | + console.log(coderecords); | |
| 455 | + for(var i=0;i<coderecords.length;i++){ | |
| 456 | + if(!coderecords[i].trigger) coderecords[i].trigger = 0; | |
| 457 | + coderecords[i].changeobj = jQuery.parseJSON(coderecords[i].changeobj); | |
| 458 | + } | |
| 459 | + | |
| 460 | + GBCodePlayBack.records = coderecords; | |
| 461 | + player.play(); | |
| 433 | 462 | } |
| 434 | 463 | |
| 435 | 464 | // 使编辑器满屏 | ... | ... |