Commit 76c2e18c774472e5a2d2826371fd39babaa485b3
Merge branch 'new_Kira' of gitlab.gaoxiaobang.com:kira/programming into feature/20170228_rest
Showing
6 changed files
with
107 additions
and
34 deletions
src/css/recording.css
| @@ -38,6 +38,12 @@ button { | @@ -38,6 +38,12 @@ button { | ||
| 38 | padding-left: 0; | 38 | padding-left: 0; |
| 39 | padding-right: 0; } | 39 | padding-right: 0; } |
| 40 | 40 | ||
| 41 | +.play-code { | ||
| 42 | + background: transparent; | ||
| 43 | + color: #fff; | ||
| 44 | + border: none; | ||
| 45 | + padding-left: 24px; } | ||
| 46 | + | ||
| 41 | .upload-tip { | 47 | .upload-tip { |
| 42 | position: absolute; | 48 | position: absolute; |
| 43 | top: 0; | 49 | top: 0; |
src/js/gb.js
| @@ -308,6 +308,10 @@ $(function() { | @@ -308,6 +308,10 @@ $(function() { | ||
| 308 | _CodeMirrorRecordId, | 308 | _CodeMirrorRecordId, |
| 309 | _CodeMirrorReplayId, | 309 | _CodeMirrorReplayId, |
| 310 | _num = 0; | 310 | _num = 0; |
| 311 | + | ||
| 312 | + console.log('---------------------------------------') | ||
| 313 | + console.log(obj) | ||
| 314 | + console.log('---------------------------------------') | ||
| 311 | // 判断是否是初始化选时候调用 showEdite | 315 | // 判断是否是初始化选时候调用 showEdite |
| 312 | if(obj){ | 316 | if(obj){ |
| 313 | for (var i = 0; i < treeLinkEditor.length; i++) { | 317 | for (var i = 0; i < treeLinkEditor.length; i++) { |
| @@ -996,8 +1000,7 @@ $(function() { | @@ -996,8 +1000,7 @@ $(function() { | ||
| 996 | } | 1000 | } |
| 997 | }); | 1001 | }); |
| 998 | }else{ | 1002 | }else{ |
| 999 | - playCode(); | ||
| 1000 | - GBCodePlayBack.editable(0) | 1003 | + $('.play-code').show(); |
| 1001 | } | 1004 | } |
| 1002 | 1005 | ||
| 1003 | 1006 | ||
| @@ -1912,7 +1915,8 @@ $(function() { | @@ -1912,7 +1915,8 @@ $(function() { | ||
| 1912 | }, | 1915 | }, |
| 1913 | changeValueCallback: function(record, replay_type, offset) { | 1916 | changeValueCallback: function(record, replay_type, offset) { |
| 1914 | // console.info('GBCodePlayBack.changeValueCallback'); | 1917 | // console.info('GBCodePlayBack.changeValueCallback'); |
| 1915 | - // console.log(record); | 1918 | + console.log(record); |
| 1919 | + | ||
| 1916 | var obj = record.changeobj, | 1920 | var obj = record.changeobj, |
| 1917 | editor = record.editor; | 1921 | editor = record.editor; |
| 1918 | 1922 | ||
| @@ -1943,7 +1947,7 @@ $(function() { | @@ -1943,7 +1947,7 @@ $(function() { | ||
| 1943 | record.trigger = 1; //标记已运行 | 1947 | record.trigger = 1; //标记已运行 |
| 1944 | record.playTime = new Date().getTime(); // 播放开始时间 | 1948 | record.playTime = new Date().getTime(); // 播放开始时间 |
| 1945 | GBCodePlayBack.codeTimes = 1; // | 1949 | GBCodePlayBack.codeTimes = 1; // |
| 1946 | - console.log(record) | 1950 | + |
| 1947 | var resultData = { | 1951 | var resultData = { |
| 1948 | status: record.status || 200, | 1952 | status: record.status || 200, |
| 1949 | compilerInfo: record.compilerInfo || '', | 1953 | compilerInfo: record.compilerInfo || '', |
| @@ -1990,6 +1994,13 @@ $(function() { | @@ -1990,6 +1994,13 @@ $(function() { | ||
| 1990 | .removeClass('glyphicon-pause'); | 1994 | .removeClass('glyphicon-pause'); |
| 1991 | 1995 | ||
| 1992 | $('#recordertab a:first').tab('show'); | 1996 | $('#recordertab a:first').tab('show'); |
| 1997 | + if(_role == 1){ | ||
| 1998 | + for (var i = 0; i < GBCodePlayBack.records.length; i++) { | ||
| 1999 | + GBCodePlayBack.records[i].trigger = 0; | ||
| 2000 | + } | ||
| 2001 | + $('.play-code').attr('disabled', false); | ||
| 2002 | + } | ||
| 2003 | + | ||
| 1993 | if(document.URL.indexOf('index.htm') >= 0) { | 2004 | if(document.URL.indexOf('index.htm') >= 0) { |
| 1994 | Hourglass.stopTimer(); | 2005 | Hourglass.stopTimer(); |
| 1995 | } | 2006 | } |
| @@ -2029,6 +2040,12 @@ $(function() { | @@ -2029,6 +2040,12 @@ $(function() { | ||
| 2029 | var $sliderpropress = $(".replayprogress"); | 2040 | var $sliderpropress = $(".replayprogress"); |
| 2030 | $sliderpropress.slider("option", "disabled", false); | 2041 | $sliderpropress.slider("option", "disabled", false); |
| 2031 | $('#excerciselist .ineedautocodehelp').data('status', 0).attr('title', '播放').find('span').addClass('glyphicon-play-circle').removeClass('glyphicon-stop'); | 2042 | $('#excerciselist .ineedautocodehelp').data('status', 0).attr('title', '播放').find('span').addClass('glyphicon-play-circle').removeClass('glyphicon-stop'); |
| 2043 | + if(_role == 1){ | ||
| 2044 | + for (var i = 0; i < GBCodePlayBack.records.length; i++) { | ||
| 2045 | + GBCodePlayBack.records[i].trigger = 0; | ||
| 2046 | + } | ||
| 2047 | + $('.play-code').attr('disabled', false); | ||
| 2048 | + } | ||
| 2032 | } | 2049 | } |
| 2033 | } | 2050 | } |
| 2034 | }, | 2051 | }, |
| @@ -2327,6 +2344,14 @@ $(function() { | @@ -2327,6 +2344,14 @@ $(function() { | ||
| 2327 | runResult() | 2344 | runResult() |
| 2328 | }); | 2345 | }); |
| 2329 | 2346 | ||
| 2347 | + $('.play-code').click(function(){ | ||
| 2348 | + $('.play-code').attr('disabled', true); | ||
| 2349 | + console.log('--------------------'); | ||
| 2350 | + playCode(); | ||
| 2351 | + GBCodePlayBack.editable(0) | ||
| 2352 | + // playEnd(); | ||
| 2353 | + }); | ||
| 2354 | + | ||
| 2330 | // 使用服务端编译语言 | 2355 | // 使用服务端编译语言 |
| 2331 | $('#compileBtnGroup').unbind("click").on('click', '#CompileBtn', function(event){ | 2356 | $('#compileBtnGroup').unbind("click").on('click', '#CompileBtn', function(event){ |
| 2332 | console.info('$(\'#compileBtnGroup\').unbind("click")') | 2357 | console.info('$(\'#compileBtnGroup\').unbind("click")') |
| @@ -2341,13 +2366,15 @@ $(function() { | @@ -2341,13 +2366,15 @@ $(function() { | ||
| 2341 | var runStatus = $("#CompileBtn").data('run'); | 2366 | var runStatus = $("#CompileBtn").data('run'); |
| 2342 | if (runStatus == 1) { | 2367 | if (runStatus == 1) { |
| 2343 | Hourglass.pauseTimer(); // 暂停计时器 | 2368 | Hourglass.pauseTimer(); // 暂停计时器 |
| 2344 | - recorder.pause(); // 音频暂停 | 2369 | + if (_role == 0) { |
| 2370 | + recorder.pause(); // 音频暂停 | ||
| 2371 | + } | ||
| 2345 | } | 2372 | } |
| 2346 | $("#CompileBtn").data('run', 0); | 2373 | $("#CompileBtn").data('run', 0); |
| 2347 | $('.compile-loading').show(); | 2374 | $('.compile-loading').show(); |
| 2348 | // 暂停录制 | 2375 | // 暂停录制 |
| 2349 | var pauseState = $('#pause').data('pause'); | 2376 | var pauseState = $('#pause').data('pause'); |
| 2350 | - if (pauseState == 1 && _role == 0) { | 2377 | + if (pauseState == 1) { |
| 2351 | GBCodePlayBack.record_pause_time = new Date().getTime(); // 暂停的时间 | 2378 | GBCodePlayBack.record_pause_time = new Date().getTime(); // 暂停的时间 |
| 2352 | var recordobj = { | 2379 | var recordobj = { |
| 2353 | intervaltime: GBCodePlayBack.record_pause_time - GBCodePlayBack.record_startime, | 2380 | intervaltime: GBCodePlayBack.record_pause_time - GBCodePlayBack.record_startime, |
| @@ -3037,8 +3064,9 @@ $(function() { | @@ -3037,8 +3064,9 @@ $(function() { | ||
| 3037 | $('.pause-shodow').removeClass('show').addClass('hidden'); | 3064 | $('.pause-shodow').removeClass('show').addClass('hidden'); |
| 3038 | 3065 | ||
| 3039 | $('#pause').data('pause', '1'); | 3066 | $('#pause').data('pause', '1'); |
| 3040 | - | ||
| 3041 | - recorder.pause(); // 继续录制 | 3067 | + if (_role == 0) { |
| 3068 | + recorder.pause(); // 继续录制 | ||
| 3069 | + } | ||
| 3042 | } | 3070 | } |
| 3043 | 3071 | ||
| 3044 | function playEnd() { | 3072 | function playEnd() { |
src/js/gbreplayer.js
| @@ -381,34 +381,35 @@ $(function(){ | @@ -381,34 +381,35 @@ $(function(){ | ||
| 381 | compileMode(langid); | 381 | compileMode(langid); |
| 382 | console.log(coderecords); | 382 | console.log(coderecords); |
| 383 | $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); | 383 | $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); |
| 384 | - player.init({ | ||
| 385 | - container: '#audioWrap' | ||
| 386 | - ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl | ||
| 387 | - ,imagePath: 'js/audioPlayer/image' | ||
| 388 | - ,debuggers: false | ||
| 389 | - ,allowSeek: false | ||
| 390 | - ,playCallback: function(){ // 播放 | ||
| 391 | - playCode(); | ||
| 392 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | ||
| 393 | - } | ||
| 394 | - ,pauseCallback: function(){ // 暂停 | ||
| 395 | - GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | ||
| 396 | - pauseCode(); | ||
| 397 | - GBCodePlayBack.firstPlay = 0; | ||
| 398 | - GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | ||
| 399 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | ||
| 400 | - } | ||
| 401 | - ,seekedCallback: function(){} // 拖拽 | ||
| 402 | - ,endedCallback: function(){ // 结束播放 | ||
| 403 | - playEnd() | ||
| 404 | - } | ||
| 405 | - }); | ||
| 406 | - | ||
| 407 | - if (_role == 0) { | 384 | + if (_role ==0) { |
| 408 | var coderecords = coderecords.codeRecordList; | 385 | var coderecords = coderecords.codeRecordList; |
| 409 | - }else if (_role == 1) { | 386 | + player.init({ |
| 387 | + container: '#audioWrap' | ||
| 388 | + ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl | ||
| 389 | + ,imagePath: 'js/audioPlayer/image' | ||
| 390 | + ,debuggers: false | ||
| 391 | + ,allowSeek: false | ||
| 392 | + ,playCallback: function(){ // 播放 | ||
| 393 | + playCode(); | ||
| 394 | + GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | ||
| 395 | + } | ||
| 396 | + ,pauseCallback: function(){ // 暂停 | ||
| 397 | + GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | ||
| 398 | + pauseCode(); | ||
| 399 | + GBCodePlayBack.firstPlay = 0; | ||
| 400 | + GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | ||
| 401 | + GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | ||
| 402 | + } | ||
| 403 | + ,seekedCallback: function(){} // 拖拽 | ||
| 404 | + ,endedCallback: function(){ // 结束播放 | ||
| 405 | + playEnd() | ||
| 406 | + } | ||
| 407 | + }); | ||
| 408 | + }else{ | ||
| 410 | var coderecords = coderecords.studentRecordList; | 409 | var coderecords = coderecords.studentRecordList; |
| 410 | + $('.play-code').show(); | ||
| 411 | } | 411 | } |
| 412 | + | ||
| 412 | GBCodePlayBack.htmlplayereditor.setValue(''); | 413 | GBCodePlayBack.htmlplayereditor.setValue(''); |
| 413 | GBCodePlayBack.cssplayereditor.setValue(''); | 414 | GBCodePlayBack.cssplayereditor.setValue(''); |
| 414 | GBCodePlayBack.jsplayereditor.setValue(''); | 415 | GBCodePlayBack.jsplayereditor.setValue(''); |
| @@ -1323,7 +1324,16 @@ $(function(){ | @@ -1323,7 +1324,16 @@ $(function(){ | ||
| 1323 | 1324 | ||
| 1324 | 1325 | ||
| 1325 | $('#recordertab a:first').tab('show'); | 1326 | $('#recordertab a:first').tab('show'); |
| 1326 | - Hourglass.stopTimer(); | 1327 | + if(_role == 1){ |
| 1328 | + for (var i = 0; i < GBCodePlayBack.records.length; i++) { | ||
| 1329 | + GBCodePlayBack.records[i].trigger = 0; | ||
| 1330 | + } | ||
| 1331 | + $('.play-code').attr('disabled', false); | ||
| 1332 | + } | ||
| 1333 | + | ||
| 1334 | + if(document.URL.indexOf('index.htm') >= 0) { | ||
| 1335 | + Hourglass.stopTimer(); | ||
| 1336 | + } | ||
| 1327 | console.log("-----------播放结束------------") | 1337 | console.log("-----------播放结束------------") |
| 1328 | /* 移动设备的下一节和代码编写控制 */ | 1338 | /* 移动设备的下一节和代码编写控制 */ |
| 1329 | $('#donenext').removeClass('disabled'); | 1339 | $('#donenext').removeClass('disabled'); |
| @@ -1360,6 +1370,12 @@ $(function(){ | @@ -1360,6 +1370,12 @@ $(function(){ | ||
| 1360 | var $sliderpropress = $(".replayprogress"); | 1370 | var $sliderpropress = $(".replayprogress"); |
| 1361 | $sliderpropress.slider( "option", "disabled", false ); | 1371 | $sliderpropress.slider( "option", "disabled", false ); |
| 1362 | $('#excerciselist .ineedautocodehelp').data('status',0).attr('title','播放').find('span').addClass('glyphicon-play-circle').removeClass('glyphicon-stop'); | 1372 | $('#excerciselist .ineedautocodehelp').data('status',0).attr('title','播放').find('span').addClass('glyphicon-play-circle').removeClass('glyphicon-stop'); |
| 1373 | + if(_role == 1){ | ||
| 1374 | + for (var i = 0; i < GBCodePlayBack.records.length; i++) { | ||
| 1375 | + GBCodePlayBack.records[i].trigger = 0; | ||
| 1376 | + } | ||
| 1377 | + $('.play-code').attr('disabled', false); | ||
| 1378 | + } | ||
| 1363 | } | 1379 | } |
| 1364 | } | 1380 | } |
| 1365 | }, | 1381 | }, |
| @@ -1549,6 +1565,12 @@ $(function(){ | @@ -1549,6 +1565,12 @@ $(function(){ | ||
| 1549 | contrlPause() | 1565 | contrlPause() |
| 1550 | }) | 1566 | }) |
| 1551 | 1567 | ||
| 1568 | + $('.play-code').click(function(){ | ||
| 1569 | + $('.play-code').attr('disabled', true); | ||
| 1570 | + playCode(); | ||
| 1571 | + GBCodePlayBack.editable(0) | ||
| 1572 | + }); | ||
| 1573 | + | ||
| 1552 | // 继续录制配置 | 1574 | // 继续录制配置 |
| 1553 | function recodingConf(){ | 1575 | function recodingConf(){ |
| 1554 | Hourglass.pauseTimer(); | 1576 | Hourglass.pauseTimer(); |
src/player.html
| @@ -125,6 +125,9 @@ | @@ -125,6 +125,9 @@ | ||
| 125 | </div> | 125 | </div> |
| 126 | 126 | ||
| 127 | <div class="" id="audioWrap"> | 127 | <div class="" id="audioWrap"> |
| 128 | + <button class="play-code" style="display: none;"> | ||
| 129 | + <i class="icon iconfont icon-play"></i> | ||
| 130 | + </button> | ||
| 128 | <button id="full-screen"> | 131 | <button id="full-screen"> |
| 129 | <i class="icon iconfont icon-fangda"></i> | 132 | <i class="icon iconfont icon-fangda"></i> |
| 130 | </button> | 133 | </button> |
src/scss/recording.scss
| @@ -61,6 +61,13 @@ button{ | @@ -61,6 +61,13 @@ button{ | ||
| 61 | // } | 61 | // } |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | +.play-code{ | ||
| 65 | + background: transparent; | ||
| 66 | + color: #fff; | ||
| 67 | + border: none; | ||
| 68 | + padding-left: 24px; | ||
| 69 | +} | ||
| 70 | + | ||
| 64 | .upload-tip{ | 71 | .upload-tip{ |
| 65 | position: absolute; | 72 | position: absolute; |
| 66 | top: 0; | 73 | top: 0; |
src/v1.1/player.html
| @@ -126,6 +126,7 @@ | @@ -126,6 +126,7 @@ | ||
| 126 | </div> | 126 | </div> |
| 127 | <div class="pull-right"> | 127 | <div class="pull-right"> |
| 128 | <a id="full-screen" href="javascript:;" data-toggle="tooltip" data-placement="left" data-original-title="全屏录制" class="btn btn-link"><i class="icon iconfont icon-fangda"></i></a> | 128 | <a id="full-screen" href="javascript:;" data-toggle="tooltip" data-placement="left" data-original-title="全屏录制" class="btn btn-link"><i class="icon iconfont icon-fangda"></i></a> |
| 129 | + <a id="back-screen" href="javascript:;" data-toggle="tooltip" data-placement="left" data-original-title="退出全屏录制" class="btn btn-link" style="display: none;"><i class="icon iconfont icon-fangda"></i></a> | ||
| 129 | </div> | 130 | </div> |
| 130 | <div class="btn-group"> | 131 | <div class="btn-group"> |
| 131 | <button type="button" class="btn btn-success" id="play" data-status="0" title="" style="display: none;"><</button> | 132 | <button type="button" class="btn btn-success" id="play" data-status="0" title="" style="display: none;"><</button> |
| @@ -166,7 +167,13 @@ | @@ -166,7 +167,13 @@ | ||
| 166 | </div> | 167 | </div> |
| 167 | <div id="playFooter"> | 168 | <div id="playFooter"> |
| 168 | <div class="" id="audioWrap"> | 169 | <div class="" id="audioWrap"> |
| 170 | + <button class="play-code" style="display: none;"> | ||
| 171 | + <i class="icon iconfont icon-play"></i> | ||
| 172 | + </button> | ||
| 169 | </div> | 173 | </div> |
| 174 | +<!-- <div class="playCode"> | ||
| 175 | + <button>开始</button> | ||
| 176 | + </div> --> | ||
| 170 | </div> | 177 | </div> |
| 171 | </div> | 178 | </div> |
| 172 | <!-- --> | 179 | <!-- --> |