竞赛平台代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-28 15:28:18 +08:00
parent 652e9aa5d7
commit c502d755f9
3 changed files with 19 additions and 2 deletions

View File

@ -146,3 +146,12 @@ export function getRaceById(id) {
method: 'get' method: 'get'
}); });
} }
/** 退出当前赛场 */
export function quitCurrentRace(id, params) {
return request({
url: `/api/v1/competition/${id}/room`,
method: 'delete',
params
});
}

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, getTheoryQuestion } from '@/api/competition'; import { postCompetitionTheory, getTheoryQuestion, quitCurrentRace } from '@/api/competition';
export default { export default {
components: { components: {
@ -86,6 +86,10 @@ export default {
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
beforeDestroy() {
quitCurrentRace(this.$route.query.raceId, {}).then(res=>{
});
},
methods: { methods: {
loadInitData() { loadInitData() {
this.theoryAnswers = []; this.theoryAnswers = [];

View File

@ -34,7 +34,7 @@ import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import RealDevice from './menuDraft/realDevice'; import RealDevice from './menuDraft/realDevice';
import { participantCompleteCompetition, refereeExitSimulation } from '@/api/competition'; import { participantCompleteCompetition, refereeExitSimulation, quitCurrentRace } from '@/api/competition';
import { prefixIntrger } from '@/utils/date'; import { prefixIntrger } from '@/utils/date';
export default { export default {
@ -146,6 +146,10 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('training/setGroup', ''); this.$store.dispatch('training/setGroup', '');
if (this.project === 'jsxt') {
quitCurrentRace(this.$route.query.raceId, {group:this.group}).then(res=>{
});
}
}, },
methods: { methods: {
async initLoadPage() { async initLoadPage() {