This commit is contained in:
fan 2020-05-29 17:55:33 +08:00
commit 0d27ba3d6f
5 changed files with 32 additions and 15 deletions

View File

@ -93,7 +93,7 @@ export default {
operation: '',
planMode: 5,
headMode: 5,
fontSize: 16
fontSize: 30
};
},
computed: {

View File

@ -36,7 +36,7 @@ class Model {
};
this['private'][deviceType.Train] = {
nameFormat: 'targetCode:serviceNumber:tripNumber', // 字体格式
nameFontSize: 10 // 字体大小
nameFontSize: 30 // 字体大小
};
this['private'][deviceType.TrainWindow] = {
trainWindowShow: true

View File

@ -2,14 +2,14 @@
<div class="question">
<div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key, option)" />
<template v-if="checkType(option, 'judge')">
<el-radio-group v-model="answer" disabled @change="onChnage">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: inline">
<span>{{ el.content }}</span>
</el-radio>
</el-radio-group>
</template>
<template v-else-if="checkType(option, 'select')">
<el-radio-group v-model="answer" disabled class="select-box" @change="onChnage">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: block">
<span>{{ $asc2chart(i+65) }}. </span>
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
@ -53,11 +53,22 @@ export default {
return option.type == type;
},
appendIndex(str, index, option) {
console.log(option);
let result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
let result = '';
const i = option.optionList.findIndex(ele => ele.correct);
if (option.type === 'select') {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: D)</span>`;
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${this.$asc2chart(i + 65)})</span>`;
}
} else if (option.type === 'judge') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${option.optionList[i].content})</span>`;
}
}
this.$set(option, 'rightAnswer', option.optionList[i].id);
//
return `${index + 1}. ${str} ${result}`;
},

View File

@ -11,6 +11,10 @@
<question v-for="(item,j) in el.children" :id="'anchor__lst-'+item.type+'-'+item.index" :key="j" v-model="item.answer" class="context" :option="item" />
</template>
</div>
<div style="padding-left: 20px;margin-top: 20px;">
<span>考试总分: </span>
<span style="font-size: 20px">{{ totalScore }}</span>
</div>
</el-main>
<el-footer class="quiz__container-footer layer-center" @click="returnTop">
<el-button-group class="buttons">
@ -25,7 +29,8 @@
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
// import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Question from './question';
import { getTheoryQuestion } from '@/api/competition';
// import { getTheoryQuestion } from '@/api/competition';
import { getCompetitionDetail } from '@/api/competition';
export default {
components: {
@ -47,6 +52,7 @@ export default {
totalScore: 0,
passScore: 10
},
totalScore: 0,
examQuestions: []
};
},
@ -86,13 +92,13 @@ export default {
},
methods: {
loadInitData() {
getTheoryQuestion(this.$route.query.raceId).then((resp)=>{
getCompetitionDetail(this.$route.query.raceId).then((resp)=>{
if (resp.data) {
this.examQuestions = resp.data.questions.map((el, i) => {
el.index = i;
el.answer = String(el.optionList[0].id);
return el;
resp.data.forEach((item, i) => {
this.examQuestions.push({...item.question, ...{answer: String(item.answerOptionId), score: item.score, index: i}});
});
this.totalScore = resp.data.reduce((pre, ver) => pre + ver.score, 0);
console.log(this.totalScore);
}
}).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
},

View File

@ -75,8 +75,8 @@ export default {
const data = {
raceId: this.info.raceId,
userId: this.info.userId,
theoryScore: this.info.theoryScore,
practiceScore: this.info.practiceScore
artificialTheoryScore: Number(this.info.theoryScore),
artificialPracticeScore: Number(this.info.practiceScore)
};
putRefereeScoring(data).then(res => {
this.doClose();