调整参赛人员路由判断

This commit is contained in:
zyy 2020-05-25 18:26:05 +08:00
parent ef9dc7c25e
commit dc33306c96
3 changed files with 47 additions and 33 deletions

View File

@ -75,7 +75,7 @@ export function getIsSignUp(raceId, params = {}) {
/** 分页查询竞赛报名人员 */ /** 分页查询竞赛报名人员 */
export function getRaceUserList(params) { export function getRaceUserList(params) {
return request({ return request({
url: `/api/race/${params.raceId}/raceUser`, url: `/api/race/${params.raceId}/raceUser/page`,
method: 'get', method: 'get',
params params
}); });
@ -108,9 +108,9 @@ export function getCompetitionPractical(competitionId) {
} }
/** 查询竞赛报名人员详情 */ /** 查询竞赛报名人员详情 */
export function getRaceUserById(raceId, userId) { export function getRaceUserById(raceId) {
return request({ return request({
url: `/api/race/${raceId}/raceUser/${userId}`, url: `/api/race/${raceId}/raceUser`,
method: 'get' method: 'get'
}); });
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="joylink-card"> <div class="joylink-card">
<b class="title-name">{{ examType }}</b> <b class="title-name">{{ examType }}</b>
<img class="img_box" :src="applyImg" alt=""> <!-- <img class="img_box" :src="applyImg" alt=""> -->
<div class="btn-start"> <div class="btn-start">
<el-button :disabled="disabled" type="primary" @click="exmaStart">{{ $t('exam.startTheExam') }}</el-button> <el-button :disabled="disabled" type="primary" @click="exmaStart">{{ $t('exam.startTheExam') }}</el-button>
</div> </div>
@ -15,15 +15,16 @@ import LangStorage from '@/utils/lang';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import CMD from '@/scripts/cmdPlugin/CommandEnum'; import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { participantCreatTrainingRoom, getCompetitionPractical, getPracticalQuestion, getTheoryQuestion } from '@/api/competition'; import {getRaceUserById} from '@/api/competition';
import applyImg from '@/assets/apply.png'; import { participantCreatTrainingRoom, getPracticalQuestion, getTheoryQuestion } from '@/api/competition';
// import applyImg from '@/assets/apply.png';
export default { export default {
name: 'ExamDetailView', name: 'ExamDetailView',
data() { data() {
return { return {
disabled: false, disabled: false,
applyImg: applyImg, // applyImg: applyImg,
examDetails: { examDetails: {
lessonId: '', lessonId: '',
name: '', name: '',
@ -150,6 +151,8 @@ export default {
}, },
async exmaStart() { async exmaStart() {
if (this.$route.query.type == 'theory') { if (this.$route.query.type == 'theory') {
const res = await getRaceUserById(this.$route.query.raceId);
if (res.data.status != 4 || res.data.status != 5) {
getTheoryQuestion(this.$route.query.raceId).then((resp)=>{ getTheoryQuestion(this.$route.query.raceId).then((resp)=>{
if (resp.data) { if (resp.data) {
this.$router.push(`/jsxt/theory/detail/${this.$route.query.mapId}?raceId=${this.$route.query.raceId}`); this.$router.push(`/jsxt/theory/detail/${this.$route.query.mapId}?raceId=${this.$route.query.raceId}`);
@ -160,6 +163,11 @@ export default {
}).catch(()=>{ }).catch(()=>{
}); });
} else { } else {
this.$router.replace({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } });
}
} else {
const res = await getRaceUserById(this.$route.query.raceId);
if (res.data.status != 4 || res.data.status != 6) {
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 => {
@ -171,8 +179,10 @@ export default {
} else { } else {
this.$messageBox('试卷还没被加载'); this.$messageBox('试卷还没被加载');
} }
}); });
} else {
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate', raceId:this.$route.query.raceId } });
}
} }
} }
} }
@ -196,11 +206,15 @@ export default {
height: 100%; height: 100%;
} }
.title-name{ .title-name{
position: absolute; // position: absolute;
left: 50%; // left: 50%;
top: 66px; // top: 66px;
transform: translateX(-80px); // transform: translateX(-80px);
font-size: 30px; font-size: 30px;
text-align: center;
width: 100%;
margin-top: 50px;
display: block;
} }
} }
.img_box{ .img_box{

View File

@ -365,7 +365,7 @@ export default {
// 01 02 '' // 01 02 ''
let resp = {data: {}}; let resp = {data: {}};
if (this.project == 'jsxt' ) { if (this.project == 'jsxt' ) {
resp = await getRaceUserById(this.$route.query.raceId, this.userId); resp = await getRaceUserById(this.$route.query.raceId);
resp.data.userRole = resp.data.role; resp.data.userRole = resp.data.role;
} else if (this.project == 'refereeJsxt') { } else if (this.project == 'refereeJsxt') {
resp['code'] = 200; resp['code'] = 200;