Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerView.js =================================================================== diff -u -r38385 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerView.js (.../examAnswerView.js) (revision 38385) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerView.js (.../examAnswerView.js) (revision 38869) @@ -1,37 +1,77 @@ var entityName = "答卷信息"; +function gotoPage(v, p, record) { + if (record.data.endTime) { + return "" + v + ""; + } else { + return v + } +} + +function examPaperStatusRenderer(v, p, record) { + var examPaperStatus = record.data['examPaperStatus']; + var color = ""; + var fontColor = ""; + if (examPaperStatus == '待评分') { + color = '#ffff00';//黄色 + fontColor = '#000'; + } else if (examPaperStatus == '已评分') { + color = '#00b050';//绿色 + fontColor = '#fff'; + } else if (examPaperStatus == '未交卷') { + color = 'red';//红色 + fontColor = '#fff'; + } + return "

" + v + "

"; +} + +function scoreGainedRenderer(v, p, record) { + var examPaperStatus = record.data['examPaperStatus']; + if (examPaperStatus == '待评分') { + return 0; + } else { + return v; + } +} + Ext.onReady(function () { Ext.QuickTips.init(); - function gotoPage(v, p, record) { - if (record.data.endTime) { - return "" + v + ""; - } else { - return v - } - } + var examPaperStatusStore = new Ext.data.SimpleStore({ + fields: ['key', 'val'], + data: [ + ['', '全部'], + ['未交卷', '未交卷'], + ['待评分', '待评分'], + ['已评分', '已评分'] + ] + }); var columns = [ { header: "考试名称", width: 300, dataIndex: 'name', renderer: gotoPage }, + { header: "试卷状态", width: 100, dataIndex: 'examPaperStatus', renderer: examPaperStatusRenderer }, { header: "员工号", width: 100, dataIndex: 'examineeLoginName' }, { header: "考生", width: 100, dataIndex: 'examinee' }, { header: "开考时间", width: 150, dataIndex: 'startTime', renderer: myDateFormatBySecond }, { header: "交卷时间", width: 150, dataIndex: 'endTime', renderer: myDateFormatBySecond }, { header: "正确数量", width: 100, dataIndex: 'correct' }, { header: "错误数量", width: 100, dataIndex: 'incorrect' }, - { header: "得分", width: 100, dataIndex: 'scoreGained' }, + { header: "简答题得分", width: 100, dataIndex: 'shortAnswerScore' }, + { header: "最终得分", width: 100, dataIndex: 'scoreGained', renderer: scoreGainedRenderer }, { id: 'operationRemark', header: "总分", width: 100, dataIndex: 'totalSocre' } ]; var readerDetail = [ { name: 'id' }, { name: 'name' }, + { name: 'examPaperStatus' }, { name: 'examineeLoginName' }, { name: 'examinee' }, { name: 'startTime' }, { name: 'endTime' }, { name: 'correct' }, { name: 'incorrect' }, + { name: 'shortAnswerScore' }, { name: 'scoreGained' }, { name: 'totalSocre' } ]; @@ -77,6 +117,26 @@ } }) } + }, '-', { + text: '试卷状态' + }, { + xtype: 'combo', + store: examPaperStatusStore, + width: 80, + mode: 'local', + triggerAction: 'all', + displayField: 'val', + valueField: 'key', + forceSelection: true, + editable: false, + value: '', + listeners: { + select: function (combo, record, index) { + var val = record.data.key; + document.getElementById('parm_s_examPaperStatus').value = val; + grid.dwrReload(); + } + } }]; grid = new Ext.ux.ForgonPageGrid({ Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionView.js =================================================================== diff -u -r38691 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionView.js (.../questionView.js) (revision 38691) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionView.js (.../questionView.js) (revision 38869) @@ -30,8 +30,8 @@ { header: "发布人", width: 100, dataIndex: 'publisher' }, { header: "发布时间", width: 100, dataIndex: 'publishTime', renderer: myDateFormat }, { header: "题型", width: 70, dataIndex: 'questionType' }, - { header: "生效日期", width: 100, dataIndex: 'effDt', hidden:true, renderer: myDateFormat }, - { header: "失效日期", width: 100, dataIndex: 'expDt', hidden:true, renderer: myDateFormat } + { header: "生效日期", width: 100, dataIndex: 'effDt', hidden: true, renderer: myDateFormat }, + { header: "失效日期", width: 100, dataIndex: 'expDt', hidden: true, renderer: myDateFormat } ]; Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerView.jsp =================================================================== diff -u -r38380 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerView.jsp (.../examAnswerView.jsp) (revision 38380) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerView.jsp (.../examAnswerView.jsp) (revision 38869) @@ -18,6 +18,10 @@ Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsDefinition/examsDefinitionView.js =================================================================== diff -u -r38547 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsDefinition/examsDefinitionView.js (.../examsDefinitionView.js) (revision 38547) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsDefinition/examsDefinitionView.js (.../examsDefinitionView.js) (revision 38869) @@ -24,13 +24,15 @@ for (var i = 0; i < examQuestions.length; i++) { var questionId = examQuestions[i].question.id; var examQuestionId = examQuestions[i].id; - var answer = top.Ext4.getCmp('answer' + i).getValue(); var questionType = examQuestions[i].question.questionType; - answer = answer['answerValue' + i]; var value = ''; if (questionType == '单选') { + var answer = top.Ext4.getCmp('answer' + i).getValue(); + answer = answer['answerValue' + i]; params['answer' + (i + 1)] = answer || ''; - } else { + } else if (questionType == '多选') { + var answer = top.Ext4.getCmp('answer' + i).getValue(); + answer = answer['answerValue' + i]; if (typeof answer == 'object') { for (var k = 0; k < answer.length; k++) { params['answer' + answer[k] + (i + 1)] = answer[k]; @@ -41,6 +43,18 @@ params['answer' + value + (i + 1)] = value; } } + } else if (questionType == '判断题') { + var answer = top.Ext4.getCmp('answer' + i).getValue(); + answer = answer['answerValue' + i]; + params['answer' + (i + 1)] = answer || ''; + } else if (questionType == '填空题') { + var hiddenTitleLength = top.Ext4.getCmp('hiddenTitleLength' + i).getValue(); + for (var j = 1; j < hiddenTitleLength; j++) { + params['answer' + (i + 1) + '_' + (j - 1)] = top.Ext4.getCmp('answer' + i + '_' + j).getValue(); + } + } else { + var answer = top.Ext4.getCmp('answer' + i).getValue(); + params['answer' + (i + 1)] = answer || ''; } params['questionId' + (i + 1)] = questionId; params['examQuestionId' + (i + 1)] = examQuestionId; Index: ssts-web/src/main/resources/systemset/operationDefine.xml =================================================================== diff -u -r38849 -r38869 --- ssts-web/src/main/resources/systemset/operationDefine.xml (.../operationDefine.xml) (revision 38849) +++ ssts-web/src/main/resources/systemset/operationDefine.xml (.../operationDefine.xml) (revision 38869) @@ -651,6 +651,7 @@ + Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionForm.js =================================================================== diff -u -r38776 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionForm.js (.../questionForm.js) (revision 38776) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionForm.js (.../questionForm.js) (revision 38869) @@ -14,33 +14,15 @@ var difficultyValue = top.Ext4.getCmp('difficultyValue').getRawValue(); var difficultyId = top.Ext4.getCmp('difficultyId').getValue(); var title = top.Ext4.getCmp('title').getValue(); - var optionA = top.Ext4.getCmp('optionA').getValue(); - var optionB = top.Ext4.getCmp('optionB').getValue(); - var optionC = top.Ext4.getCmp('optionC').getValue(); - var optionD = top.Ext4.getCmp('optionD').getValue(); - var optionE = top.Ext4.getCmp('optionE').getValue(); var questionTypeObj = top.Ext4.getCmp('questionType').getValue(); var questionType = questionTypeObj.questionTypeValue; - var isAssuredAnswer = '有'; var answer = ''; - if (questionType == '单选') { - var questionRadio = top.Ext4.getCmp('questionRadio').getValue(); - answer = questionRadio.answerValue; - } else { - var questionCheckbox = top.Ext4.getCmp('questionCheckbox').getValue(); - if (questionCheckbox.answerValue) { - if (typeof questionCheckbox.answerValue == 'object') { - answer = questionCheckbox.answerValue.join(';') - } else { - answer = questionCheckbox.answerValue; - } - } - } var mask = new top.Ext4.LoadMask({ msg: '正在保存,请稍候...', target: formPanel }); + var params = { id: id, publisher: publisher, @@ -52,19 +34,76 @@ difficultyValue: difficultyValue, difficultyId: difficultyId, title: title, - optionA: optionA, - optionB: optionB, - optionC: optionC, - optionD: optionD, - optionE: (optionE.replace(/\s/g, "") == '') ? '' : optionE, questionType: questionType, - isAssuredAnswer: isAssuredAnswer, - answer: answer + isAssuredAnswer: '有' } - mask.show(); + + if (questionType == '单选' || questionType == '多选') { + var optionA = top.Ext4.getCmp('optionA').getValue(); + var optionB = top.Ext4.getCmp('optionB').getValue(); + var optionC = top.Ext4.getCmp('optionC').getValue(); + var optionD = top.Ext4.getCmp('optionD').getValue(); + var optionE = top.Ext4.getCmp('optionE').getValue(); + if (questionType == '单选') { + var questionRadio = top.Ext4.getCmp('questionRadio').getValue(); + answer = questionRadio.answerValue; + } else { + var questionCheck = top.Ext4.getCmp('questionCheck').getValue(); + if (questionCheck.answerValue) { + if (typeof questionCheck.answerValue == 'object') { + answer = questionCheck.answerValue.join(';') + } else { + answer = questionCheck.answerValue; + } + } + } + params.optionA = optionA; + params.optionB = optionB; + params.optionC = optionC; + params.optionD = optionD; + params.optionE = (optionE.replace(/\s/g, "") == '') ? '' : optionE; + params.answer = answer; + } else if (questionType == '判断题') { + var optionTrue = top.Ext4.getCmp('optionTrue').getValue(); + var optionFalse = top.Ext4.getCmp('optionFalse').getValue(); + var answerTrue = top.Ext4.getCmp('answerTrue').getValue(); + params.optionTrue = optionTrue; + params.optionFalse = optionFalse; + if (answerTrue == true || answerTrue == 'true') { + params.answer = optionTrue; + } else { + params.answer = optionFalse; + } + } else if (questionType == '填空题') { + var hiddenOptionFillBlankIndex = top.Ext4.getCmp('hiddenOptionFillBlankIndex').getValue(); + var fillBlankAnswers = []; + if (hiddenOptionFillBlankIndex == 0) { + showResult('填空题至少要有1个答案'); + return + } + for (var i = 0; i < hiddenOptionFillBlankIndex; i++) { + var answer = top.Ext4.getCmp('answer_' + i).getValue(); + fillBlankAnswers.push({ + sequece: i, + answer: answer + }) + } + params.fillBlankAnswers = fillBlankAnswers; + } else if (questionType == '简答题') { + var answerArea = top.Ext4.getCmp('answerArea').getValue(); + if (answerArea.length > 3000) { + showResult('简答题最多只能输入3000个字符'); + return + } + params.answer = answerArea; + } + //mask.show(); Ext4.Ajax.request({ url: WWWROOT + '/disinfectSystem/baseData/questionFormController/saveQuestion.mhtml', - params: params, + headers: { + 'Content-Type': 'application/json' + }, + jsonData: params, success: function (response, options) { var result = Ext4.decode(response.responseText); if (result.success) { @@ -257,35 +296,12 @@ } }] }, { - columnWidth: 0.48, + columnWidth: .96, layout: 'form', border: 0, style: 'margin-bottom:10px', - hidden: true, items: [{ xtype: 'radiogroup', - fieldLabel: '有无标准答案', - height: 30, - id: 'isAssuredAnswer', - items: [{ - boxLabel: '有', - name: 'isAssuredAnswerValue', - inputValue: '有', - checked: true - }, { - boxLabel: '没有', - name: 'isAssuredAnswerValue', - inputValue: '没有' - }], - allowBlank: true - }] - }, { - columnWidth: 0.48, - layout: 'form', - border: 0, - style: 'margin-bottom:10px', - items: [{ - xtype: 'radiogroup', fieldLabel: '题型', height: 30, id: 'questionType', @@ -298,24 +314,70 @@ boxLabel: '多选', name: 'questionTypeValue', inputValue: '多选' + }, { + boxLabel: '判断题', + name: 'questionTypeValue', + inputValue: '判断题' + }, { + boxLabel: '填空题', + name: 'questionTypeValue', + inputValue: '填空题' + }, { + boxLabel: '简答题', + name: 'questionTypeValue', + inputValue: '简答题' }], allowBlank: true, listeners: { change: function (thiz, item) { if (item) { if (item.questionTypeValue == '单选') { - top.Ext4.getCmp('questionRadio').show(); - top.Ext4.getCmp('questionCheckbox').hide(); - } else { - top.Ext4.getCmp('questionRadio').hide(); - top.Ext4.getCmp('questionCheckbox').show(); + top.Ext4.getCmp('questionRadioBox').show(); + top.Ext4.getCmp('questionCheckBox').hide(); + top.Ext4.getCmp('optionRadioOrCheckBox').show(); + top.Ext4.getCmp('optionYesOrNotBox').hide(); + top.Ext4.getCmp('fillBlankButton').hide(); + top.Ext4.getCmp('optionFillBlankBox').hide(); + top.Ext4.getCmp('answerAreaBox').hide(); + } else if (item.questionTypeValue == '多选') { + top.Ext4.getCmp('questionRadioBox').hide(); + top.Ext4.getCmp('questionCheckBox').show(); + top.Ext4.getCmp('optionRadioOrCheckBox').show(); + top.Ext4.getCmp('optionYesOrNotBox').hide(); + top.Ext4.getCmp('fillBlankButton').hide(); + top.Ext4.getCmp('optionFillBlankBox').hide(); + top.Ext4.getCmp('answerAreaBox').hide(); + } else if (item.questionTypeValue == '判断题') { + top.Ext4.getCmp('questionRadioBox').hide(); + top.Ext4.getCmp('questionCheckBox').hide(); + top.Ext4.getCmp('optionRadioOrCheckBox').hide(); + top.Ext4.getCmp('optionYesOrNotBox').show(); + top.Ext4.getCmp('fillBlankButton').hide(); + top.Ext4.getCmp('optionFillBlankBox').hide(); + top.Ext4.getCmp('answerAreaBox').hide(); + } else if (item.questionTypeValue == '填空题') { + top.Ext4.getCmp('questionRadioBox').hide(); + top.Ext4.getCmp('questionCheckBox').hide(); + top.Ext4.getCmp('optionRadioOrCheckBox').hide(); + top.Ext4.getCmp('optionYesOrNotBox').hide(); + top.Ext4.getCmp('fillBlankButton').show(); + top.Ext4.getCmp('optionFillBlankBox').show(); + top.Ext4.getCmp('answerAreaBox').hide(); + } else if (item.questionTypeValue == '简答题') { + top.Ext4.getCmp('questionRadioBox').hide(); + top.Ext4.getCmp('questionCheckBox').hide(); + top.Ext4.getCmp('optionRadioOrCheckBox').hide(); + top.Ext4.getCmp('optionYesOrNotBox').hide(); + top.Ext4.getCmp('fillBlankButton').hide(); + top.Ext4.getCmp('optionFillBlankBox').hide(); + top.Ext4.getCmp('answerAreaBox').show(); } } } } }] }, { - columnWidth: 0.96, + columnWidth: .96, layout: 'form', border: 0, style: 'margin-bottom:10px', @@ -329,153 +391,361 @@ anchor: '99%' }] }, { - columnWidth: 0.96, + columnWidth: .96, layout: 'form', border: 0, style: 'margin-bottom:10px', + id: 'fillBlankButton', + hidden: true, items: [{ - xtype: 'textfield', - fieldLabel: '选项A', - id: 'optionA', - name: 'optionA', - allowBlank: true, - anchor: '99%' - }] - }, { - columnWidth: 0.96, - layout: 'form', - border: 0, - style: 'margin-bottom:10px', - items: [{ - xtype: 'textfield', - fieldLabel: '选项B', - id: 'optionB', - name: 'optionB', - allowBlank: true, - anchor: '99%' - }] - }, { - columnWidth: 0.96, - layout: 'form', - border: 0, - style: 'margin-bottom:10px', - items: [{ - xtype: 'textfield', - fieldLabel: '选项C', - id: 'optionC', - name: 'optionC', - allowBlank: true, - anchor: '99%' - }] - }, { - columnWidth: 0.96, - layout: 'form', - border: 0, - style: 'margin-bottom:10px', - items: [{ - xtype: 'textfield', - fieldLabel: '选项D', - id: 'optionD', - name: 'optionD', - allowBlank: true, - anchor: '99%' - }] - }, { - columnWidth: 0.96, - layout: 'form', - border: 0, - style: 'margin-bottom:10px', - items: [{ - xtype: 'textfield', - fieldLabel: '选项E', - id: 'optionE', - name: 'optionE', - allowBlank: true, - anchor: '99%', - listeners: { - change: function (r) { - var questionRadioItems = top.Ext4.getCmp('questionRadio').items.items[4]; - var questionCheckboxItems = top.Ext4.getCmp('questionCheckbox').items.items[4]; - if (r.value.replace(/\s/g, "") == '') { - questionRadioItems.setDisabled(true); - questionCheckboxItems.setDisabled(true); - var questionRadio = top.Ext4.getCmp('questionRadio').getValue(); - if (questionRadio.answerValue == 'E') { - top.Ext4.getCmp('questionRadio').setValue({ answerValue: 'A' }); + columnWidth: 1, + layout: 'column', + border: 0, + items: [{ + columnWidth: 0.7, + layout: 'form', + border: 0, + items: [{ + id: 'showPwdMessage', + xtype: 'displayfield', + labelSeparator: '', + fieldLabel: ' ', + style: 'color:red', + value: '请点击"保存题目"以便生成对于的答案填空项' + }] + }, { + columnWidth: 0.15, + layout: 'form', + border: 0, + items: [{ + xtype: 'button', + text: '插入空白符', + style: 'float:left', + listeners: { + click: function () { + var title = top.Ext4.getCmp('title').getValue(); + title += '___'; + top.Ext4.getCmp('title').setValue(title); } - top.Ext4.getCmp('questionCheckbox').setValue({ answerValue: 'A' }); - } else { - questionRadioItems.setDisabled(false); - questionCheckboxItems.setDisabled(false); } - } - } + }] + }, { + columnWidth: 0.15, + layout: 'form', + border: 0, + items: [{ + xtype: 'button', + text: '保存题目', + style: 'float:left', + listeners: { + click: function () { + var title = top.Ext4.getCmp('title').getValue(); + if (title !== '') { + var index = title.split('___').length; + if (index > 1) { + var hiddenOptionFillBlankIndex = top.Ext4.getCmp('hiddenOptionFillBlankIndex').getValue(); + for (var j = 0; j < hiddenOptionFillBlankIndex; j++) { + top.Ext4.getCmp('optionFillBlankBox').remove('optionFillBlank' + j); + } + top.Ext4.getCmp('hiddenOptionFillBlankIndex').setValue(index - 1); + for (var i = 0; i < index - 1; i++) { + top.Ext4.getCmp('optionFillBlankBox').add({ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + id: 'optionFillBlank' + i, + items: [{ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '填空' + (i + 1) + '答案', + id: 'answer_' + i, + name: 'answer_' + i, + allowBlank: true, + anchor: '99%' + }] + }] + }) + } + top.Ext4.getCmp('optionFillBlankBox').doLayout(); + } + } + } + } + }] + }] }] }, { - columnWidth: 0.5, - layout: 'form', + columnWidth: .96, + layout: 'column', border: 0, - style: 'margin-bottom:10px', items: [{ - xtype: 'radiogroup', - fieldLabel: '答案', - height: 30, - id: 'questionRadio', + columnWidth: 1, + layout: 'column', + border: 0, + id: 'optionRadioOrCheckBox', items: [{ - boxLabel: 'A', - name: 'answerValue', - inputValue: 'A', - checked: true + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '选项A', + id: 'optionA', + name: 'optionA', + allowBlank: true, + anchor: '99%' + }] }, { - boxLabel: 'B', - name: 'answerValue', - inputValue: 'B' + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '选项B', + id: 'optionB', + name: 'optionB', + allowBlank: true, + anchor: '99%' + }] }, { - boxLabel: 'C', - name: 'answerValue', - inputValue: 'C' + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '选项C', + id: 'optionC', + name: 'optionC', + allowBlank: true, + anchor: '99%' + }] }, { - boxLabel: 'D', - name: 'answerValue', - inputValue: 'D' + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '选项D', + id: 'optionD', + name: 'optionD', + allowBlank: true, + anchor: '99%' + }] }, { - boxLabel: 'E', - name: 'answerValue', - inputValue: 'E', - disabled: true - }], - allowBlank: true + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '选项E', + id: 'optionE', + name: 'optionE', + allowBlank: true, + anchor: '99%', + listeners: { + change: function (r) { + var questionRadioItems = top.Ext4.getCmp('questionRadio').items.items[4]; + var questionCheckboxItems = top.Ext4.getCmp('questionCheck').items.items[4]; + if (r.value.replace(/\s/g, "") == '') { + questionRadioItems.setDisabled(true); + questionCheckboxItems.setDisabled(true); + var questionRadio = top.Ext4.getCmp('questionRadio').getValue(); + if (questionRadio.answerValue == 'E') { + top.Ext4.getCmp('questionRadio').setValue({ answerValue: 'A' }); + } + top.Ext4.getCmp('questionCheck').setValue({ answerValue: 'A' }); + } else { + questionRadioItems.setDisabled(false); + questionCheckboxItems.setDisabled(false); + } + } + } + }] + }] }, { - xtype: 'checkboxgroup', - fieldLabel: '答案', - height: 30, - id: 'questionCheckbox', + columnWidth: 1, + layout: 'column', + border: 0, hidden: true, + id: 'optionYesOrNotBox', items: [{ - boxLabel: 'A', - name: 'answerValue', - inputValue: 'A', - checked: true + columnWidth: .2, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [new top.Ext4.form.Radio({ + fieldLabel: '答案', + id: 'answerTrue', + name: 'answerTrueOrFalse', + checked: true, + inputValue: 'true' + })] }, { - boxLabel: 'B', - name: 'answerValue', - inputValue: 'B' + columnWidth: .8, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + labelSeparator: '', + id: 'optionTrue', + name: 'optionTrue', + allowBlank: true, + value: '正确', + maxLength: 50, + anchor: '99%' + }] }, { - boxLabel: 'C', - name: 'answerValue', - inputValue: 'C' + columnWidth: .2, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [new top.Ext4.form.Radio({ + fieldLabel: ' ', + labelSeparator: '', + id: 'answerFalse', + name: 'answerTrueOrFalse', + inputValue: 'false' + })] }, { - boxLabel: 'D', - name: 'answerValue', - inputValue: 'D' - }, { - boxLabel: 'E', - name: 'answerValue', - inputValue: 'E', - disabled: true - }], - allowBlank: true + columnWidth: .8, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + labelSeparator: '', + id: 'optionFalse', + name: 'optionFalse', + allowBlank: true, + value: '错误', + maxLength: 50, + anchor: '99%' + }] + }] + }, { + xtype: 'hidden', + id: 'hiddenOptionFillBlankIndex', + name: 'hiddenOptionFillBlankIndex', + value: 0 + }, { + columnWidth: 1, + layout: 'column', + border: 0, + hidden: true, + id: 'optionFillBlankBox', + items: [{}] + }, { + columnWidth: 1, + layout: 'column', + border: 0, + hidden: true, + id: 'answerAreaBox', + items: [{ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textarea', + fieldLabel: '答案', + id: 'answerArea', + name: 'answerArea', + maxLength: 3000, + height: 200, + allowBlank: true, + emptyText: '简答题可不填写答案', + anchor: '99%' + }] + }] }] + }, { + columnWidth: .96, + layout: 'column', + border: 0, + style: 'margin-bottom:10px', + items: [{ + columnWidth: .6, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + id: 'questionRadioBox', + items: [{ + xtype: 'radiogroup', + fieldLabel: '答案', + height: 30, + id: 'questionRadio', + items: [{ + boxLabel: 'A', + name: 'answerValue', + inputValue: 'A', + checked: true + }, { + boxLabel: 'B', + name: 'answerValue', + inputValue: 'B' + }, { + boxLabel: 'C', + name: 'answerValue', + inputValue: 'C' + }, { + boxLabel: 'D', + name: 'answerValue', + inputValue: 'D' + }, { + boxLabel: 'E', + name: 'answerValue', + inputValue: 'E', + disabled: true + }] + }] + }, { + columnWidth: .6, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + id: 'questionCheckBox', + hidden: true, + items: [{ + xtype: 'checkboxgroup', + fieldLabel: '答案', + height: 30, + id: 'questionCheck', + items: [{ + boxLabel: 'A', + name: 'answerValue', + inputValue: 'A', + checked: true + }, { + boxLabel: 'B', + name: 'answerValue', + inputValue: 'B' + }, { + boxLabel: 'C', + name: 'answerValue', + inputValue: 'C' + }, { + boxLabel: 'D', + name: 'answerValue', + inputValue: 'D' + }, { + boxLabel: 'E', + name: 'answerValue', + inputValue: 'E', + disabled: true + }] + }] + }] }] }], buttons: [{ @@ -484,7 +754,7 @@ if (formPanel.getForm().isValid()) { saveConfig(); } else { - showResult('请填写表单!'); + showResult('请正确填写表单!'); return false; } } @@ -531,19 +801,58 @@ top.Ext4.getCmp('difficultyValue').setValue(result.data.difficultyValue); top.Ext4.getCmp('difficultyId').setValue(result.data.difficultyId); top.Ext4.getCmp('title').setValue(result.data.title); - top.Ext4.getCmp('optionA').setValue(result.data.optionA); - top.Ext4.getCmp('optionB').setValue(result.data.optionB); - top.Ext4.getCmp('optionC').setValue(result.data.optionC); - top.Ext4.getCmp('optionD').setValue(result.data.optionD); - top.Ext4.getCmp('optionE').setValue(result.data.optionE); top.Ext4.getCmp('questionType').setValue({ questionTypeValue: result.data.questionType }); - //top.Ext4.getCmp('isAssuredAnswer').setValue({ isAssuredAnswerValue: result.data.isAssuredAnswer }); - if (result.data.questionType == '单选') { - top.Ext4.getCmp('questionRadio').setValue({ answerValue: result.data.answer }); - } else { - var checkedDate = new Array(); - checkedDate = result.data.answer.split(';'); - top.Ext4.getCmp('questionCheckbox').setValue({ answerValue: checkedDate }); + if (result.data.questionType == '单选' || result.data.questionType == '多选') { + top.Ext4.getCmp('optionA').setValue(result.data.optionA); + top.Ext4.getCmp('optionB').setValue(result.data.optionB); + top.Ext4.getCmp('optionC').setValue(result.data.optionC); + top.Ext4.getCmp('optionD').setValue(result.data.optionD); + top.Ext4.getCmp('optionE').setValue(result.data.optionE); + if (result.data.questionType == '单选') { + top.Ext4.getCmp('questionRadio').setValue({ answerValue: result.data.answer }); + } else { + var checkedDate = new Array(); + checkedDate = result.data.answer.split(';'); + top.Ext4.getCmp('questionCheck').setValue({ answerValue: checkedDate }); + } + } else if (result.data.questionType == '判断题') { + top.Ext4.getCmp('optionTrue').setValue(result.data.optionTrue); + top.Ext4.getCmp('optionFalse').setValue(result.data.optionFalse); + if (result.data.answer == 'true') { + top.Ext4.getCmp('answerTrue').setValue(true) + } else { + top.Ext4.getCmp('answerFalse').setValue(true) + } + } else if (result.data.questionType == '填空题') { + var fillBlankAnswers = result.data.fillBlankAnswers; + top.Ext4.getCmp('hiddenOptionFillBlankIndex').setValue(fillBlankAnswers.length); + for (var i = 0; i < fillBlankAnswers.length; i++) { + top.Ext4.getCmp('optionFillBlankBox').add({ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + id: 'optionFillBlank' + i, + items: [{ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textfield', + fieldLabel: '填空' + (i + 1) + '答案', + id: 'answer_' + i, + name: 'answer_' + i, + allowBlank: true, + value: fillBlankAnswers[i].answer, + anchor: '99%' + }] + }] + }) + } + top.Ext4.getCmp('optionFillBlankBox').doLayout(); + } else if (result.data.questionType == '简答题') { + top.Ext4.getCmp('answerArea').setValue(result.data.answer); } } } Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionView.jsp =================================================================== diff -u -r38380 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionView.jsp (.../questionView.jsp) (revision 38380) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/question/questionView.jsp (.../questionView.jsp) (revision 38869) @@ -17,6 +17,11 @@ var newDate = '<%=request.getAttribute("newDate")%>'; var userName = '<%=request.getAttribute("userName")%>'; + Index: ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerForm.js =================================================================== diff -u -r38773 -r38869 --- ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerForm.js (.../examAnswerForm.js) (revision 38773) +++ ssts-web/src/main/webapp/disinfectsystem/onlineExams/examsAnswer/examAnswerForm.js (.../examAnswerForm.js) (revision 38869) @@ -21,7 +21,44 @@ } } -function getNormalExamAnswer(examDefinitionId, answerSheetId) { +function showPromptMessageBox(answerSheetId, examQuestionId, score) { + top.Ext4.MessageBox.prompt("评分设置", "当前问题的总得分为:" + score, function (btn, txt) { + if (btn == 'ok' && txt == '') { + showResult('请填写分数!'); + showPromptMessageBox(answerSheetId, examQuestionId, score); + } else if (btn == 'ok' && txt !== '') { + if (parseInt(txt) > parseInt(score)) { + showResult('设置的分数不能超过总分!'); + showPromptMessageBox(answerSheetId, examQuestionId, score); + return + } + top.Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/normalExamAnswerFormController/markExamPaperShortAnswerScore.mhtml', + params: { + answerSheetId: answerSheetId, + examQuestionId: examQuestionId, + score: txt + }, + success: function (response, options) { + var result = top.Ext4.decode(response.responseText); + if (result.success) { + var examDefinitionId = top.Ext4.getCmp('examDefinitionId').getValue(); + cancel(); + grid.dwrReload(); + getNormalExamAnswer(examDefinitionId, answerSheetId, '已评分'); + } else { + showResult(result.message); + } + }, + failure: function (response, options) { + showResult('保存失败!'); + } + }); + } + }, this, false); +} + +function getNormalExamAnswer(examDefinitionId, answerSheetId, examPaperStatus) { formPanel = new top.Ext4.form.Panel({ id: 'configForm', frame: true, @@ -107,13 +144,23 @@ showResult(result.message); } else { result = result.answerSheet; + if (result.examPaperStatus == examPaperStatus) { + return; + } top.Ext4.getCmp('configWin').title = "【" + result.name + "】"; examQuestions = result.examQuestions || []; if (examQuestions.length > 0) { if (result.endTime) { + var html = ''; + var scoreGained = result.scoreGained + '分'; + if (result.examPaperStatus == '待评分') { + scoreGained = '待评分'; + } + html += '

考生:' + result.examinee + '得分:' + scoreGained + '

' + html += '

考试结束

'; top.Ext4.getCmp('configForm').add({ border: false, - html: '您的得分是: ' + result.scoreGained + ' 分' + html: html }); top.Ext4.getCmp('saveAction').hide(); } @@ -140,80 +187,285 @@ for (var i = 0; i < examQuestions.length; i++) { var question = examQuestions[i].question; + var fillBlankAnswers = examQuestions[i].fillBlankAnswers || []; var title = question.title; var questionType = question.questionType; var answer = question.answer || ''; var answerChoosen = examQuestions[i].answerChoosen || ''; var html = !result.endTime ? '' : '(正确答案:' + answer + ')'; - var items = []; + var contentBox = {} if (questionType == '单选') { - items = [{ - xtype: 'radiogroup', - height: 30, - id: 'answer' + i, + contentBox = { + layout: 'form', + columnWidth: 1, items: [{ - boxLabel: 'A ' + question.optionA, - name: 'answerValue' + i, - inputValue: 'A', - checked: answerChoosen == 'A' ? true : false - }, { - boxLabel: 'B ' + question.optionB, - name: 'answerValue' + i, - inputValue: 'B', - checked: answerChoosen == 'B' ? true : false - }, { - boxLabel: 'C ' + question.optionC, - name: 'answerValue' + i, - inputValue: 'C', - checked: answerChoosen == 'C' ? true : false - }, { - boxLabel: 'D ' + question.optionD, - name: 'answerValue' + i, - inputValue: 'D', - checked: answerChoosen == 'D' ? true : false - }, { - boxLabel: 'E ' + question.optionE, - name: 'answerValue' + i, - inputValue: 'E', - checked: answerChoosen == 'E' ? true : false, - hidden: question.optionE == 'null' || question.optionE == null || question.optionE == '' - }], - allowBlank: true - }] - } else { - items = [{ - xtype: 'checkboxgroup', - height: 30, - id: 'answer' + i, + xtype: 'radiogroup', + height: 30, + id: 'answer' + i, + items: [{ + boxLabel: 'A ' + question.optionA, + name: 'answerValue' + i, + inputValue: 'A', + checked: answerChoosen == 'A' ? true : false + }, { + boxLabel: 'B ' + question.optionB, + name: 'answerValue' + i, + inputValue: 'B', + checked: answerChoosen == 'B' ? true : false + }, { + boxLabel: 'C ' + question.optionC, + name: 'answerValue' + i, + inputValue: 'C', + checked: answerChoosen == 'C' ? true : false + }, { + boxLabel: 'D ' + question.optionD, + name: 'answerValue' + i, + inputValue: 'D', + checked: answerChoosen == 'D' ? true : false + }, { + boxLabel: 'E ' + question.optionE, + name: 'answerValue' + i, + inputValue: 'E', + checked: answerChoosen == 'E' ? true : false, + hidden: question.optionE == 'null' || question.optionE == null || question.optionE == '' + }], + allowBlank: true + }] + } + } else if (questionType == '多选') { + contentBox = { + layout: 'form', + columnWidth: 1, items: [{ - boxLabel: 'A ' + question.optionA, - name: 'answerValue' + i, - inputValue: 'A', - checked: answerChoosen.indexOf('A') >= 0 ? true : false + xtype: 'checkboxgroup', + height: 30, + id: 'answer' + i, + items: [{ + boxLabel: 'A ' + question.optionA, + name: 'answerValue' + i, + inputValue: 'A', + checked: answerChoosen.indexOf('A') >= 0 ? true : false + }, { + boxLabel: 'B ' + question.optionB, + name: 'answerValue' + i, + inputValue: 'B', + checked: answerChoosen.indexOf('B') >= 0 ? true : false + }, { + boxLabel: 'C ' + question.optionC, + name: 'answerValue' + i, + inputValue: 'C', + checked: answerChoosen.indexOf('C') >= 0 ? true : false + }, { + boxLabel: 'D ' + question.optionD, + name: 'answerValue' + i, + inputValue: 'D', + checked: answerChoosen.indexOf('D') >= 0 ? true : false + }, { + boxLabel: 'E ' + question.optionE, + name: 'answerValue' + i, + inputValue: 'E', + checked: answerChoosen.indexOf('E') >= 0 ? true : false, + hidden: question.optionE == 'null' || question.optionE == null || question.optionE == '' + }], + allowBlank: true + }] + } + } else if (questionType == '判断题') { + contentBox = { + layout: 'form', + columnWidth: 1, + items: [{ + xtype: 'radiogroup', + height: 30, + id: 'answer' + i, + items: [{ + boxLabel: question.optionTrue, + name: 'answerValue' + i, + inputValue: question.optionTrue, + checked: (question.optionTrue == question.answer) ? true : false + }, { + boxLabel: question.optionFalse, + name: 'answerValue' + i, + inputValue: question.optionFalse, + checked: (question.optionFalse == question.answer) ? true : false + }, { + boxLabel: '空', + name: 'answerValue7', + hidden: true, + inputValue: '空' + }, { + boxLabel: '空', + name: 'answerValue8', + hidden: true, + inputValue: '空' + }, { + boxLabel: '空', + name: 'answerValue9', + hidden: true, + inputValue: '空' + }], + allowBlank: true + }] + } + } else if (questionType == '填空题') { + if (result.endTime) { + var questionFillBlankAnswers = question.fillBlankAnswers; + var answerHtml = ''; + for (var k = 0; k < questionFillBlankAnswers.length; k++) { + if (answerHtml == '') { + answerHtml = questionFillBlankAnswers[k].answer; + } else { + answerHtml += ';' + questionFillBlankAnswers[k].answer; + } + } + html = '(正确答案:' + answerHtml + ')'; + } + var items = []; + var newTitle = title; + for (var j = 1; j < title.split('___').length; j++) { + if (fillBlankAnswers.length > 0) { + newTitle = newTitle.replace('___', '_' + (fillBlankAnswers[j - 1].answer || '空') + '_'); + } else { + newTitle = newTitle.replace('___', '_' + j + '_'); + items.push({ + layout: 'form', + columnWidth: 1, + items: [{ + xtype: 'textfield', + fieldLabel: '填空项' + j, + id: 'answer' + i + '_' + j, + name: 'answer' + i + '_' + j, + anchor: '99%', + maxLength: 50, + allowBlank: true + }] + }) + } + } + contentBox = { + layout: 'column', + columnWidth: 1, + items: [{ + xtype: 'hidden', + id: 'hiddenTitleLength' + i, + name: 'hiddenTitleLength' + i, + value: title.split('___').length }, { - boxLabel: 'B ' + question.optionB, - name: 'answerValue' + i, - inputValue: 'B', - checked: answerChoosen.indexOf('B') >= 0 ? true : false - }, { - boxLabel: 'C ' + question.optionC, - name: 'answerValue' + i, - inputValue: 'C', - checked: answerChoosen.indexOf('C') >= 0 ? true : false - }, { - boxLabel: 'D ' + question.optionD, - name: 'answerValue' + i, - inputValue: 'D', - checked: answerChoosen.indexOf('D') >= 0 ? true : false - }, { - boxLabel: 'E ' + question.optionE, - name: 'answerValue' + i, - inputValue: 'E', - checked: answerChoosen.indexOf('E') >= 0 ? true : false, - hidden: question.optionE == 'null' || question.optionE == null || question.optionE == '' - }], - allowBlank: true - }] + layout: 'form', + columnWidth: 1, + items: items + }] + } + title = newTitle; + } else { + var answerChoosenValue = ''; + html = ''; + if ((answerChoosen || '') !== '') { + answerChoosenValue = "答:" + answerChoosen; + contentBox = { + layout: 'column', + columnWidth: 1, + items: [{ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + html: answerChoosenValue + }] + }, { + columnWidth: 1, + layout: 'column', + border: 0, + style: 'margin-bottom:10px', + hidden: examQuestions[i].scoreGained, + items: [{ + columnWidth: SSTS_ExamsAnswer_Score ? 0.85 : 0.7, + layout: 'form', + border: 0, + items: [{ + xtype: 'displayfield', + labelSeparator: '', + fieldLabel: ' ', + value: ' ' + }] + }, { + columnWidth: 0.15, + layout: 'form', + border: 0, + items: [{ + xtype: 'button', + text: '参考答案', + style: 'float:left', + width: 70, + examQuestionsId: examQuestions[i].id, + listeners: { + click: function (e) { + top.Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/normalExamAnswerFormController/loadShortAnswerQuestionAnswer.mhtml', + params: { + answerSheetId: result.id, + examQuestionId: e.examQuestionsId + }, + success: function (response, options) { + var result = top.Ext4.decode(response.responseText); + if (result.success) { + top.Ext4.MessageBox.alert("参考答案", result.answer); + } else { + showResult(result.message); + } + }, + failure: function (response, options) { + showResult('保存失败!'); + } + }); + } + } + }] + }, { + columnWidth: 0.15, + layout: 'form', + border: 0, + hidden: SSTS_ExamsAnswer_Score, + items: [{ + xtype: 'button', + text: '评分', + style: 'float:left', + width: 70, + examQuestionsId: examQuestions[i].id, + score: examQuestions[i].score, + listeners: { + click: function (e) { + showPromptMessageBox(result.id, e.examQuestionsId, e.score) + } + } + }] + }] + }] + } + } else { + contentBox = { + layout: 'column', + columnWidth: 1, + items: [{ + columnWidth: 1, + layout: 'form', + border: 0, + style: 'margin-bottom:10px', + items: [{ + xtype: 'textarea', + id: 'answer' + i, + name: 'answer' + i, + height: 200, + allowBlank: true, + anchor: '99%', + readOnly: answerChoosenValue !== '' ? true : false, + fieldCls: answerChoosenValue !== '' ? 'fieldReadOnlyNoRemoveAndTop' : '', + value: answerChoosenValue + }] + }] + } + } } top.Ext4.getCmp('configForm').add({ xtype: "fieldset", @@ -227,11 +479,7 @@ layout: 'form', columnWidth: 1, value: (i + 1) + '、' + title - }, { - layout: 'form', - columnWidth: 1, - items: items - }] + }, contentBox] }); } }