裁判系统查看理论考试结果页面调整

This commit is contained in:
joylink_cuiweidong 2020-06-05 10:31:58 +08:00
parent 3b137ffae9
commit e3b2726d8b
3 changed files with 84 additions and 3 deletions

View File

@ -232,3 +232,11 @@ export function fromPauseToPlay(params) {
});
}
/** 裁判查询理论考试结果 */
export function getTheroyCompetitionResult(competitionId, raceUserId) {
return request({
url: `api/v1/competitionTheory/detail/competition/${competitionId}/raceUser/${raceUserId}`,
method: 'get'
});
}

View File

@ -3,6 +3,7 @@
<div class="raceName">{{ raceName }}竞赛</div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-score ref="editScore" />
<theory-result ref="theoryResult" />
</div>
</template>
@ -10,11 +11,13 @@
import { refereeEnterSimulation, loadingPaper, getRaceUserList, getRaceById, playBackReady } from '@/api/competition';
import { getPublishMapInfo } from '@/api/jmap/map';
import editScore from './editScore';
import TheoryResult from './theoryResult';
export default {
name: 'RefereeList',
components:{
editScore
editScore,
TheoryResult
},
data() {
return {
@ -176,8 +179,9 @@ export default {
}, 2000);
});
},
handleTheoryResult() {
this.$router.replace({ path: `/jsxt/theory/result?raceId=${this.$route.query.raceId}&result=true` });
handleTheoryResult(index, row) {
this.$refs.theoryResult.doShow({row:row, raceId:this.$route.query.raceId});
// this.$router.replace({ path: `/jsxt/theory/result?raceId=${this.$route.query.raceId}&result=true` });
},
handleAdd() {
const loading = this.$loading({

View File

@ -0,0 +1,69 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="show" top="150px" width="900px" :before-do-close="doClose" :close-on-click-modal="false">
<div v-for="(el,i) in sortedList" :id="'anchor__lst-'+i" :key="i" class="section">
<template v-if="el.children.length">
<div class="caption">{{ index2UnicodeList[i] }}{{ el.title }}</div>
<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-dialog>
</template>
<script>
import { getTheroyCompetitionResult } from '@/api/competition';
export default {
name:'TheroyResult',
data() {
return {
title:'',
show: false,
loading:false,
totalScore: 0,
examQuestions: []
};
},
computed: {
question() {
return this.examQuestions[this.index] || {};
},
index2UnicodeList() {
return ['一', '二', '三', '四'];
},
sortedList() {
return [
{
title: '判断题',
children: this.examQuestions.filter(el => { return el.type === 'judge'; })
},
{
title: '选择题',
children: this.examQuestions.filter(el => { return el.type === 'select'; })
}
];
}
},
methods:{
doShow({row, raceId}) {
this.loadInitData(raceId, row.userId);
this.show = true;
this.title = '【' + row.organization + '】' + row.name + ' 理论结果';
},
doClose() {
this.show = false;
},
loadInitData(raceId, userId) {
getTheroyCompetitionResult(raceId, userId).then((resp)=>{
if (resp.data) {
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);
}
}).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
}
}
};
</script>