Commit 4d8f49d32416025b675717bd1c9be702a21554e2

Authored by 商艳涛
1 parent 636ff718

适配录制和播放时显示作业问题描述

dist/css/ide.css
@@ -533,3 +533,33 @@ html, body { @@ -533,3 +533,33 @@ html, body {
533 533
534 #stderr, #cmpinfo, #output { 534 #stderr, #cmpinfo, #output {
535 padding: 12px 36px; } 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,6 +79,17 @@
79 console.log('res*****************************'); 79 console.log('res*****************************');
80 console.log(res); //目录包含文件 80 console.log(res); //目录包含文件
81 console.log(_lang); 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 $("title").html(_lang); 93 $("title").html(_lang);
83 Dir.treeData = res[_lang]; 94 Dir.treeData = res[_lang];
84 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); 95 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData);
@@ -94,6 +105,14 @@ @@ -94,6 +105,14 @@
94 var _codeReplayId = getQuery('codeReplayId'); 105 var _codeReplayId = getQuery('codeReplayId');
95 var _studentReplayId = getQuery('studentReplayId'); 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 if (role == 0) { 116 if (role == 0) {
98 playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; 117 playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api";
99 getCodeData(playUrl, el) 118 getCodeData(playUrl, el)
@@ -597,6 +616,62 @@ @@ -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 // 获取code 676 // 获取code
602 function getCodeData(url, el){ 677 function getCodeData(url, el){
@@ -627,9 +702,18 @@ @@ -627,9 +702,18 @@
627 $('#ifrcontainer').hide() 702 $('#ifrcontainer').hide()
628 } 703 }
629 var coderecords = res.codeRecordList || res.studentRecordList; 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 Dir.treeData = programFileListToTreeJson(treeArr); 717 Dir.treeData = programFileListToTreeJson(treeArr);
634 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); 718 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData);
635 Dir.treeObj.setting.edit.showRenameBtn = false; 719 Dir.treeObj.setting.edit.showRenameBtn = false;
dist/gxb-ide/Iterm.js
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
2 var isCompile = false; 2 var isCompile = false;
3 var _languageid = getQuery('languageid'); 3 var _languageid = getQuery('languageid');
4 var _userId = getQuery('userId'); 4 var _userId = getQuery('userId');
  5 + var autoScore = !!getQuery('autoScore');
  6 + var questionId = getQuery('question');
