竞赛代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-22 20:46:03 +08:00
parent c00e502320
commit 0f3520a8e3
4 changed files with 43 additions and 9 deletions

View File

@ -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'
});
}

View File

@ -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});
}
}

View File

@ -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});
});
});
}
}

View File

@ -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, '问答题');