This commit is contained in:
fan 2020-05-27 18:35:17 +08:00
commit 50f8956728
6 changed files with 84 additions and 69 deletions

View File

@ -49,7 +49,7 @@ export function getQuestionListByMapId(params) {
// 加载试卷 // 加载试卷
export function loadingPaper(competitionId, data) { export function loadingPaper(competitionId, data) {
return request({ return request({
url: `api/v1/competition/${competitionId}/testPaper`, url: `/api/v1/competition/${competitionId}/testPaper`,
method: 'post', method: 'post',
data data
}); });
@ -91,9 +91,9 @@ export function getRaceUserList(params) {
// } // }
/** 提交试卷 */ /** 提交试卷 */
export function postCompetitionTheory(theoryId, data) { export function postCompetitionTheory(data) {
return request({ return request({
url: `/api/v1/competitionTheory/${theoryId}/submit`, url: `/api/v1/competitionTheory/submit`,
method: 'post', method: 'post',
data data
}); });
@ -131,6 +131,14 @@ export function getTheoryQuestion(competitionId) {
}); });
} }
/** 查询理论题作答详情 */
export function getCompetitionDetail(competitionId) {
return request({
url: `/api/v1/competitionTheory/detail/competition/${competitionId}`,
method: 'get'
});
}
/** 根据id查询竞赛信息 */ /** 根据id查询竞赛信息 */
export function getRaceById(id) { export function getRaceById(id) {
return request({ return request({

View File

@ -23,11 +23,7 @@
<el-tag type="primary" disable-transitions>{{ QuestionTypeMap[scope.row.type] }}</el-tag> <el-tag type="primary" disable-transitions>{{ QuestionTypeMap[scope.row.type] }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="topic" label="题目" show-overflow-tooltip="">
prop="topic"
label="题目"
show-overflow-tooltip
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-html="scope.row.topic" /> <span v-html="scope.row.topic" />
</template> </template>

View File

@ -159,7 +159,6 @@ export default {
async getUserStatus() { async getUserStatus() {
this.resultFlag = false; this.resultFlag = false;
const res = await getRaceUserById(this.$route.query.raceId); const res = await getRaceUserById(this.$route.query.raceId);
// console.log(res.data.status);
if (this.$route.query.type == 'theory' && (res.data.status == 4 || res.data.status == 5)) { if (this.$route.query.type == 'theory' && (res.data.status == 4 || res.data.status == 5)) {
this.$router.replace({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } }); this.$router.replace({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } });
} else if (this.$route.query.type == 'operation' && (res.data.status == 4 || res.data.status == 6)) { } else if (this.$route.query.type == 'operation' && (res.data.status == 4 || res.data.status == 6)) {
@ -182,8 +181,6 @@ export default {
getPracticalQuestion(this.$route.query.raceId).then((responese)=>{ getPracticalQuestion(this.$route.query.raceId).then((responese)=>{
if (responese.data) { if (responese.data) {
participantCreatTrainingRoom(this.$route.query.raceId, {mapId: 41, prdType: '02'}).then(resp => { participantCreatTrainingRoom(this.$route.query.raceId, {mapId: 41, prdType: '02'}).then(resp => {
// const query = { lineCode: '11', mapId: '41', group: resp.data, prdType: '03', raceId: this.$route.query.raceId};
// this.$router.replace({ path: `/displayNew/demon`, query: query});
const query = { lineCode: '11', mapId: '41', group: resp.data, raceId: this.$route.query.raceId}; const query = { lineCode: '11', mapId: '41', group: resp.data, raceId: this.$route.query.raceId};
this.$router.replace({ path: `/jointTrainingNew`, query: query}); this.$router.replace({ path: `/jointTrainingNew`, query: query});
}); });

View File

@ -4,23 +4,19 @@
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span> <span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span>
</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.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.examTime')+':'" prop="detail"> <el-form-item :label="this.$t('exam.examTime')+':'" prop="detail">
<span>{{ Math.ceil((resultModel.usedTime || 0)/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="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod"> <el-table :data="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod">
<el-table-column prop="title" label="题数"> <el-table-column prop="title" label="题目" />
<template slot-scope="scope"> <el-table-column prop="score" label="分值" />
<span>{{ '第'+scope.row.title + '题' }}</span> <el-table-column prop="goal" label="得分" />
</template> <el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="答题结果" />
</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 ==='theory'" prop="explain" label="说明" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点"> <el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点">
<template slot-scope="scope"> <template slot-scope="scope">
@ -40,6 +36,7 @@
<script> <script>
// import { submitExam } from '@/api/management/userexam'; // import { submitExam } from '@/api/management/userexam';
// import { UrlConfig } from '@/scripts/ConstDic'; // import { UrlConfig } from '@/scripts/ConstDic';
import { getCompetitionDetail } from '@/api/competition';
export default { export default {
name: 'ExamResult', name: 'ExamResult',
@ -76,11 +73,11 @@ export default {
return this.$store.state.app.height - 50; return this.$store.state.app.height - 50;
} }
}, },
mounted() { created() {
this.submitExamData(); this.submitExamData();
}, },
methods: { methods: {
getSummaries(param) { getSummaries(param) { //
const { columns, data } = param; const { columns, data } = param;
const sums = []; const sums = [];
columns.forEach((column, index) => { columns.forEach((column, index) => {
@ -109,9 +106,21 @@ export default {
}, },
submitExamData() { submitExamData() {
this.loading = false; this.loading = false;
if (this.$route.query.type === 'theory') { if (this.$route.query.type == 'theory') {
this.tableData = this.theoryData; getCompetitionDetail(this.$route.query.raceId).then(res => {
} else if (this.$route.query.type === 'operate') { console.log(res);
this.tableData = [];
res.data.forEach(item => {
this.tableData.push({
title: item.topic,
score: item.totalScore,
goal: item.score,
correctAnswer: item.correct ? '正确' : '错误',
explain: item.remarks
});
});
});
} else if (this.$route.query.type == 'operate') {
this.tableData = []; this.tableData = [];
this.operateData.forEach(item => { this.operateData.forEach(item => {
if (item.scoringPoints && item.scoringPoints.length) { if (item.scoringPoints && item.scoringPoints.length) {

View File

@ -26,7 +26,7 @@
// 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 {postCompetitionTheory} from '@/api/competition'; import { postCompetitionTheory, getTheoryQuestion } from '@/api/competition';
export default { export default {
components: { components: {
@ -48,26 +48,8 @@ export default {
totalScore: 0, totalScore: 0,
passScore: 10 passScore: 10
}, },
examQuestions: [ examQuestions: [],
{ theoryAnswers: []
topic: 'PH玻璃电极只能在5~60℃范围内使用而且还应通过温度校正装置来消除影响。',
type: 'judge',
optionList: [
{id: '160', content: '√', correct: true},
{id: '161', content: '×', correct: false}
]
},
{
topic: '调度工作是( ___ )工作中的一个重要组成部分。',
type: 'select',
optionList: [
{id: '40', content: '<span style="color: windowtext;">煤矿管理</span>', correct: false},
{id: '41', content: '<span style="color: windowtext;">企业管理</span>', correct: true},
{id: '42', content: '<span style="color: windowtext;">安全生产</span>', correct: false},
{id: '43', content: '<span style="color: windowtext;">生产组织</span>', correct: false}
]
}
]
}; };
}, },
computed: { computed: {
@ -106,18 +88,15 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
console.log('获取试题详情'); this.theoryAnswers = [];
// getExamInfo(this.examId).then(resp => { getTheoryQuestion(this.$route.query.raceId).then((resp)=>{
// this.formModel = resp.data; if (resp.data) {
// getUserExam(this.userExamId).then(rest => { this.examQuestions = resp.data.questions.map((el, i) => {
// this.examQuestions = rest.data.map((el, i) => { el.index = i;
// el.index = i; return el;
// return el; });
// }); }
// }); }).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
// }).catch(error => {
// this.$message.error(`${error.message}`);
// });
}, },
resizeHandler() { resizeHandler() {
this.height = this._clientHeight; this.height = this._clientHeight;
@ -154,15 +133,20 @@ export default {
} }
}, },
doEnd() { doEnd() {
// console.log(''); const params = {
// this.$router.push({ path: `/jsxt/home`}); competitionId: this.$route.query.raceId,
const params = {competitionId:this.$route.query.raceId}; theoryAnswers: this.theoryAnswers
postCompetitionTheory(1, params).then(()=>{ };
postCompetitionTheory(params).then(()=>{
this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } }); this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } });
}); });
}, },
onSave(data) { onSave(data) {
console.log(data, '问答题'); // console.log(data, '');
this.theoryAnswers.push({
answerOptionId: data.answer,
questionId: data.userExamQuestionId
});
} }
} }
}; };

View File

@ -113,7 +113,7 @@ export default {
} }
], ],
actions: [ actions: [
{ text: '导入试题', handler: this.handleAdd } { text: '导入试题', handler: this.handleAdd, fileType: 'file' }
] ]
}, },
isLeaving:false, isLeaving:false,
@ -149,10 +149,31 @@ export default {
}); });
}, },
handleAdd() { handleAdd() {
loadingPaper(this.$route.query.raceId, {}).then((response)=>{ const loading = this.$loading({
this.$message('试题加载成功'); lock: true,
}).catch(()=>{ text: '正在导入中...',
this.$message('试题加载失败'); spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
const obj = document.getElementById('queryFormFilesInput');
if (!obj.files) return;
const f = obj.files[0];
const reader = new FileReader();
const that = this;
reader.readAsText(f, 'utf-8');
reader.onload = function(e) {
const data = e.target.result;
console.log(JSON.parse(data));
loadingPaper(that.$route.query.raceId, JSON.parse(data)).then(res => {
that.$message.success('试题加载成功');
loading.close();
}).catch(error => {
loading.close();
that.$message.error('试题加载失败' + error.message);
});
obj.value = '';
};
}); });
}, },
// //