竞赛考试结果调整

This commit is contained in:
fan 2020-05-22 16:34:05 +08:00
parent bcbb5ff512
commit 86edffb984
3 changed files with 82 additions and 50 deletions

View File

@ -5,29 +5,35 @@
</div> </div>
<div class="context"> <div class="context">
<el-form ref="form" :model="resultModel" size="mini"> <el-form ref="form" :model="resultModel" size="mini">
<el-form-item :label="this.$t('exam.testQuestionsName')+':'" prop="name">
<span>{{ resultModel.examName }}</span>
</el-form-item>
<el-form-item :label="this.$t('exam.testScores')+':'" prop="score"> <el-form-item :label="this.$t('exam.testScores')+':'" prop="score">
<span>{{ resultModel.score + ' '+ $t('exam.points') }}</span> <span>{{ resultModel.score + ' '+ $t('exam.points') }}</span>
</el-form-item> </el-form-item>
<el-form-item :label="this.$t('exam.whetherThrough')+':'" prop="detail">
<span v-if="resultModel.result === '01'" style="color:darkgray">{{ $t('exam.didNotCalculate') }}</span>
<span v-else-if="resultModel.result === '02'" style="color:green">{{ $t('exam.pass') }}</span>
<span v-else-if="resultModel.result === '03'" style="color:red">{{ $t('exam.notPass') }}</span>
</el-form-item>
<el-form-item :label="this.$t('exam.examTime')+':'" prop="detail"> <el-form-item :label="this.$t('exam.examTime')+':'" prop="detail">
<span>{{ Math.ceil(resultModel.usedTime/60) + ' '+ $t('global.minutes') }}</span> <span>{{ Math.ceil((resultModel.usedTime || 0)/60) + ' '+ $t('global.minutes') }}</span>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table :data="resultModel.userExamQuestionsVOs" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary> <el-table :data="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod">
<el-table-column prop="trainingName" :label="this.$t('exam.trainingName')" /> <el-table-column prop="title" label="题数">
<el-table-column prop="score" :label="this.$t('exam.trainingScore')" /> <template slot-scope="scope">
<el-table-column prop="cause" label="原因/结果" /> <span>{{ '第'+scope.row.title + '题' }}</span>
</template>
</el-table-column>
<el-table-column prop="score" label="分值(分)" />
<el-table-column prop="goal" label="得分(分)" />
<el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="正确答案" />
<el-table-column v-if="this.$route.query.type ==='theory'" prop="explain" label="说明" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点">
<template slot-scope="scope">
<span>{{ '得分点'+scope.row.scoringPointIndex }}</span>
</template>
</el-table-column>
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointScore" label="得分点分值" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointGoal" label="得分点得分" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointExplain" label="得分点说明" />
</el-table> </el-table>
</div> </div>
<div class="draf_box"> <div class="draf_box">
<el-button type="primary " @click="back">{{ $t('exam.returnToExamList') }}</el-button> <el-button type="primary " @click="back">返回首页</el-button>
</div> </div>
</div> </div>
</template> </template>
@ -49,7 +55,20 @@ export default {
trainingName: '', trainingName: '',
score: 0 score: 0
}, },
loading: true theoryData: [
{ title: '1', score: '2', goal: '0', correctAnswer: 'A', explain: '这是说明原因所有A为正确答案' },
{ title: '2', score: '2', goal: '0', correctAnswer: 'B', explain: '这是说明原因所有B为正确答案' },
{ title: '3', score: '2', goal: '0', correctAnswer: 'C', explain: '这是说明原因所有C为正确答案' },
{ title: '4', score: '2', goal: '0', correctAnswer: 'D', explain: '这是说明原因所有D为正确答案' }
],
operateData: [
{ title: '1', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] },
{ title: '2', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] },
{ title: '3', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] },
{ title: '4', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] }
],
loading: true,
tableData: []
}; };
}, },
computed: { computed: {
@ -69,48 +88,60 @@ export default {
sums[index] = this.$t('exam.totalScore'); sums[index] = this.$t('exam.totalScore');
return; return;
} }
const values = data.map(item => Number(item[column.property])); if (column.property === 'score' || column.property === 'goal' || column.property === 'scoringPointScore' || column.property === 'scoringPointGoal') {
if (!values.every(value => isNaN(value))) { const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => { if (!values.every(value => isNaN(value))) {
const value = Number(curr); sums[index] = values.reduce((prev, curr) => {
if (!isNaN(value)) { const value = Number(curr);
return prev + curr; if (!isNaN(value)) {
} else { return prev + curr;
return prev; } else {
} return prev;
}, 0); }
sums[index] += this.$t('exam.points'); }, 0);
} else { sums[index] += this.$t('exam.points');
sums[index] = 'N/A'; } else {
sums[index] = '';
}
} }
}); });
return sums; return sums;
}, },
submitExamData() { submitExamData() {
// this.loading = true;
// let count = 3;
// const userExamId = this.$route.params.userExamId;
// let interval = setInterval(() => {
// submitExam(userExamId).then(response => {
this.loading = false; this.loading = false;
// this.resultModel = response.data; if (this.$route.query.type === 'theory') {
// clearInterval(interval); this.tableData = this.theoryData;
// interval = null; } else if (this.$route.query.type === 'operate') {
// }).catch(() => { this.tableData = [];
// if (count-- < 0) { this.operateData.forEach(item => {
// this.loading = false; if (item.scoringPoints && item.scoringPoints.length) {
// clearInterval(interval); item.scoringPoints.forEach((elem, index) => {
// interval = null; this.tableData.push({
// this.$messageBox(this.$t('error.submitExamFailed')); title: item.title, score: item.score, goal: item.goal, scoringPointLength: item.scoringPoints.length, scoringPointIndex: index + 1, scoringPointScore: elem.score, scoringPointGoal: elem.goal, scoringPointExplain: elem.explain
// } });
// }); });
// }, 1000); }
});
}
}, },
back() { back() {
const query = {type: 'operation', mapId: this.$route.query.mapId}; const query = {type: 'operation', mapId: this.$route.query.mapId};
this.$router.push({path: `/jsxt/examDetail`, query: query}); this.$router.push({path: `/jsxt/home`, query: query});
// const examId = this.resultModel.examId; },
// this.$router.push({path: `${UrlConfig.trainingPlatform.examDetail}/${examId}`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId }}); objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if ((columnIndex === 0 || columnIndex === 1 || columnIndex === 2) && row.scoringPointLength) {
if (row.scoringPointIndex === 1) {
return {
rowspan: row.scoringPointLength,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}
} }
} }
}; };

View File

@ -154,7 +154,8 @@ export default {
}, },
doEnd() { doEnd() {
// console.log(''); // console.log('');
this.$router.push({ path: `/jsxt/home`}); // this.$router.push({ path: `/jsxt/home`});
this.$router.push({ path: `/jsxt/result`, query: { type: 'theory' } });
}, },
onSave(data) { onSave(data) {
console.log(data, '问答题'); console.log(data, '问答题');

View File

@ -336,7 +336,7 @@ export default {
submit() { submit() {
// this.$store.dispatch('exam/over').then(() => { // this.$store.dispatch('exam/over').then(() => {
// this.$store.dispatch('trainingList/clearTrainingList'); // this.$store.dispatch('trainingList/clearTrainingList');
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId } }); this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate' } });
// }); // });
} }
} }