调整竞赛系统逻辑

This commit is contained in:
zyy 2020-05-26 12:11:59 +08:00
parent 7382a0d1e2
commit 83343d54b8

View File

@ -1,10 +1,12 @@
<template>
<div class="joylink-card">
<template v-if="resultFlag">
<b class="title-name">{{ examType }}</b>
<!-- <img class="img_box" :src="applyImg" alt=""> -->
<div class="btn-start">
<el-button :disabled="disabled" type="primary" @click="exmaStart">{{ $t('exam.startTheExam') }}</el-button>
</div>
</template>
</div>
</template>
<script>
@ -41,6 +43,7 @@ export default {
examList: [],
trainingOperateTypeMap: {},
drawWay: false,
resultFlag: false,
lineCode: '' // 线
};
},
@ -55,10 +58,14 @@ export default {
watch: {
'$route.params.examId': function (val) {
this.loadInitPage(val);
},
$route() {
this.getUserStatus();
}
},
async mounted() {
// this.loadInitPage(this.$route.params.examId);
this.getUserStatus();
},
methods: {
async getList() {
@ -149,10 +156,20 @@ export default {
}
}
},
async getUserStatus() {
this.resultFlag = false;
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)) {
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)) {
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate', raceId:this.$route.query.raceId } });
} else {
this.resultFlag = true;
}
},
async exmaStart() {
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)=>{
if (resp.data) {
this.$router.push(`/jsxt/theory/detail/${this.$route.query.mapId}?raceId=${this.$route.query.raceId}`);
@ -160,14 +177,8 @@ export default {
this.$messageBox('试卷还没被加载');
}
}).catch(()=>{
});
}).catch(()=>{});
} 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)=>{
if (responese.data) {
participantCreatTrainingRoom(this.$route.query.raceId, {mapId: 41, prdType: '02'}).then(resp => {
@ -180,9 +191,6 @@ export default {
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 } });
}
}
}
}