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