5 7
6 var Iterm = { 8 var Iterm = {
7 constructor: Iterm, 9 constructor: Iterm,
@@ -161,9 +163,24 @@ @@ -161,9 +163,24 @@
161 "fileList": _fileList || [] 163 "fileList": _fileList || []
162 } 164 }
163 console.log(compileData); 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 $.ajax({ 181 $.ajax({
165 type: "POST", 182 type: "POST",
166 - url: gxb_api + "/gxb-web/programmingMulti/codeRun/api", 183 + url: compileApiUrl,
167 data: JSON.stringify(compileData), 184 data: JSON.stringify(compileData),
168 dataType: "json", 185 dataType: "json",
169 contentType: "application/json", 186 contentType: "application/json",
@@ -173,6 +190,13 @@ @@ -173,6 +190,13 @@
173 $('.compile-loading').hide(); 190 $('.compile-loading').hide();
174 $('.compile-reslut').show(); 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 compileResult(data) 200 compileResult(data)
177 l.remove(); 201 l.remove();
178 CodingEditer.compileResultData = data; 202 CodingEditer.compileResultData = data;
dist/gxb-ide/ToolBox.js
@@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
23 '<input type="button" id="savecode" class="upload-stud" style="display: none;" disabled="disabled" value="保存da">'+ 23 '<input type="button" id="savecode" class="upload-stud" style="display: none;" disabled="disabled" value="保存da">'+
24 '<input type="button" id="cancel" value="关闭">'+ 24 '<input type="button" id="cancel" value="关闭">'+
25 '</div>'+ 25 '</div>'+
  26 + '<div class="score-wrap" style="display: none;">预估得分:<span class="score-text">0</span>,点击保存按钮分数才会生效</div>'+
26 '</div>'; 27 '</div>';
27 28
28 function ToolBox(){ 29 function ToolBox(){
@@ -140,6 +141,7 @@ @@ -140,6 +141,7 @@
140 $('#audio-play').hide() 141 $('#audio-play').hide()
141 $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true); 142 $('#upload').removeClass('recording-finish').addClass('upload-teach').attr("disabled", true);
142 $('#recordertab a:eq(0)').tab('show'); 143 $('#recordertab a:eq(0)').tab('show');
  144 + $('.score-wrap').hide();
143 145
144 CodingEditer.resetCodeMirrorValue(0); 146 CodingEditer.resetCodeMirrorValue(0);
145 147
@@ -212,11 +214,10 @@ @@ -212,11 +214,10 @@
212 var saveformat = $('#saveformat').find('.active').data('saveformat') || 5; 214 var saveformat = $('#saveformat').find('.active').data('saveformat') || 5;
213 var programmingFileList = Dir.getTreeData(); 215 var programmingFileList = Dir.getTreeData();
214 var keepTimer = Math.round($('#audio')[0].duration); 216 var keepTimer = Math.round($('#audio')[0].duration);
215 -  
216 -  
217 var postData = { 217 var postData = {
218 "mainPath": Dir.mainPath, 218 "mainPath": Dir.mainPath,
219 "mainArgus": "lixxx", 219 "mainArgus": "lixxx",
  220 + "programmingFileList": programmingFileList,
220 "runtimeArgus": $('#runtimeArgus').val(), 221 "runtimeArgus": $('#runtimeArgus').val(),
221 "pickup": pickup, 222 "pickup": pickup,
222 "userId": _this.options.userId, 223 "userId": _this.options.userId,
@@ -229,11 +230,12 @@ @@ -229,11 +230,12 @@
229 "saveformat": saveformat, 230 "saveformat": saveformat,
230 "audioUrl": $('.audio-url').val(), 231 "audioUrl": $('.audio-url').val(),
231 "programmingSource": 1, 232 "programmingSource": 1,
232 - "programmingFileList": programmingFileList,  
233 "totaltime": keepTimer 233 "totaltime": keepTimer
234 } 234 }
235 var temp_record = JSON.parse(JSON.stringify(CodingEditer.records)) 235 var temp_record = JSON.parse(JSON.stringify(CodingEditer.records))
236 var codeRecordLists = []; 236 var codeRecordLists = [];
  237 + var _role = _this.options.role;
  238 + var roleUrl;
237 239
238 for (var i = 0; i < temp_record.length; i++) { 240 for (var i = 0; i < temp_record.length; i++) {
239 var temp_record_item = temp_record[i]; 241 var temp_record_item = temp_record[i];
@@ -245,17 +247,20 @@ @@ -245,17 +247,20 @@
245 } 247 }
246 codeRecordLists.push(temp_record_item); 248 codeRecordLists.push(temp_record_item);
247 } 249 }
248 - var _role = _this.options.role;  
249 - console.log(_role);  
250 - console.log(gxb_api);  
251 if (_role == 0) { 250 if (_role == 0) {
252 postData.codeRecordList = codeRecordLists; 251 postData.codeRecordList = codeRecordLists;
253 - var roleUrl = gxb_api + "/programming/codeReplay/api" 252 + roleUrl = gxb_api + "/programming/codeReplay/api"
254 }else if (_role == 1) { 253 }else if (_role == 1) {
255 postData.studentRecordList = codeRecordLists; 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 console.log(roleUrl); 262 console.log(roleUrl);
  263 + // return false;
259 $.ajax({ 264 $.ajax({
260 type: "post", 265 type: "post",
261 url: roleUrl, 266 url: roleUrl,
dist/gxb-ide/toolBox.css
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 margin: 2px 8px; 40 margin: 2px 8px;
41 border-radius: 50%; 41 border-radius: 50%;
42 } 42 }
43 -.save-wrap{ 43 +.save-wrap, .score-wrap {
44 float: right; 44 float: right;
45 height: 60px; 45 height: 60px;
46 line-height: 60px; 46 line-height: 60px;
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
57 margin-left: 12px; 57 margin-left: 12px;
58 } 58 }
59 .save-wrap .upload-stud, .save-wrap .upload-teach { 59 .save-wrap .upload-stud, .save-wrap .upload-teach {
60 - // border: 1px solid #999; 60 + /*border: 1px solid #999;*/
61 } 61 }
62 .save-wrap #cancel { 62 .save-wrap #cancel {
63 background-color: transparent; 63 background-color: transparent;
@@ -65,6 +65,11 @@ @@ -65,6 +65,11 @@
65 color: #1FB6FF; 65 color: #1FB6FF;
66 } 66 }
67 67
  68 +.score-wrap {
  69 + padding: 0 20px;
  70 + color: #fff;
  71 +}
  72 +
68 .upload-teach, .upload-stud{ 73 .upload-teach, .upload-stud{
69 // background: -webkit-linear-gradient(left, #505151, #939494); 74 // background: -webkit-linear-gradient(left, #505151, #939494);
70 // background: -moz-linear-gradient(left, #505151, #939494); 75 // background: -moz-linear-gradient(left, #505151, #939494);
dist/js/c.js
@@ -2,10 +2,20 @@ @@ -2,10 +2,20 @@
2 2
3 3
4 $(function(){ 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 if(_languageid == 35){ 20 if(_languageid == 35){
11 $('.switch').show(); 21 $('.switch').show();
@@ -22,6 +32,8 @@ $(function(){ @@ -22,6 +32,8 @@ $(function(){
22 el: '#folder', 32 el: '#folder',
23 isPlayPage: 0, 33 isPlayPage: 0,
24 languageid: parseInt(_languageid), 34 languageid: parseInt(_languageid),
  35 + questionId: _questionId,
  36 + autoScore: _autoScore,
25 role: _role 37 role: _role
26 }); 38 });
27 39
@@ -44,6 +56,8 @@ $(function(){ @@ -44,6 +56,8 @@ $(function(){
44 role: _role, 56 role: _role,
45 userId: _userId, 57 userId: _userId,
46 languageId: _languageid, 58 languageId: _languageid,
  59 + questionId: _questionId,
  60 + autoScore: _autoScore,
47 startCallback: function(){ 61 startCallback: function(){
48 // 禁止重命名 62 // 禁止重命名
49 setTimeout(function(){ 63 setTimeout(function(){
dist/js/player.js
1 $(function(){ 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 var status = true; 7 var status = true;
7 8
8 // new一个基本IDE结构 9 // new一个基本IDE结构
@@ -10,6 +11,7 @@ $(function(){ @@ -10,6 +11,7 @@ $(function(){
10 el: '#folder', 11 el: '#folder',
11 role: _role, 12 role: _role,
12 isPlayPage: 1, 13 isPlayPage: 1,
  14 + autoScore: _autoScore,
13 languageid: parseInt(_languageid) 15 languageid: parseInt(_languageid)
14 }); 16 });
15 17
dist/scss/ide.scss
1 -  
2 @import 'utils'; 1 @import 'utils';
3 @import 'variables'; 2 @import 'variables';
4 @import '_zTreeRewrite'; 3 @import '_zTreeRewrite';
@@ -6,3 +5,39 @@ @@ -6,3 +5,39 @@
6 @import '_animation.scss'; 5 @import '_animation.scss';
7 @import 'main'; 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,12 +60,12 @@
60 <ul id="recordertab" class="nav nav-tabs pull-left"> 60 <ul id="recordertab" class="nav nav-tabs pull-left">
61 <li class="active"> 61 <li class="active">
62 <a href="#recordzone" data-toggle="tab"> 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 </a> 64 </a>
65 </li> 65 </li>
66 <li> 66 <li>
67 <a href="#replayzone" data-toggle="tab"> 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 </a> 69 </a>
70 </li> 70 </li>
71 <li> 71 <li>
@@ -83,15 +83,35 @@ @@ -83,15 +83,35 @@
83 </div> 83 </div>
84 </li> 84 </li>
85 </div> 85 </div>
86 -  
87 <!-- 录制区 --> 86 <!-- 录制区 -->
88 <div class="record-wrap"> 87 <div class="record-wrap">
89 <!-- 录制区 --> 88 <!-- 录制区 -->
90 <div class="gxb-record"> 89 <div class="gxb-record">
91 <div id="ideDir"> 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 </div> 115 </div>
96 116
97 <div id="ideEditer" class="tab-content"> 117 <div id="ideEditer" class="tab-content">
dist/v1.1/player.html
@@ -72,9 +72,30 @@ @@ -72,9 +72,30 @@
72 <div class="gxb-record"> 72 <div class="gxb-record">
73 <div class="m-dir-wrap"> 73 <div class="m-dir-wrap">
74 <div id="ideDir"> 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 </div> 99 </div>
79 </div> 100 </div>
80 <div id="ideEditer" class="tab-content"> 101 <div id="ideEditer" class="tab-content">
src/css/ide.css
@@ -503,7 +503,7 @@ html, body { @@ -503,7 +503,7 @@ html, body {
503 .before, .after { 503 .before, .after {
504 position: absolute; 504 position: absolute;
505 left: 208px; 505 left: 208px;
506 - width: 200px; 506 + width: 50%;
507 height: 36px; 507 height: 36px;
508 top: 12px; } 508 top: 12px; }
509 509
@@ -533,3 +533,33 @@ html, body { @@ -533,3 +533,33 @@ html, body {
533 533
534 #stderr, #cmpinfo, #output { 534 #stderr, #cmpinfo, #output {
535 padding: 12px 36px; } 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,6 +79,17 @@
79 console.log('res*****************************'); 79 console.log('res*****************************');
80 console.log(res); //目录包含文件 80 console.log(res); //目录包含文件
81 console.log(_lang); 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 $("title").html(_lang); 93 $("title").html(_lang);
83 Dir.treeData = res[_lang]; 94 Dir.treeData = res[_lang];
84 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); 95 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData);
@@ -94,6 +105,14 @@ @@ -94,6 +105,14 @@
94 var _codeReplayId = getQuery('codeReplayId'); 105 var _codeReplayId = getQuery('codeReplayId');
95 var _studentReplayId = getQuery('studentReplayId'); 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 if (role == 0) { 116 if (role == 0) {
98 playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api"; 117 playUrl = gxb_api + "/programming/codeReplay/" + _codeReplayId + "/api";
99 getCodeData(playUrl, el) 118 getCodeData(playUrl, el)
@@ -597,6 +616,62 @@ @@ -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 // 获取code 676 // 获取code
602 function getCodeData(url, el){ 677 function getCodeData(url, el){
@@ -627,9 +702,18 @@ @@ -627,9 +702,18 @@
627 $('#ifrcontainer').hide() 702 $('#ifrcontainer').hide()
628 } 703 }
629 var coderecords = res.codeRecordList || res.studentRecordList; 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 Dir.treeData = programFileListToTreeJson(treeArr); 717 Dir.treeData = programFileListToTreeJson(treeArr);
634 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData); 718 Dir.treeObj = $.fn.zTree.init($(el), setting, Dir.treeData);
635 Dir.treeObj.setting.edit.showRenameBtn = false; 719 Dir.treeObj.setting.edit.showRenameBtn = false;
src/gxb-ide/Iterm.js
@@ -191,7 +191,10 @@ @@ -191,7 +191,10 @@
191 $('.compile-reslut').show(); 191 $('.compile-reslut').show();
192 192
193 if(autoScore && questionId) { 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 compileResult(data) 200 compileResult(data)
src/gxb-ide/ToolBox.js
@@ -214,11 +214,10 @@ @@ -214,11 +214,10 @@
214 var saveformat = $('#saveformat').find('.active').data('saveformat') || 5; 214 var saveformat = $('#saveformat').find('.active').data('saveformat') || 5;
215 var programmingFileList = Dir.getTreeData(); 215 var programmingFileList = Dir.getTreeData();
216 var keepTimer = Math.round($('#audio')[0].duration); 216 var keepTimer = Math.round($('#audio')[0].duration);
217 -  
218 -  
219 var postData = { 217 var postData = {
220 "mainPath": Dir.mainPath, 218 "mainPath": Dir.mainPath,
221 "mainArgus": "lixxx", 219 "mainArgus": "lixxx",
  220 + "programmingFileList": programmingFileList,
222 "runtimeArgus": $('#runtimeArgus').val(), 221 "runtimeArgus": $('#runtimeArgus').val(),
223 "pickup": pickup, 222 "pickup": pickup,
224 "userId": _this.options.userId, 223 "userId": _this.options.userId,
@@ -231,11 +230,12 @@ @@ -231,11 +230,12 @@
231 "saveformat": saveformat, 230 "saveformat": saveformat,
232 "audioUrl": $('.audio-url').val(), 231 "audioUrl": $('.audio-url').val(),
233 "programmingSource": 1, 232 "programmingSource": 1,
234 - "programmingFileList": programmingFileList,  
235 "totaltime": keepTimer 233 "totaltime": keepTimer
236 } 234 }
237 var temp_record = JSON.parse(JSON.stringify(CodingEditer.records)) 235 var temp_record = JSON.parse(JSON.stringify(CodingEditer.records))
238 var codeRecordLists = []; 236 var codeRecordLists = [];
  237 + var _role = _this.options.role;
  238 + var roleUrl;
239 239
240 for (var i = 0; i < temp_record.length; i++) { 240 for (var i = 0; i < temp_record.length; i++) {
241 var temp_record_item = temp_record[i]; 241 var temp_record_item = temp_record[i];
@@ -247,17 +247,20 @@ @@ -247,17 +247,20 @@
247 } 247 }
248 codeRecordLists.push(temp_record_item); 248 codeRecordLists.push(temp_record_item);
249 } 249 }
250 - var _role = _this.options.role;  
251 - console.log(_role);  
252 - console.log(gxb_api);  
253 if (_role == 0) { 250 if (_role == 0) {
254 postData.codeRecordList = codeRecordLists; 251 postData.codeRecordList = codeRecordLists;
255 - var roleUrl = gxb_api + "/programming/codeReplay/api" 252 + roleUrl = gxb_api + "/programming/codeReplay/api"
256 }else if (_role == 1) { 253 }else if (_role == 1) {
257 postData.studentRecordList = codeRecordLists; 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 console.log(roleUrl); 262 console.log(roleUrl);
  263 + // return false;
261 $.ajax({ 264 $.ajax({
262 type: "post", 265 type: "post",
263 url: roleUrl, 266 url: roleUrl,
src/js/c.js
@@ -2,10 +2,20 @@ @@ -2,10 +2,20 @@
2 2
3 3
4 $(function(){ 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 if(_languageid == 35){ 20 if(_languageid == 35){
11 $('.switch').show(); 21 $('.switch').show();
@@ -22,6 +32,8 @@ $(function(){ @@ -22,6 +32,8 @@ $(function(){
22 el: '#folder', 32 el: '#folder',
23 isPlayPage: 0, 33 isPlayPage: 0,
24 languageid: parseInt(_languageid), 34 languageid: parseInt(_languageid),
  35 + questionId: _questionId,
  36 + autoScore: _autoScore,
25 role: _role 37 role: _role
26 }); 38 });
27 39
@@ -44,6 +56,8 @@ $(function(){ @@ -44,6 +56,8 @@ $(function(){
44 role: _role, 56 role: _role,
45 userId: _userId, 57 userId: _userId,
46 languageId: _languageid, 58 languageId: _languageid,
  59 + questionId: _questionId,
  60 + autoScore: _autoScore,
47 startCallback: function(){ 61 startCallback: function(){
48 // 禁止重命名 62 // 禁止重命名
49 setTimeout(function(){ 63 setTimeout(function(){
src/js/player.js
1 $(function(){ 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 var status = true; 7 var status = true;
7 8
8 // new一个基本IDE结构 9 // new一个基本IDE结构
@@ -10,6 +11,7 @@ $(function(){ @@ -10,6 +11,7 @@ $(function(){
10 el: '#folder', 11 el: '#folder',
11 role: _role, 12 role: _role,
12 isPlayPage: 1, 13 isPlayPage: 1,
  14 + autoScore: _autoScore,
13 languageid: parseInt(_languageid) 15 languageid: parseInt(_languageid)
14 }); 16 });
15 17
src/scss/ide.scss
1 -  
2 @import 'utils'; 1 @import 'utils';
3 @import 'variables'; 2 @import 'variables';
4 @import '_zTreeRewrite'; 3 @import '_zTreeRewrite';
@@ -6,3 +5,39 @@ @@ -6,3 +5,39 @@
6 @import '_animation.scss'; 5 @import '_animation.scss';
7 @import 'main'; 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,12 +60,12 @@
60 <ul id="recordertab" class="nav nav-tabs pull-left"> 60 <ul id="recordertab" class="nav nav-tabs pull-left">
61 <li class="active"> 61 <li class="active">
62 <a href="#recordzone" data-toggle="tab"> 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 </a> 64 </a>
65 </li> 65 </li>
66 <li> 66 <li>
67 <a href="#replayzone" data-toggle="tab"> 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 </a> 69 </a>
70 </li> 70 </li>
71 <li> 71 <li>
@@ -83,15 +83,35 @@ @@ -83,15 +83,35 @@
83 </div> 83 </div>
84 </li> 84 </li>
85 </div> 85 </div>
86 -  
87 <!-- 录制区 --> 86 <!-- 录制区 -->
88 <div class="record-wrap"> 87 <div class="record-wrap">
89 <!-- 录制区 --> 88 <!-- 录制区 -->
90 <div class="gxb-record"> 89 <div class="gxb-record">
91 <div id="ideDir"> 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 </div> 115 </div>
96 116
97 <div id="ideEditer" class="tab-content"> 117 <div id="ideEditer" class="tab-content">
src/v1.1/player.html
@@ -72,9 +72,30 @@ @@ -72,9 +72,30 @@
72 <div class="gxb-record"> 72 <div class="gxb-record">
73 <div class="m-dir-wrap"> 73 <div class="m-dir-wrap">
74 <div id="ideDir"> 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 </div> 99 </div>
79 </div> 100 </div>
80 <div id="ideEditer" class="tab-content"> 101 <div id="ideEditer" class="tab-content">