From 0f3520a8e3c6f0d3bf792ba26f952ba4002360c7 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Fri, 22 May 2020 20:46:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/competition.js | 26 +++++++++++++++++++ src/views/jsxt/competition/demonList.vue | 6 ++--- src/views/jsxt/competition/examDetail.vue | 15 +++++++---- .../jsxt/competition/theory/quiz/index.vue | 5 +++- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/api/competition.js b/src/api/competition.js index a2a656a9f..1e81796d6 100644 --- a/src/api/competition.js +++ b/src/api/competition.js @@ -80,3 +80,29 @@ export function getRaceUserList(params) { }); } +/** 分页查询理论题列表 */ +export function getCompetitionTheory(params) { + return request({ + url: `/api/v1/competitionTheory`, + method: 'get', + params + }); +} + +/** 提交试卷 */ +export function postCompetitionTheory(theoryId, data) { + return request({ + url: `/api/v1/competitionTheory/${theoryId}/submit`, + method: 'post', + data + }); +} + +/** 查询用户是否已经报名该竞赛 */ +export function getCompetitionPractical(competitionId) { + return request({ + url: `/api/v1/competitionPractical/competition/${competitionId}`, + method: 'get' + }); +} + diff --git a/src/views/jsxt/competition/demonList.vue b/src/views/jsxt/competition/demonList.vue index c0ce2d471..790fc26b8 100644 --- a/src/views/jsxt/competition/demonList.vue +++ b/src/views/jsxt/competition/demonList.vue @@ -70,12 +70,12 @@ export default { clickEvent(obj, data, ele) { if (obj.type === 'Map') { this.mapId = obj.id; - this.$router.push({ path: `/jsxt/home`}); + this.$router.push({ path: `/jsxt/home`, query:{raceId:this.$route.query.raceId}}); } else if (obj.type === 'theory') { - const query = {type: 'theory', mapId: this.mapId}; + const query = {type: 'theory', mapId: this.mapId, raceId:this.$route.query.raceId}; this.$router.push({path: `/jsxt/examDetail`, query: query}); } else if (obj.type === 'operation') { - const query = {type: 'operation', mapId: this.mapId}; + const query = {type: 'operation', mapId: this.mapId, raceId:this.$route.query.raceId}; this.$router.push({path: `/jsxt/examDetail`, query: query}); } } diff --git a/src/views/jsxt/competition/examDetail.vue b/src/views/jsxt/competition/examDetail.vue index 7b7dea5dd..58bd26796 100644 --- a/src/views/jsxt/competition/examDetail.vue +++ b/src/views/jsxt/competition/examDetail.vue @@ -15,7 +15,7 @@ import LangStorage from '@/utils/lang'; import { getPublishMapInfo } from '@/api/jmap/map'; import ConstConfig from '@/scripts/ConstConfig'; import CMD from '@/scripts/cmdPlugin/CommandEnum'; -import { participantCreatTrainingRoom } from '@/api/competition'; +import { participantCreatTrainingRoom, getCompetitionTheory, getCompetitionPractical } from '@/api/competition'; import applyImg from '@/assets/apply.png'; export default { @@ -150,12 +150,17 @@ export default { }, async exmaStart() { if (this.$route.query.type == 'theory') { - this.$router.push(`/jsxt/theory/detail/${this.$route.query.mapId}`); + getCompetitionTheory({competitionId:this.$route.query.raceId}).then(()=>{ + this.$router.push(`/jsxt/theory/detail/${this.$route.query.mapId}`); + }).catch(()=>{ + }); } else { // this.disabled = true; - participantCreatTrainingRoom(1, {mapId: 41, prdType: '02'}).then(resp => { - const query = { lineCode: '11', mapId: '41', group: resp.data, roomId: '385' }; - this.$router.replace({ path: `/jointTrainingNew`, query: query}); + getCompetitionPractical(this.$route.query.raceId).then(()=>{ + participantCreatTrainingRoom(1, {mapId: 41, prdType: '02'}).then(resp => { + const query = { lineCode: '11', mapId: '41', group: resp.data, roomId: '385' }; + this.$router.replace({ path: `/jointTrainingNew`, query: query}); + }); }); } } diff --git a/src/views/jsxt/competition/theory/quiz/index.vue b/src/views/jsxt/competition/theory/quiz/index.vue index 1ea042322..647ec6b6e 100644 --- a/src/views/jsxt/competition/theory/quiz/index.vue +++ b/src/views/jsxt/competition/theory/quiz/index.vue @@ -26,6 +26,7 @@ // import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js'; // import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import Question from './question'; +import {postCompetitionTheory} from '@/api/competition'; export default { components: { @@ -155,7 +156,9 @@ export default { doEnd() { // console.log('考试成绩'); // this.$router.push({ path: `/jsxt/home`}); - this.$router.push({ path: `/jsxt/result`, query: { type: 'theory' } }); + postCompetitionTheory(1, {competitionId:this.$route.query.raceId}).then(()=>{ + this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } }); + }); }, onSave(data) { console.log(data, '问答题');