Commit 4d8f49d32416025b675717bd1c9be702a21554e2
1 parent
636ff718
适配录制和播放时显示作业问题描述
Showing
19 changed files
with
515 additions
and
63 deletions
dist/css/ide.css
| ... | ... | @@ -533,3 +533,33 @@ html, body { |
| 533 | 533 | |
| 534 | 534 | #stderr, #cmpinfo, #output { |
| 535 | 535 | padding: 12px 36px; } |
| 536 | + | |
| 537 | +.question-wrap { | |
| 538 | + padding: 0 15px; | |
| 539 | + display: none; } | |
| 540 | + | |
| 541 | +.question_title_wrap { | |
| 542 | + padding-bottom: 47px; } | |
| 543 | + | |
| 544 | +.question_title_wrap:first-child .question_describe { | |
| 545 | + font-size: 16px; | |
| 546 | + font-weight: normal; } | |
| 547 | + | |
| 548 | +.question_title_wrap .question_subtitle { | |
| 549 | + color: #2A2F33; | |
| 550 | + font-size: 14px; | |
| 551 | + font-weight: bold; | |
| 552 | + padding-bottom: 15px; } | |
| 553 | + | |
| 554 | +.question_title_wrap .question_subtitle span { | |
| 555 | + width: 14px; | |
| 556 | + height: 14px; | |
| 557 | + display: inline-block; | |
| 558 | + background: #1FB6FF; | |
| 559 | + border-radius: 50%; | |
| 560 | + margin-right: 8px; | |
| 561 | + vertical-align: middle; } | |
| 562 | + | |
| 563 | +.question_title_wrap .question_describe { | |
| 564 | + font-size: 12px; | |
| 565 | + line-height: 1.4; } | ... | ... |
dist/gxb-ide/Dir.js
| ... | ... | @@ -79,6 +79,17 @@ |
| 79 | 79 | console.log('res*****************************'); |
| 80 | 80 | console.log(res); //目录包含文件 |
| 81 | 81 | console.log(_lang); |
| 82 | + | |
| 83 | + if(getQuery('languageid') && getQuery('autoscore') && getQuery('question') && (getQuery('languageid') === '10' || getQuery('languageid') === '11')){ | |
| 84 | + res[_lang].length = 2; | |
| 85 | + console.log('-1'); | |
| 86 | + switchDir(2); | |
| 87 | + renderQuestion(id); | |
| 88 | + }else{ | |
| 89 | + console.log('-2'); | |
| 90 | + switchDir(1); | |
| 91 | + } | |
| 92 | + | |
| 82 | 93 | $("title").html(_lang); |
| 83 | 94 | Dir.treeData = res[_lang]; |
| 84 | 95 | Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); |
| ... | ... | @@ -94,6 +105,14 @@ |
| 94 | 105 | var _codeReplayId = getQuery('codeReplayId'); |
| 95 | 106 | var _studentReplayId = getQuery('studentReplayId'); |
| 96 | 107 | |
| 108 | + if(getQuery('languageid') && getQuery('autoscore') && getQuery('question') && (getQuery('languageid') === '10' || getQuery('languageid') === '11')){ | |
| 109 | + switchDir(2); | |
| 110 | + renderQuestion(id); | |
| 111 | + }else{ | |
| 112 | + console.log('-2'); | |
| 113 | + switchDir(1); | |
| 114 | + } | |
| 115 | + | |
| 97 | 116 | if (role == 0) { |
| 98 | 117 | playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; |
| 99 | 118 | getCodeData(playUrl, el) |
| ... | ... | @@ -597,6 +616,62 @@ |
| 597 | 616 | } |
| 598 | 617 | } |
| 599 | 618 | |
| 619 | + function renderQuestion (id) { | |
| 620 | + var url = gxb_api + '/classPopQuiz/assignment/api?' + new Date().getTime(); | |
| 621 | + var obj = {"questionIds":[],"programmingIds":[id]} | |
| 622 | + var questionTitle = $('#question_title'); | |
| 623 | + var questionDescribe = $('#title_describe'); | |
| 624 | + var inputDescribe = $('#input_describe'); | |
| 625 | + var exportDescribe = $('#export_describe'); | |
| 626 | + $.ajax({ | |
| 627 | + type: "POST", | |
| 628 | + url: url, | |
| 629 | + type: 'post', | |
| 630 | + data: JSON.stringify(obj), | |
| 631 | + dateType: 'json', | |
| 632 | + contentType: 'application/json', | |
| 633 | + success: function(res) { | |
| 634 | + console.log('classPopQuiz'); | |
| 635 | + console.log(res); | |
| 636 | + | |
| 637 | + questionTitle.html(res.programmingList[0].title) | |
| 638 | + questionDescribe.html(res.programmingList[0].titleDesc) | |
| 639 | + inputDescribe.html(res.programmingList[0].inputDesc) | |
| 640 | + exportDescribe.html(res.programmingList[0].outputDesc) | |
| 641 | + }, | |
| 642 | + error: function(XMLHttpRequest, textStatus, errorThrown) { | |
| 643 | + console.log('Ajax langs.json error'); | |
| 644 | + console.log(XMLHttpRequest); | |
| 645 | + } | |
| 646 | + }); | |
| 647 | + } | |
| 648 | + | |
| 649 | + /** | |
| 650 | + * 兼容编程作业 左侧目录树 | |
| 651 | + * @Author syantao | |
| 652 | + * @Mail ytshang@huikedu.com | |
| 653 | + * Created by syantao on 2018-03-16 | |
| 654 | + * @param {[number]} flag | |
| 655 | + * 1: 显示目录树 | |
| 656 | + * 2: 显示作业详情 | |
| 657 | + * @return {[type]} [description] | |
| 658 | + */ | |
| 659 | + function switchDir (flag) { | |
| 660 | + var treeWrap = $('.tree-wrap'); | |
| 661 | + var questionWrap = $('.question-wrap'); | |
| 662 | + var _flag = flag || 1; | |
| 663 | + if(flag != 1 && flag != 2){ | |
| 664 | + flag = 1; | |
| 665 | + } | |
| 666 | + if(flag === 1){ | |
| 667 | + treeWrap.show(); | |
| 668 | + questionWrap.hide(); | |
| 669 | + }else{ | |
| 670 | + treeWrap.hide(); | |
| 671 | + questionWrap.show(); | |
| 672 | + } | |
| 673 | + } | |
| 674 | + | |
| 600 | 675 | |
| 601 | 676 | // 获取code |
| 602 | 677 | function getCodeData(url, el){ |
| ... | ... | @@ -627,9 +702,18 @@ |
| 627 | 702 | $('#ifrcontainer').hide() |
| 628 | 703 | } |
| 629 | 704 | var coderecords = res.codeRecordList || res.studentRecordList; |
| 630 | - var audioUrl = res.audioUrl; | |
| 631 | - | |
| 632 | - var treeArr = res.programmingFileList; | |
| 705 | + var audioUrl = '/uploads/programming_audio/link/18/03/17/633e9dc9820845b1a5fde6804c525ed4'; | |
| 706 | + // var audioUrl = res.audioUrl || '/uploads/programming_audio/link/18/03/17/633e9dc9820845b1a5fde6804c525ed4'; | |
| 707 | + | |
| 708 | + var treeArr = res.programmingFileList || [ { | |
| 709 | + "fileId" : null, | |
| 710 | + "path" : "package1/default1.java", | |
| 711 | + "content" : "public class Main {\n public int add(int a,int b){\n return a+b;\n }\n}", | |
| 712 | + "codeReplayId" : null, | |
| 713 | + "createdAt" : null, | |
| 714 | + "updatedAt" : null, | |
| 715 | + "deleteFlag" : null | |
| 716 | + } ]; | |
| 633 | 717 | Dir.treeData = programFileListToTreeJson(treeArr); |
| 634 | 718 | Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); |
| 635 | 719 | Dir.treeObj.setting.edit.showRenameBtn = false; | ... | ... |
dist/gxb-ide/Iterm.js
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | var isCompile = false; |
| 3 | 3 | var _languageid = getQuery('languageid'); |
| 4 | 4 | var _userId = getQuery('userId'); |
| 5 | + var autoScore = !!getQuery('autoScore'); | |
| 6 | + var questionId = getQuery('question'); | |
| 5 | 7 | |
| 6 | 8 | var Iterm = { |
| 7 | 9 | constructor: Iterm, |
| ... | ... | @@ -161,9 +163,24 @@ |
| 161 | 163 | "fileList": _fileList || [] |
| 162 | 164 | } |
| 163 | 165 | console.log(compileData); |
| 166 | + | |
| 167 | + var compileApiUrl = ''; | |
| 168 | + if(autoScore && questionId) { | |
| 169 | + compileApiUrl = gxb_api + "/programming/exam/codeRun/" + questionId + "/api"; | |
| 170 | + compileData = { | |
| 171 | + userId: userId, | |
| 172 | + languageId: languageId, | |
| 173 | + content: _fileList[0].content | |
| 174 | + }; | |
| 175 | + } | |
| 176 | + else { | |
| 177 | + compileApiUrl = gxb_api + "/gxb-web/programmingMulti/codeRun/api"; | |
| 178 | + } | |
| 179 | + | |
| 180 | + //编译运行的接口部分 | |
| 164 | 181 | $.ajax({ |
| 165 | 182 | type: "POST", |
| 166 | - url: gxb_api + "/gxb-web/programmingMulti/codeRun/api", | |
| 183 | + url: compileApiUrl, | |
| 167 | 184 | data: JSON.stringify(compileData), |
| 168 | 185 | dataType: "json", |
| 169 | 186 | contentType: "application/json", |
| ... | ... | @@ -173,6 +190,13 @@ |
| 173 | 190 | $('.compile-loading').hide(); |
| 174 | 191 | $('.compile-reslut').show(); |
| 175 | 192 | |
| 193 | + if(autoScore && questionId) { | |
| 194 | + if(data.testResultsVo){ | |
| 195 | + var passRate = 100 - (data.testResultsVo.failureCount / data.testResultsVo.runCount * 100) | |
| 196 | + $('.score-wrap').show().children('.score-text').text(passRate.toFixed(2)) | |
| 197 | + } | |
| 198 | + } | |
| 199 | + | |
| 176 | 200 | compileResult(data) |
| 177 | 201 | l.remove(); |
| 178 | 202 | CodingEditer.compileResultData = data; | ... | ... |
dist/gxb-ide/ToolBox.js
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | '<input type="button" id="savecode" class="upload-stud" style="display: none;" disabled="disabled" value="保存da">'+ |
| 24 | 24 | '<input type="button" id="cancel" value="关闭">'+ |
| 25 | 25 | '</div>'+ |
| 26 | + '<div class="score-wrap" style="display: none;">预估得分:<span class="score-text">0</span>,点击保存按钮分数才会生效</div>'+ | |
| 26 | 27 | '</div>'; |
| 27 | 28 | |
| 28 | 29 | function ToolBox(){ |
| ... | ... | @@ -140,6 +141,7 @@ |
| 140 | 141 | $('#audio-play').hide() |
| 141 | 142 | $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true); |
| 142 | 143 | $('#recordertab a:eq(0)').tab('show'); |
| 144 | + $('.score-wrap').hide(); | |
| 143 | 145 | |
| 144 | 146 | CodingEditer.resetCodeMirrorValue(0); |
| 145 | 147 | |
| ... | ... | @@ -212,11 +214,10 @@ |
| 212 | 214 | var saveformat = $('#saveformat').find('.active').data('saveformat') || 5; |
| 213 | 215 | var programmingFileList = Dir.getTreeData(); |
| 214 | 216 | var keepTimer = Math.round($('#audio')[0].duration); |
| 215 | - | |
| 216 | - | |
| 217 | 217 | var postData = { |
| 218 | 218 | "mainPath": Dir.mainPath, |
| 219 | 219 | "mainArgus": "lixxx", |
| 220 | + "programmingFileList": programmingFileList, | |
| 220 | 221 | "runtimeArgus": $('#runtimeArgus').val(), |
| 221 | 222 | "pickup": pickup, |
| 222 | 223 | "userId": _this.options.userId, |
| ... | ... | @@ -229,11 +230,12 @@ |
| 229 | 230 | "saveformat": saveformat, |
| 230 | 231 | "audioUrl": $('.audio-url').val(), |
| 231 | 232 | "programmingSource": 1, |
| 232 | - "programmingFileList": programmingFileList, | |
| 233 | 233 | "totaltime": keepTimer |
| 234 | 234 | } |
| 235 | 235 | var temp_record = JSON.parse(JSON.stringify(CodingEditer.records)) |
| 236 | 236 | var codeRecordLists = []; |
| 237 | + var _role = _this.options.role; | |
| 238 | + var roleUrl; | |
| 237 | 239 | |
| 238 | 240 | for (var i = 0; i < temp_record.length; i++) { |
| 239 | 241 | var temp_record_item = temp_record[i]; |
| ... | ... | @@ -245,17 +247,20 @@ |
| 245 | 247 | } |
| 246 | 248 | codeRecordLists.push(temp_record_item); |
| 247 | 249 | } |
| 248 | - var _role = _this.options.role; | |
| 249 | - console.log(_role); | |
| 250 | - console.log(gxb_api); | |
| 251 | 250 | if (_role == 0) { |
| 252 | 251 | postData.codeRecordList = codeRecordLists; |
| 253 | - var roleUrl = gxb_api + "/programming/codeReplay/api" | |
| 252 | + roleUrl = gxb_api + "/programming/codeReplay/api" | |
| 254 | 253 | }else if (_role == 1) { |
| 255 | 254 | postData.studentRecordList = codeRecordLists; |
| 256 | - var roleUrl = gxb_api + "/programming/student/studentReplay/api" | |
| 255 | + roleUrl = gxb_api + "/programming/student/studentReplay/api" | |
| 256 | + } | |
| 257 | + | |
| 258 | + if (_this.options.autoScore) { | |
| 259 | + postData.html = CodingEditer.getCodeMirrorValue()[0]; | |
| 257 | 260 | } |
| 261 | + console.log(postData); | |
| 258 | 262 | console.log(roleUrl); |
| 263 | + // return false; | |
| 259 | 264 | $.ajax({ |
| 260 | 265 | type: "post", |
| 261 | 266 | url: roleUrl, | ... | ... |
dist/gxb-ide/toolBox.css
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | margin: 2px 8px; |
| 41 | 41 | border-radius: 50%; |
| 42 | 42 | } |
| 43 | -.save-wrap{ | |
| 43 | +.save-wrap, .score-wrap { | |
| 44 | 44 | float: right; |
| 45 | 45 | height: 60px; |
| 46 | 46 | line-height: 60px; |
| ... | ... | @@ -57,7 +57,7 @@ |
| 57 | 57 | margin-left: 12px; |
| 58 | 58 | } |
| 59 | 59 | .save-wrap .upload-stud, .save-wrap .upload-teach { |
| 60 | - // border: 1px solid #999; | |
| 60 | + /*border: 1px solid #999;*/ | |
| 61 | 61 | } |
| 62 | 62 | .save-wrap #cancel { |
| 63 | 63 | background-color: transparent; |
| ... | ... | @@ -65,6 +65,11 @@ |
| 65 | 65 | color: #1FB6FF; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | +.score-wrap { | |
| 69 | + padding: 0 20px; | |
| 70 | + color: #fff; | |
| 71 | +} | |
| 72 | + | |
| 68 | 73 | .upload-teach, .upload-stud{ |
| 69 | 74 | // background: -webkit-linear-gradient(left, #505151, #939494); |
| 70 | 75 | // background: -moz-linear-gradient(left, #505151, #939494); | ... | ... |
dist/js/c.js
| ... | ... | @@ -2,10 +2,20 @@ |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | $(function(){ |
| 5 | - var _languageid = getQuery('languageid'); //返回URL中的查询部分 | |
| 6 | - var _userId = getQuery('userId'); | |
| 7 | - var _role = getQuery('role'); | |
| 8 | - var flag = true; | |
| 5 | + var _languageid = getQuery('languageid'); // 返回URL中的查询部分 | |
| 6 | + var _userId = getQuery('userId'); // 用户ID | |
| 7 | + var _role = getQuery('role'); // 用户角色 0:学生 1:老师 | |
| 8 | + var _autoScore = getQuery('autoScore'); // 是否开启自动打分 也就是左侧是否显示目录的依据 | |
| 9 | + var _questionId = getQuery('question'); // 问题ID | |
| 10 | + var flag = true; | |
| 11 | + | |
| 12 | + if(_autoScore){ | |
| 13 | + if(_autoScore === 'true'){ | |
| 14 | + _autoScore = true; | |
| 15 | + }else{ | |
| 16 | + _autoScore = false; | |
| 17 | + } | |
| 18 | + } | |
| 9 | 19 | |
| 10 | 20 | if(_languageid == 35){ |
| 11 | 21 | $('.switch').show(); |
| ... | ... | @@ -22,6 +32,8 @@ $(function(){ |
| 22 | 32 | el: '#folder', |
| 23 | 33 | isPlayPage: 0, |
| 24 | 34 | languageid: parseInt(_languageid), |
| 35 | + questionId: _questionId, | |
| 36 | + autoScore: _autoScore, | |
| 25 | 37 | role: _role |
| 26 | 38 | }); |
| 27 | 39 | |
| ... | ... | @@ -44,6 +56,8 @@ $(function(){ |
| 44 | 56 | role: _role, |
| 45 | 57 | userId: _userId, |
| 46 | 58 | languageId: _languageid, |
| 59 | + questionId: _questionId, | |
| 60 | + autoScore: _autoScore, | |
| 47 | 61 | startCallback: function(){ |
| 48 | 62 | // 禁止重命名 |
| 49 | 63 | setTimeout(function(){ | ... | ... |
dist/js/player.js
| 1 | 1 | $(function(){ |
| 2 | - var _languageid = getQuery('languageid'); | |
| 3 | - var _userId = getQuery('userId'); | |
| 4 | - var _role = getQuery('role'); | |
| 5 | - var _codeReplayId = getQuery('codeReplayId'); | |
| 2 | + var _languageid = getQuery('languageid'); | |
| 3 | + var _userId = getQuery('userId'); | |
| 4 | + var _role = getQuery('role'); | |
| 5 | + var _codeReplayId = getQuery('codeReplayId'); | |
| 6 | + var _autoScore = getQuery('autoScore'); // 是否开启自动打分 也就是左侧是否显示目录的依据 | |
| 6 | 7 | var status = true; |
| 7 | 8 | |
| 8 | 9 | // new一个基本IDE结构 |
| ... | ... | @@ -10,6 +11,7 @@ $(function(){ |
| 10 | 11 | el: '#folder', |
| 11 | 12 | role: _role, |
| 12 | 13 | isPlayPage: 1, |
| 14 | + autoScore: _autoScore, | |
| 13 | 15 | languageid: parseInt(_languageid) |
| 14 | 16 | }); |
| 15 | 17 | ... | ... |
dist/scss/ide.scss
| 1 | - | |
| 2 | 1 | @import 'utils'; |
| 3 | 2 | @import 'variables'; |
| 4 | 3 | @import '_zTreeRewrite'; |
| ... | ... | @@ -6,3 +5,39 @@ |
| 6 | 5 | @import '_animation.scss'; |
| 7 | 6 | @import 'main'; |
| 8 | 7 | |
| 8 | + | |
| 9 | +.question-wrap { | |
| 10 | + padding: 0 15px; | |
| 11 | + display: none; | |
| 12 | +} | |
| 13 | + | |
| 14 | +.question_title_wrap { | |
| 15 | + padding-bottom: 47px; | |
| 16 | +} | |
| 17 | + | |
| 18 | +.question_title_wrap:first-child .question_describe { | |
| 19 | + font-size: 16px; | |
| 20 | + font-weight: normal; | |
| 21 | +} | |
| 22 | + | |
| 23 | +.question_title_wrap .question_subtitle { | |
| 24 | + color: #2A2F33; | |
| 25 | + font-size: 14px; | |
| 26 | + font-weight: bold; | |
| 27 | + padding-bottom: 15px; | |
| 28 | +} | |
| 29 | + | |
| 30 | +.question_title_wrap .question_subtitle span { | |
| 31 | + width: 14px; | |
| 32 | + height: 14px; | |
| 33 | + display: inline-block; | |
| 34 | + background: #1FB6FF; | |
| 35 | + border-radius: 50%; | |
| 36 | + margin-right: 8px; | |
| 37 | + vertical-align: middle; | |
| 38 | +} | |
| 39 | + | |
| 40 | +.question_title_wrap .question_describe { | |
| 41 | + font-size: 12px; | |
| 42 | + line-height: 1.4; | |
| 43 | +} | ... | ... |
dist/v1.1/index.html
| ... | ... | @@ -60,12 +60,12 @@ |
| 60 | 60 | <ul id="recordertab" class="nav nav-tabs pull-left"> |
| 61 | 61 | <li class="active"> |
| 62 | 62 | <a href="#recordzone" data-toggle="tab"> |
| 63 | - <i class="icon iconfont icon-tingzhi"></i>课程录制区 | |
| 63 | + <i class="icon iconfont icon-tingzhi"></i><span>课程录制区</span> | |
| 64 | 64 | </a> |
| 65 | 65 | </li> |
| 66 | 66 | <li> |
| 67 | 67 | <a href="#replayzone" data-toggle="tab"> |
| 68 | - <i class="icon iconfont icon-bofang2"></i>课程预览区 | |
| 68 | + <i class="icon iconfont icon-bofang2"></i><span>课程预览区</span> | |
| 69 | 69 | </a> |
| 70 | 70 | </li> |
| 71 | 71 | <li> |
| ... | ... | @@ -83,15 +83,35 @@ |
| 83 | 83 | </div> |
| 84 | 84 | </li> |
| 85 | 85 | </div> |
| 86 | - | |
| 87 | 86 | <!-- 录制区 --> |
| 88 | 87 | <div class="record-wrap"> |
| 89 | 88 | <!-- 录制区 --> |
| 90 | 89 | <div class="gxb-record"> |
| 91 | 90 | <div id="ideDir"> |
| 92 | - <div class="tree-header">目录</div> | |
| 93 | - <ul id="folder" class="ztree"></ul> | |
| 94 | - <div id="handleLM"></div> | |
| 91 | + <div class="tree-wrap" style="display: none;"> | |
| 92 | + <div class="tree-header">目录</div> | |
| 93 | + <ul id="folder" class="ztree"></ul> | |
| 94 | + <div id="handleLM"></div> | |
| 95 | + </div> | |
| 96 | + <div class="question-wrap"> | |
| 97 | + <div class="question_title_wrap"> | |
| 98 | + <div class="question_subtitle"><span></span>题目</div> | |
| 99 | + <p class="question_describe" id="question_title">...</p> | |
| 100 | + </div> | |
| 101 | + <h3 class="question_title"></h3> | |
| 102 | + <div class="question_title_wrap"> | |
| 103 | + <div class="question_subtitle"><span></span>题目描述</div> | |
| 104 | + <p class="question_describe" id="title_describe">...</p> | |
| 105 | + </div> | |
| 106 | + <div class="question_title_wrap"> | |
| 107 | + <div class="question_subtitle"><span></span>输入描述</div> | |
| 108 | + <p class="question_describe" id="input_describe">...</p> | |
| 109 | + </div> | |
| 110 | + <div class="question_title_wrap"> | |
| 111 | + <div class="question_subtitle"><span></span>输出描述</div> | |
| 112 | + <p class="question_describe" id="export_describe">...</p> | |
| 113 | + </div> | |
| 114 | + </div> | |
| 95 | 115 | </div> |
| 96 | 116 | |
| 97 | 117 | <div id="ideEditer" class="tab-content"> | ... | ... |
dist/v1.1/player.html
| ... | ... | @@ -72,9 +72,30 @@ |
| 72 | 72 | <div class="gxb-record"> |
| 73 | 73 | <div class="m-dir-wrap"> |
| 74 | 74 | <div id="ideDir"> |
| 75 | - <div class="tree-header">目录</div> | |
| 76 | - <ul id="folder" class="ztree"></ul> | |
| 77 | - <div id="handleLM"></div> | |
| 75 | + <div class="tree-wrap" style="display: none;"> | |
| 76 | + <div class="tree-header">目录</div> | |
| 77 | + <ul id="folder" class="ztree"></ul> | |
| 78 | + <div id="handleLM"></div> | |
| 79 | + </div> | |
| 80 | + <div class="question-wrap"> | |
| 81 | + <div class="question_title_wrap"> | |
| 82 | + <div class="question_subtitle"><span></span>题目</div> | |
| 83 | + <p class="question_describe" id="question_title">...</p> | |
| 84 | + </div> | |
| 85 | + <h3 class="question_title"></h3> | |
| 86 | + <div class="question_title_wrap"> | |
| 87 | + <div class="question_subtitle"><span></span>题目描述</div> | |
| 88 | + <p class="question_describe" id="title_describe">...</p> | |
| 89 | + </div> | |
| 90 | + <div class="question_title_wrap"> | |
| 91 | + <div class="question_subtitle"><span></span>输入描述</div> | |
| 92 | + <p class="question_describe" id="input_describe">...</p> | |
| 93 | + </div> | |
| 94 | + <div class="question_title_wrap"> | |
| 95 | + <div class="question_subtitle"><span></span>输出描述</div> | |
| 96 | + <p class="question_describe" id="export_describe">...</p> | |
| 97 | + </div> | |
| 98 | + </div> | |
| 78 | 99 | </div> |
| 79 | 100 | </div> |
| 80 | 101 | <div id="ideEditer" class="tab-content"> | ... | ... |
src/css/ide.css
| ... | ... | @@ -503,7 +503,7 @@ html, body { |
| 503 | 503 | .before, .after { |
| 504 | 504 | position: absolute; |
| 505 | 505 | left: 208px; |
| 506 | - width: 200px; | |
| 506 | + width: 50%; | |
| 507 | 507 | height: 36px; |
| 508 | 508 | top: 12px; } |
| 509 | 509 | |
| ... | ... | @@ -533,3 +533,33 @@ html, body { |
| 533 | 533 | |
| 534 | 534 | #stderr, #cmpinfo, #output { |
| 535 | 535 | padding: 12px 36px; } |
| 536 | + | |
| 537 | +.question-wrap { | |
| 538 | + padding: 0 15px; | |
| 539 | + display: none; } | |
| 540 | + | |
| 541 | +.question_title_wrap { | |
| 542 | + padding-bottom: 47px; } | |
| 543 | + | |
| 544 | +.question_title_wrap:first-child .question_describe { | |
| 545 | + font-size: 16px; | |
| 546 | + font-weight: normal; } | |
| 547 | + | |
| 548 | +.question_title_wrap .question_subtitle { | |
| 549 | + color: #2A2F33; | |
| 550 | + font-size: 14px; | |
| 551 | + font-weight: bold; | |
| 552 | + padding-bottom: 15px; } | |
| 553 | + | |
| 554 | +.question_title_wrap .question_subtitle span { | |
| 555 | + width: 14px; | |
| 556 | + height: 14px; | |
| 557 | + display: inline-block; | |
| 558 | + background: #1FB6FF; | |
| 559 | + border-radius: 50%; | |
| 560 | + margin-right: 8px; | |
| 561 | + vertical-align: middle; } | |
| 562 | + | |
| 563 | +.question_title_wrap .question_describe { | |
| 564 | + font-size: 12px; | |
| 565 | + line-height: 1.4; } | ... | ... |
src/gxb-ide/Dir.js
| ... | ... | @@ -79,6 +79,17 @@ |
| 79 | 79 | console.log('res*****************************'); |
| 80 | 80 | console.log(res); //目录包含文件 |
| 81 | 81 | console.log(_lang); |
| 82 | + | |
| 83 | + if(getQuery('languageid') && getQuery('autoscore') && getQuery('question') && (getQuery('languageid') === '10' || getQuery('languageid') === '11')){ | |
| 84 | + res[_lang].length = 2; | |
| 85 | + console.log('-1'); | |
| 86 | + switchDir(2); | |
| 87 | + renderQuestion(id); | |
| 88 | + }else{ | |
| 89 | + console.log('-2'); | |
| 90 | + switchDir(1); | |
| 91 | + } | |
| 92 | + | |
| 82 | 93 | $("title").html(_lang); |
| 83 | 94 | Dir.treeData = res[_lang]; |
| 84 | 95 | Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); |
| ... | ... | @@ -94,6 +105,14 @@ |
| 94 | 105 | var _codeReplayId = getQuery('codeReplayId'); |
| 95 | 106 | var _studentReplayId = getQuery('studentReplayId'); |
| 96 | 107 | |
| 108 | + if(getQuery('languageid') && getQuery('autoscore') && getQuery('question') && (getQuery('languageid') === '10' || getQuery('languageid') === '11')){ | |
| 109 | + switchDir(2); | |
| 110 | + renderQuestion(id); | |
| 111 | + }else{ | |
| 112 | + console.log('-2'); | |
| 113 | + switchDir(1); | |
| 114 | + } | |
| 115 | + | |
| 97 | 116 | if (role == 0) { |
| 98 | 117 | playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; |
| 99 | 118 | getCodeData(playUrl, el) |
| ... | ... | @@ -597,6 +616,62 @@ |
| 597 | 616 | } |
| 598 | 617 | } |
| 599 | 618 | |
| 619 | + function renderQuestion (id) { | |
| 620 | + var url = gxb_api + '/classPopQuiz/assignment/api?' + new Date().getTime(); | |
| 621 | + var obj = {"questionIds":[],"programmingIds":[id]} | |
| 622 | + var questionTitle = $('#question_title'); | |
| 623 | + var questionDescribe = $('#title_describe'); | |
| 624 | + var inputDescribe = $('#input_describe'); | |
| 625 | + var exportDescribe = $('#export_describe'); | |
| 626 | + $.ajax({ | |
| 627 | + type: "POST", | |
| 628 | + url: url, | |
| 629 | + type: 'post', | |
| 630 | + data: JSON.stringify(obj), | |
| 631 | + dateType: 'json', | |
| 632 | + contentType: 'application/json', | |
| 633 | + success: function(res) { | |
| 634 | + console.log('classPopQuiz'); | |
| 635 | + console.log(res); | |
| 636 | + | |
| 637 | + questionTitle.html(res.programmingList[0].title) | |
| 638 | + questionDescribe.html(res.programmingList[0].titleDesc) | |
| 639 | + inputDescribe.html(res.programmingList[0].inputDesc) | |
| 640 | + exportDescribe.html(res.programmingList[0].outputDesc) | |
| 641 | + }, | |
| 642 | + error: function(XMLHttpRequest, textStatus, errorThrown) { | |
| 643 | + console.log('Ajax langs.json error'); | |
| 644 | + console.log(XMLHttpRequest); | |
| 645 | + } | |
| 646 | + }); | |
| 647 | + } | |
| 648 | + | |
| 649 | + /** | |
| 650 | + * 兼容编程作业 左侧目录树 | |
| 651 | + * @Author syantao | |
| 652 | + * @Mail ytshang@huikedu.com | |
| 653 | + * Created by syantao on 2018-03-16 | |
| 654 | + * @param {[number]} flag | |
| 655 | + * 1: 显示目录树 | |
| 656 | + * 2: 显示作业详情 | |
| 657 | + * @return {[type]} [description] | |
| 658 | + */ | |
| 659 | + function switchDir (flag) { | |
| 660 | + var treeWrap = $('.tree-wrap'); | |
| 661 | + var questionWrap = $('.question-wrap'); | |
| 662 | + var _flag = flag || 1; | |
| 663 | + if(flag != 1 && flag != 2){ | |
| 664 | + flag = 1; | |
| 665 | + } | |
| 666 | + if(flag === 1){ | |
| 667 | + treeWrap.show(); | |
| 668 | + questionWrap.hide(); | |
| 669 | + }else{ | |
| 670 | + treeWrap.hide(); | |
| 671 | + questionWrap.show(); | |
| 672 | + } | |
| 673 | + } | |
| 674 | + | |
| 600 | 675 | |
| 601 | 676 | // 获取code |
| 602 | 677 | function getCodeData(url, el){ |
| ... | ... | @@ -627,9 +702,18 @@ |
| 627 | 702 | $('#ifrcontainer').hide() |
| 628 | 703 | } |
| 629 | 704 | var coderecords = res.codeRecordList || res.studentRecordList; |
| 630 | - var audioUrl = res.audioUrl; | |
| 631 | - | |
| 632 | - var treeArr = res.programmingFileList; | |
| 705 | + var audioUrl = '/uploads/programming_audio/link/18/03/17/633e9dc9820845b1a5fde6804c525ed4'; | |
| 706 | + // var audioUrl = res.audioUrl || '/uploads/programming_audio/link/18/03/17/633e9dc9820845b1a5fde6804c525ed4'; | |
| 707 | + | |
| 708 | + var treeArr = res.programmingFileList || [ { | |
| 709 | + "fileId" : null, | |
| 710 | + "path" : "package1/default1.java", | |
| 711 | + "content" : "public class Main {\n public int add(int a,int b){\n return a+b;\n }\n}", | |
| 712 | + "codeReplayId" : null, | |
| 713 | + "createdAt" : null, | |
| 714 | + "updatedAt" : null, | |
| 715 | + "deleteFlag" : null | |
| 716 | + } ]; | |
| 633 | 717 | Dir.treeData = programFileListToTreeJson(treeArr); |
| 634 | 718 | Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); |
| 635 | 719 | Dir.treeObj.setting.edit.showRenameBtn = false; | ... | ... |
src/gxb-ide/Iterm.js
| ... | ... | @@ -191,7 +191,10 @@ |
| 191 | 191 | $('.compile-reslut').show(); |
| 192 | 192 | |
| 193 | 193 | if(autoScore && questionId) { |
| 194 | - $('.score-wrap').show().children('.score-text').text(data.automaticScore) | |
| 194 | + if(data.testResultsVo){ | |
| 195 | + var passRate = 100 - (data.testResultsVo.failureCount / data.testResultsVo.runCount * 100) | |
| 196 | + $('.score-wrap').show().children('.score-text').text(passRate.toFixed(2)) | |
| 197 | + } | |
| 195 | 198 | } |
| 196 | 199 | |
| 197 | 200 | compileResult(data) | ... | ... |
src/gxb-ide/ToolBox.js
| ... | ... | @@ -214,11 +214,10 @@ |
| 214 | 214 | var saveformat = $('#saveformat').find('.active').data('saveformat') || 5; |
| 215 | 215 | var programmingFileList = Dir.getTreeData(); |
| 216 | 216 | var keepTimer = Math.round($('#audio')[0].duration); |
| 217 | - | |
| 218 | - | |
| 219 | 217 | var postData = { |
| 220 | 218 | "mainPath": Dir.mainPath, |
| 221 | 219 | "mainArgus": "lixxx", |
| 220 | + "programmingFileList": programmingFileList, | |
| 222 | 221 | "runtimeArgus": $('#runtimeArgus').val(), |
| 223 | 222 | "pickup": pickup, |
| 224 | 223 | "userId": _this.options.userId, |
| ... | ... | @@ -231,11 +230,12 @@ |
| 231 | 230 | "saveformat": saveformat, |
| 232 | 231 | "audioUrl": $('.audio-url').val(), |
| 233 | 232 | "programmingSource": 1, |
| 234 | - "programmingFileList": programmingFileList, | |
| 235 | 233 | "totaltime": keepTimer |
| 236 | 234 | } |
| 237 | 235 | var temp_record = JSON.parse(JSON.stringify(CodingEditer.records)) |
| 238 | 236 | var codeRecordLists = []; |
| 237 | + var _role = _this.options.role; | |
| 238 | + var roleUrl; | |
| 239 | 239 | |
| 240 | 240 | for (var i = 0; i < temp_record.length; i++) { |
| 241 | 241 | var temp_record_item = temp_record[i]; |
| ... | ... | @@ -247,17 +247,20 @@ |
| 247 | 247 | } |
| 248 | 248 | codeRecordLists.push(temp_record_item); |
| 249 | 249 | } |
| 250 | - var _role = _this.options.role; | |
| 251 | - console.log(_role); | |
| 252 | - console.log(gxb_api); | |
| 253 | 250 | if (_role == 0) { |
| 254 | 251 | postData.codeRecordList = codeRecordLists; |
| 255 | - var roleUrl = gxb_api + "/programming/codeReplay/api" | |
| 252 | + roleUrl = gxb_api + "/programming/codeReplay/api" | |
| 256 | 253 | }else if (_role == 1) { |
| 257 | 254 | postData.studentRecordList = codeRecordLists; |
| 258 | - var roleUrl = gxb_api + "/programming/student/studentReplay/api" | |
| 255 | + roleUrl = gxb_api + "/programming/student/studentReplay/api" | |
| 256 | + } | |
| 257 | + | |
| 258 | + if (_this.options.autoScore) { | |
| 259 | + postData.html = CodingEditer.getCodeMirrorValue()[0]; | |
| 259 | 260 | } |
| 261 | + console.log(postData); | |
| 260 | 262 | console.log(roleUrl); |
| 263 | + // return false; | |
| 261 | 264 | $.ajax({ |
| 262 | 265 | type: "post", |
| 263 | 266 | url: roleUrl, | ... | ... |
src/js/c.js
| ... | ... | @@ -2,10 +2,20 @@ |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | $(function(){ |
| 5 | - var _languageid = getQuery('languageid'); //返回URL中的查询部分 | |
| 6 | - var _userId = getQuery('userId'); | |
| 7 | - var _role = getQuery('role'); | |
| 8 | - var flag = true; | |
| 5 | + var _languageid = getQuery('languageid'); // 返回URL中的查询部分 | |
| 6 | + var _userId = getQuery('userId'); // 用户ID | |
| 7 | + var _role = getQuery('role'); // 用户角色 0:学生 1:老师 | |
| 8 | + var _autoScore = getQuery('autoScore'); // 是否开启自动打分 也就是左侧是否显示目录的依据 | |
| 9 | + var _questionId = getQuery('question'); // 问题ID | |
| 10 | + var flag = true; | |
| 11 | + | |
| 12 | + if(_autoScore){ | |
| 13 | + if(_autoScore === 'true'){ | |
| 14 | + _autoScore = true; | |
| 15 | + }else{ | |
| 16 | + _autoScore = false; | |
| 17 | + } | |
| 18 | + } | |
| 9 | 19 | |
| 10 | 20 | if(_languageid == 35){ |
| 11 | 21 | $('.switch').show(); |
| ... | ... | @@ -22,6 +32,8 @@ $(function(){ |
| 22 | 32 | el: '#folder', |
| 23 | 33 | isPlayPage: 0, |
| 24 | 34 | languageid: parseInt(_languageid), |
| 35 | + questionId: _questionId, | |
| 36 | + autoScore: _autoScore, | |
| 25 | 37 | role: _role |
| 26 | 38 | }); |
| 27 | 39 | |
| ... | ... | @@ -44,6 +56,8 @@ $(function(){ |
| 44 | 56 | role: _role, |
| 45 | 57 | userId: _userId, |
| 46 | 58 | languageId: _languageid, |
| 59 | + questionId: _questionId, | |
| 60 | + autoScore: _autoScore, | |
| 47 | 61 | startCallback: function(){ |
| 48 | 62 | // 禁止重命名 |
| 49 | 63 | setTimeout(function(){ | ... | ... |
src/js/player.js
| 1 | 1 | $(function(){ |
| 2 | - var _languageid = getQuery('languageid'); | |
| 3 | - var _userId = getQuery('userId'); | |
| 4 | - var _role = getQuery('role'); | |
| 5 | - var _codeReplayId = getQuery('codeReplayId'); | |
| 2 | + var _languageid = getQuery('languageid'); | |
| 3 | + var _userId = getQuery('userId'); | |
| 4 | + var _role = getQuery('role'); | |
| 5 | + var _codeReplayId = getQuery('codeReplayId'); | |
| 6 | + var _autoScore = getQuery('autoScore'); // 是否开启自动打分 也就是左侧是否显示目录的依据 | |
| 6 | 7 | var status = true; |
| 7 | 8 | |
| 8 | 9 | // new一个基本IDE结构 |
| ... | ... | @@ -10,6 +11,7 @@ $(function(){ |
| 10 | 11 | el: '#folder', |
| 11 | 12 | role: _role, |
| 12 | 13 | isPlayPage: 1, |
| 14 | + autoScore: _autoScore, | |
| 13 | 15 | languageid: parseInt(_languageid) |
| 14 | 16 | }); |
| 15 | 17 | ... | ... |
src/scss/ide.scss
| 1 | - | |
| 2 | 1 | @import 'utils'; |
| 3 | 2 | @import 'variables'; |
| 4 | 3 | @import '_zTreeRewrite'; |
| ... | ... | @@ -6,3 +5,39 @@ |
| 6 | 5 | @import '_animation.scss'; |
| 7 | 6 | @import 'main'; |
| 8 | 7 | |
| 8 | + | |
| 9 | +.question-wrap { | |
| 10 | + padding: 0 15px; | |
| 11 | + display: none; | |
| 12 | +} | |
| 13 | + | |
| 14 | +.question_title_wrap { | |
| 15 | + padding-bottom: 47px; | |
| 16 | +} | |
| 17 | + | |
| 18 | +.question_title_wrap:first-child .question_describe { | |
| 19 | + font-size: 16px; | |
| 20 | + font-weight: normal; | |
| 21 | +} | |
| 22 | + | |
| 23 | +.question_title_wrap .question_subtitle { | |
| 24 | + color: #2A2F33; | |
| 25 | + font-size: 14px; | |
| 26 | + font-weight: bold; | |
| 27 | + padding-bottom: 15px; | |
| 28 | +} | |
| 29 | + | |
| 30 | +.question_title_wrap .question_subtitle span { | |
| 31 | + width: 14px; | |
| 32 | + height: 14px; | |
| 33 | + display: inline-block; | |
| 34 | + background: #1FB6FF; | |
| 35 | + border-radius: 50%; | |
| 36 | + margin-right: 8px; | |
| 37 | + vertical-align: middle; | |
| 38 | +} | |
| 39 | + | |
| 40 | +.question_title_wrap .question_describe { | |
| 41 | + font-size: 12px; | |
| 42 | + line-height: 1.4; | |
| 43 | +} | ... | ... |
src/v1.1/index.html
| ... | ... | @@ -60,12 +60,12 @@ |
| 60 | 60 | <ul id="recordertab" class="nav nav-tabs pull-left"> |
| 61 | 61 | <li class="active"> |
| 62 | 62 | <a href="#recordzone" data-toggle="tab"> |
| 63 | - <i class="icon iconfont icon-tingzhi"></i>课程录制区 | |
| 63 | + <i class="icon iconfont icon-tingzhi"></i><span>课程录制区</span> | |
| 64 | 64 | </a> |
| 65 | 65 | </li> |
| 66 | 66 | <li> |
| 67 | 67 | <a href="#replayzone" data-toggle="tab"> |
| 68 | - <i class="icon iconfont icon-bofang2"></i>课程预览区 | |
| 68 | + <i class="icon iconfont icon-bofang2"></i><span>课程预览区</span> | |
| 69 | 69 | </a> |
| 70 | 70 | </li> |
| 71 | 71 | <li> |
| ... | ... | @@ -83,15 +83,35 @@ |
| 83 | 83 | </div> |
| 84 | 84 | </li> |
| 85 | 85 | </div> |
| 86 | - | |
| 87 | 86 | <!-- 录制区 --> |
| 88 | 87 | <div class="record-wrap"> |
| 89 | 88 | <!-- 录制区 --> |
| 90 | 89 | <div class="gxb-record"> |
| 91 | 90 | <div id="ideDir"> |
| 92 | - <div class="tree-header">目录</div> | |
| 93 | - <ul id="folder" class="ztree"></ul> | |
| 94 | - <div id="handleLM"></div> | |
| 91 | + <div class="tree-wrap" style="display: none;"> | |
| 92 | + <div class="tree-header">目录</div> | |
| 93 | + <ul id="folder" class="ztree"></ul> | |
| 94 | + <div id="handleLM"></div> | |
| 95 | + </div> | |
| 96 | + <div class="question-wrap"> | |
| 97 | + <div class="question_title_wrap"> | |
| 98 | + <div class="question_subtitle"><span></span>题目</div> | |
| 99 | + <p class="question_describe" id="question_title">...</p> | |
| 100 | + </div> | |
| 101 | + <h3 class="question_title"></h3> | |
| 102 | + <div class="question_title_wrap"> | |
| 103 | + <div class="question_subtitle"><span></span>题目描述</div> | |
| 104 | + <p class="question_describe" id="title_describe">...</p> | |
| 105 | + </div> | |
| 106 | + <div class="question_title_wrap"> | |
| 107 | + <div class="question_subtitle"><span></span>输入描述</div> | |
| 108 | + <p class="question_describe" id="input_describe">...</p> | |
| 109 | + </div> | |
| 110 | + <div class="question_title_wrap"> | |
| 111 | + <div class="question_subtitle"><span></span>输出描述</div> | |
| 112 | + <p class="question_describe" id="export_describe">...</p> | |
| 113 | + </div> | |
| 114 | + </div> | |
| 95 | 115 | </div> |
| 96 | 116 | |
| 97 | 117 | <div id="ideEditer" class="tab-content"> | ... | ... |
src/v1.1/player.html
| ... | ... | @@ -72,9 +72,30 @@ |
| 72 | 72 | <div class="gxb-record"> |
| 73 | 73 | <div class="m-dir-wrap"> |
| 74 | 74 | <div id="ideDir"> |
| 75 | - <div class="tree-header">目录</div> | |
| 76 | - <ul id="folder" class="ztree"></ul> | |
| 77 | - <div id="handleLM"></div> | |
| 75 | + <div class="tree-wrap" style="display: none;"> | |
| 76 | + <div class="tree-header">目录</div> | |
| 77 | + <ul id="folder" class="ztree"></ul> | |
| 78 | + <div id="handleLM"></div> | |
| 79 | + </div> | |
| 80 | + <div class="question-wrap"> | |
| 81 | + <div class="question_title_wrap"> | |
| 82 | + <div class="question_subtitle"><span></span>题目</div> | |
| 83 | + <p class="question_describe" id="question_title">...</p> | |
| 84 | + </div> | |
| 85 | + <h3 class="question_title"></h3> | |
| 86 | + <div class="question_title_wrap"> | |
| 87 | + <div class="question_subtitle"><span></span>题目描述</div> | |
| 88 | + <p class="question_describe" id="title_describe">...</p> | |
| 89 | + </div> | |
| 90 | + <div class="question_title_wrap"> | |
| 91 | + <div class="question_subtitle"><span></span>输入描述</div> | |
| 92 | + <p class="question_describe" id="input_describe">...</p> | |
| 93 | + </div> | |
| 94 | + <div class="question_title_wrap"> | |
| 95 | + <div class="question_subtitle"><span></span>输出描述</div> | |
| 96 | + <p class="question_describe" id="export_describe">...</p> | |
| 97 | + </div> | |
| 98 | + </div> | |
| 78 | 99 | </div> |
| 79 | 100 | </div> |
| 80 | 101 | <div id="ideEditer" class="tab-content"> | ... | ... |