调整考试结果页面接口对接

This commit is contained in:
zyy 2020-05-29 17:49:26 +08:00
parent 243a5763bc
commit 29f027077d
6 changed files with 34 additions and 17 deletions

View File

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

View File

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

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -2,14 +2,14 @@
<div class="question"> <div class="question">
<div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key, option)" /> <div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key, option)" />
<template v-if="checkType(option, 'judge')"> <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"> <el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: inline">
<span>{{ el.content }}</span> <span>{{ el.content }}</span>
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</template> </template>
<template v-else-if="checkType(option, 'select')"> <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"> <el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: block">
<span>{{ $asc2chart(i+65) }}. </span> <span>{{ $asc2chart(i+65) }}. </span>
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" /> <div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
@ -53,11 +53,22 @@ export default {
return option.type == type; return option.type == type;
}, },
appendIndex(str, index, option) { appendIndex(str, index, option) {
console.log(option); let result = '';
let result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`; const i = option.optionList.findIndex(ele => ele.correct);
if (option.type === 'select') { 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}`; 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" /> <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> </template>
</div> </div>
<div style="padding-left: 20px;margin-top: 20px;">
<span>考试总分: </span>
<span style="font-size: 20px">{{ totalScore }}</span>
</div>
</el-main> </el-main>
<el-footer class="quiz__container-footer layer-center" @click="returnTop"> <el-footer class="quiz__container-footer layer-center" @click="returnTop">
<el-button-group class="buttons"> <el-button-group class="buttons">
@ -25,7 +29,8 @@
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js'; // import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
// import WindowResizeHandler from '@/mixin/WindowResizeHandler'; // import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Question from './question'; import Question from './question';
import { getTheoryQuestion } from '@/api/competition'; // import { getTheoryQuestion } from '@/api/competition';
import { getCompetitionDetail } from '@/api/competition';
export default { export default {
components: { components: {
@ -47,6 +52,7 @@ export default {
totalScore: 0, totalScore: 0,
passScore: 10 passScore: 10
}, },
totalScore: 0,
examQuestions: [] examQuestions: []
}; };
}, },
@ -86,13 +92,13 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
getTheoryQuestion(this.$route.query.raceId).then((resp)=>{ getCompetitionDetail(this.$route.query.raceId).then((resp)=>{
if (resp.data) { if (resp.data) {
this.examQuestions = resp.data.questions.map((el, i) => { resp.data.forEach((item, i) => {
el.index = i; this.examQuestions.push({...item.question, ...{answer: String(item.answerOptionId), score: item.score, index: i}});
el.answer = String(el.optionList[0].id);
return el;
}); });
this.totalScore = resp.data.reduce((pre, ver) => pre + ver.score, 0);
console.log(this.totalScore);
} }
}).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); }); }).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
}, },

View File

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