Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
a5b954c017
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" class="theoryExam" fullscreen style="background:#eeeeee">
|
||||
<div class="theoryExamBody">
|
||||
<div v-loading="loading" class="theoryExamBody">
|
||||
<div class="theoryExamBodyL">
|
||||
<div class="theoryExamQuestion">
|
||||
<div class="QuestionName">{{ covert() }}</div>
|
||||
@ -9,7 +9,7 @@
|
||||
<el-radio
|
||||
v-for="(choice,index) in questionList[currentQuestionNum].optionList "
|
||||
:key="index"
|
||||
v-model="currentSelectAnswer"
|
||||
v-model="currentRadioAnswer"
|
||||
:label="choice.id"
|
||||
class="eachChoice"
|
||||
@change="changeAnswer"
|
||||
@ -26,11 +26,13 @@
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="mode=='practice'&&isSelect" class="correctAnswer">
|
||||
{{ '答案:'+getCorrectAnswer() }}
|
||||
<div v-if="mode=='practice'&&isSelect" class="correctAnswer" :style="answerIsCorrect?'color: #67C23A;':'color: #ff4d4f;'">
|
||||
<span class="practiceIconTips" :class="answerIsCorrect?'el-icon-success':'el-icon-error'" />
|
||||
<span class="practicecorrectAnswer">{{ '答案:'+correctAnswer }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttonList">
|
||||
<el-button v-if="mode=='practice'" :disabled="isSelect" type="success" class="commitQuestion" size="small" @click="commitQuestion">确 认</el-button>
|
||||
<div class="prevAndNext">
|
||||
<el-button-group>
|
||||
<el-button type="primary" size="small" :disabled="currentQuestionNum==0" @click="prevQuestion"><span class="el-icon-arrow-left" style="margin-right:5px;" />上一题</el-button>
|
||||
@ -44,7 +46,7 @@
|
||||
<div v-if="mode=='test'" class="theoryExamBodyRT">
|
||||
<span class="noAnswer">未作答</span>
|
||||
<span class="hasAnswer">已作答</span>
|
||||
<span class="hasSign">标记</span>
|
||||
<!-- <span class="hasSign">标记</span> -->
|
||||
</div>
|
||||
<div class="theoryExamQuestionList">
|
||||
<div v-for="(eachNum,index) in questionList" :key="index" class="eachQuestionNum" @click="changeQuestion(index)">
|
||||
@ -61,17 +63,28 @@ export default {
|
||||
name:'TheoryExam',
|
||||
data() {
|
||||
return {
|
||||
loading:false,
|
||||
dialogVisible:false,
|
||||
mode:'',
|
||||
questionList:[],
|
||||
currentQuestionNum:0,
|
||||
currentSelectAnswer:'',
|
||||
currentSelectAnswer:[],
|
||||
currentRadioAnswer:'',
|
||||
currentCorrectAnswer:[],
|
||||
answerIsCorrect:false,
|
||||
hasAnswerList:{},
|
||||
correctAnswer:'',
|
||||
isSelect:false,
|
||||
choiceTypeList:['A', 'B', 'C', 'D', 'E', 'F', 'G']
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
doShow({type}) {
|
||||
this.loading = true;
|
||||
this.isSelect = false;
|
||||
this.questionList = [];
|
||||
this.currentSelectAnswer = [];
|
||||
this.currentRadioAnswer = '';
|
||||
let currentMode = '01';
|
||||
if (type == 'practice') {
|
||||
currentMode = '01';
|
||||
@ -81,23 +94,23 @@ export default {
|
||||
this.mode = type;
|
||||
getItemListByProjectCode('drts', {mode:currentMode}).then(res=>{
|
||||
this.questionList = res.data;
|
||||
this.questionList = [...this.questionList, ...res.data, ...res.data, ...res.data, ...res.data, ...res.data, ...res.data];
|
||||
if (this.mode == 'practice') {
|
||||
getPracticeQuestionProgress('drts').then(res=>{
|
||||
this.currentQuestionNum = res.data.questionIndex;
|
||||
this.loading = false;
|
||||
}).catch(error=>{
|
||||
console.log(error.message);
|
||||
});
|
||||
} else {
|
||||
this.currentQuestionNum = 0;
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
if (this.mode == 'practice') {
|
||||
getPracticeQuestionProgress('drts').then(res=>{
|
||||
this.currentQuestionNum = res.data.questionIndex;
|
||||
}).catch(error=>{
|
||||
console.log(error.message);
|
||||
});
|
||||
}
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
confirm() {
|
||||
this.$$emit('startTheoryExam', this.form);
|
||||
},
|
||||
covert() {
|
||||
const typeList = {'judge':'判断', 'select':'选择', 'multi':'多选'};
|
||||
const currentQuestion = this.questionList[this.currentQuestionNum];
|
||||
@ -109,6 +122,8 @@ export default {
|
||||
changeQuestion(num) {
|
||||
this.isSelect = false;
|
||||
this.currentQuestionNum = num;
|
||||
this.currentSelectAnswer = [];
|
||||
this.currentRadioAnswer = '';
|
||||
},
|
||||
judgeQuestionType(type) {
|
||||
const currentQuestion = this.questionList[this.currentQuestionNum];
|
||||
@ -120,23 +135,12 @@ export default {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getCorrectAnswer() {
|
||||
let correctAnswer = '';
|
||||
const question = this.questionList[this.currentQuestionNum];
|
||||
if (question) {
|
||||
const options = this.questionList[this.currentQuestionNum].optionList;
|
||||
options.forEach((choice, index)=>{
|
||||
if (choice.correct) {
|
||||
correctAnswer = this.choiceTypeList[index] + '、' + choice.content;
|
||||
}
|
||||
});
|
||||
}
|
||||
return correctAnswer;
|
||||
},
|
||||
prevQuestion() {
|
||||
if (this.currentQuestionNum > 0) {
|
||||
this.currentQuestionNum -= 1;
|
||||
this.isSelect = false;
|
||||
this.currentSelectAnswer = [];
|
||||
this.currentRadioAnswer = '';
|
||||
}
|
||||
|
||||
},
|
||||
@ -144,6 +148,8 @@ export default {
|
||||
if (this.currentQuestionNum < this.questionList.length) {
|
||||
this.currentQuestionNum += 1;
|
||||
this.isSelect = false;
|
||||
this.currentSelectAnswer = [];
|
||||
this.currentRadioAnswer = '';
|
||||
}
|
||||
},
|
||||
commitExam() {
|
||||
@ -155,17 +161,43 @@ export default {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
changeAnswer(data) {
|
||||
commitQuestion() {
|
||||
if (this.mode == 'practice') {
|
||||
this.isSelect = true;
|
||||
this.currentCorrectAnswer = [];
|
||||
this.correctAnswer = '';
|
||||
this.answerIsCorrect = false;
|
||||
const question = this.questionList[this.currentQuestionNum];
|
||||
if (question) {
|
||||
const options = this.questionList[this.currentQuestionNum].optionList;
|
||||
options.forEach((choice, index)=>{
|
||||
if (choice.correct) {
|
||||
this.correctAnswer += this.choiceTypeList[index] + '、' + choice.content + ' ';
|
||||
this.currentCorrectAnswer.push(choice.id);
|
||||
}
|
||||
});
|
||||
if (this.currentRadioAnswer) {
|
||||
if (this.currentRadioAnswer == this.currentCorrectAnswer.toString()) {
|
||||
this.answerIsCorrect = true;
|
||||
} else {
|
||||
this.answerIsCorrect = false;
|
||||
}
|
||||
}
|
||||
if (this.currentSelectAnswer.length > 0) {
|
||||
if (this.currentCorrectAnswer.toString() == this.currentSelectAnswer.sort().toString()) {
|
||||
this.answerIsCorrect = true;
|
||||
} else {
|
||||
this.answerIsCorrect = false;
|
||||
}
|
||||
}
|
||||
this.isSelect = true;
|
||||
updatePracticeQuestionProgress('drts', {index:this.currentQuestionNum}).then(res=>{
|
||||
}).catch(error=>{
|
||||
console.log(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
changeAnswer(data) {
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -212,12 +244,12 @@ export default {
|
||||
border-radius: 4px;
|
||||
border: 1px #cfcfcf solid;
|
||||
display: inline-block;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
line-height: 23px;
|
||||
margin-right: 30px;
|
||||
margin-top:10px;
|
||||
line-height: 28px;
|
||||
margin-right: 25px;
|
||||
margin-top: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.noAnswer{
|
||||
@ -272,9 +304,8 @@ export default {
|
||||
margin-top: 15px;
|
||||
}
|
||||
.correctAnswer{
|
||||
margin-left: 15px;
|
||||
margin-left: 10px;
|
||||
margin-top: 20px;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
.buttonList{
|
||||
position: absolute;
|
||||
@ -284,9 +315,25 @@ export default {
|
||||
.prevAndNext{
|
||||
float: left;
|
||||
display: inline-block;
|
||||
margin-right: 30px;
|
||||
}
|
||||
.commitExam{}
|
||||
.commitExam{margin-left: 30px;}
|
||||
.commitQuestion{
|
||||
float: left;
|
||||
margin-right: 200px;
|
||||
}
|
||||
.practiceIconTips{
|
||||
font-size: 25px;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
.practicecorrectAnswer{
|
||||
vertical-align: top;
|
||||
line-height: 131%;
|
||||
display: inline-block;
|
||||
width: 375px;
|
||||
margin-left: 8px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.theoryExam .el-dialog.is-fullscreen{
|
||||
|
Loading…
Reference in New Issue
Block a user