实操竞赛比赛计时&题目展示&结果展示

This commit is contained in:
fan 2020-06-05 09:38:14 +08:00
parent 554cef84f2
commit 6dfbe18485
6 changed files with 211 additions and 41 deletions

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -50,7 +50,7 @@ export default {
this.$router.replace({ path: `/jsxt/theory/result?raceId=${this.$route.query.raceId}` });
} else if (this.$route.query.type == 'operation' && (res.data.status == 4 || res.data.status == 6)) {
// this.resultFlag = true;
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate', raceId:this.$route.query.raceId } });
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;
}

View File

@ -4,7 +4,7 @@
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span>
</div>
<div class="context">
<div>{{ `得分:${operateScore}` }}</div>
<!--<div>{{ `得分:${operateScoreData}` }}</div>-->
<!-- <el-form ref="form" :model="resultModel" size="mini">
<el-form-item :label="this.$t('exam.testScores')+':'" prop="score">
<span>{{ resultModel.score + ' '+ $t('exam.points') }}</span>
@ -13,25 +13,22 @@
<span>{{ Math.ceil((resultModel.usedTime || 0)/60) + ' '+ $t('global.minutes') }}</span>
</el-form-item>
</el-form> -->
<!--<el-table :data="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod">-->
<!--<el-table-column prop="title" label="题目">-->
<!--<template slot-scope="scope">-->
<!--<div v-html="scope.row.title" />-->
<!--</template>-->
<!--</el-table-column>>-->
<!--<el-table-column prop="score" label="分值" />-->
<!--<el-table-column prop="goal" label="得分" />-->
<!--<el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="答题结果" />-->
<!--<el-table-column v-if="this.$route.query.type ==='theory'" prop="explain" label="说明" />-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点">-->
<!--<template slot-scope="scope">-->
<!--<span>{{ '得分点'+scope.row.scoringPointIndex }}</span>-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointScore" label="得分点分值" />-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointGoal" label="得分点得分" />-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointExplain" label="得分点说明" />-->
<!--</el-table>-->
<el-table :data="operateScoreData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary>
<el-table-column prop="name" label="题目" />
<el-table-column prop="description" label="描述" />
<el-table-column prop="totalScore" label="分值" />
<el-table-column prop="score" label="得分" />
<!--<el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="答题结果" />-->
<!--<el-table-column v-if="this.$route.query.type ==='theory'" prop="explain" label="说明" />-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点">-->
<!--<template slot-scope="scope">-->
<!--<span>{{ '得分点'+scope.row.scoringPointIndex }}</span>-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointScore" label="得分点分值" />-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointGoal" label="得分点得分" />-->
<!--<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointExplain" label="得分点说明" />-->
</el-table>
</div>
<div class="draf_box">
<el-button type="primary " @click="back">返回首页</el-button>
@ -71,7 +68,7 @@ export default {
],
loading: true,
tableData: [],
operateScore: 0
operateScoreData: []
};
},
computed: {
@ -91,7 +88,7 @@ export default {
sums[index] = this.$t('exam.totalScore');
return;
}
if (column.property === 'score' || column.property === 'goal' || column.property === 'scoringPointScore' || column.property === 'scoringPointGoal') {
if (column.property === 'score' || column.property === 'totalScore') {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
@ -128,7 +125,7 @@ export default {
} else if (this.$route.query.type == 'operate') {
this.tableData = [];
getPracticalCompetitionResult(this.$route.query.raceId).then(res => {
this.operateScore = res.data;
this.operateScoreData = res.data;
});
// this.operateData.forEach(item => {
// if (item.scoringPoints && item.scoringPoints.length) {

View File

@ -7,7 +7,18 @@
<transition name="el-zoom-in-bottom">
<map-system-draft ref="mapCanvas" @back="back" />
</transition>
<menu-demon-joint ref="demonMenu" :group="group" :data-error="dataError" :user-role="userRole" :device-code="deviceCode" @getUserRole="getUserRole" @hidepanel="hidepanel" @showIbp="showIbp" />
<menu-demon-joint
ref="demonMenu"
:group="group"
:data-error="dataError"
:user-role="userRole"
:device-code="deviceCode"
:countdown-time="countdownTime"
@getUserRole="getUserRole"
@hidepanel="hidepanel"
@showIbp="showIbp"
@startCounting="startCounting"
/>
<menu-demon-schema
ref="menuSchema"
:group="group"
@ -27,6 +38,7 @@
<join-run-plan-view ref="runPlanView" :group="group" />
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" :right="right" />
<menu-train-list v-if="prdType=='02'" @setCenter="setCenter" />
<js-question v-if="project==='jsxt'" :offset="offset" :question-list="questionList" />
</div>
</div>
@ -36,6 +48,7 @@
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemonJoint from './menuDemon';
import MenuDemonSchema from './menuSchema';
import JsQuestion from './jsQuestion';
import JoinFaultChoose from '@/views/newMap/displayNew/demon/faultChoose';
import JoinRunPlanLoad from '@/views/newMap/displayNew/demon/runPlanLoad';
import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
@ -48,7 +61,7 @@ import { checkLoginLine } from '@/api/login';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { getUserRolesNew, deljointTrainRoomNew} from '@/api/jointTraining';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import {getRaceUserById} from '@/api/competition';
import {getRaceUserById, getTestPaperDatail} from '@/api/competition';
import { getSessionStorage } from '@/utils/auth';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import Jl3dMaintainer from '@/views/jlmap3d/maintainer/jl3dmaintainer';
@ -57,6 +70,7 @@ import ibpData from '@/ibp/constant/ibpData';
import { timeFormat } from '@/utils/date';
import { Message } from 'element-ui';
import Vue from 'vue';
import localStore from 'storejs';
export default {
name: 'JointTrainingDraft',
@ -71,7 +85,8 @@ export default {
menuSystemTime,
Jl3dDrive,
Jl3dMaintainer,
IbpPlate
IbpPlate,
JsQuestion
},
data() {
return {
@ -98,7 +113,11 @@ export default {
stationList: [],
showSelectStation: false,
mapViewLoadedOver: false,
dataError: false
dataError: false,
countdownTime: '00:00:00',
practicalTime: 0,
countdown: null,
questionList: []
};
},
computed: {
@ -209,6 +228,9 @@ export default {
await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear');
await this.$store.dispatch('training/setGroup', '');
if (this.countdown) {
clearInterval(this.countdown);
}
Message.closeAll();
},
methods: {
@ -367,6 +389,24 @@ export default {
if (this.project == 'jsxt' ) {
resp = await getRaceUserById(this.$route.query.raceId);
resp.data.userRole = resp.data.role;
const paperResp = await getTestPaperDatail(this.$route.query.raceId);
if (paperResp.data && paperResp.data.practicalQuestions) {
this.questionList = [];
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
const startTime = localStore.get(storeKey);
if (startTime) {
const dt = new Date().getTime() - startTime;
this.practicalTime = paperResp.data.practicalExamTime * 60 - Math.floor(dt / 1000);
} else {
this.practicalTime = paperResp.data.practicalExamTime * 60;
const storeValue = new Date().getTime();
localStore.set(storeKey, storeValue);
}
this.countdownTime = this.computationTime(this.practicalTime);
paperResp.data.practicalQuestions.forEach(elem => {
this.questionList.push({name: elem.question.name, description:elem.question.description});
});
}
} else if (this.project == 'refereeJsxt') {
resp['code'] = 200;
resp.data['userRole'] = 'ADMIN';
@ -395,6 +435,18 @@ export default {
this.endViewLoading();
}
},
startCounting() {
this.countdown = setInterval(() => {
if (this.practicalTime <= 0) {
if (this.countdown) {
clearInterval(this.countdown);
}
this.$refs.demonMenu.submit();
}
this.practicalTime--;
this.countdownTime = this.computationTime(this.practicalTime);
}, 1000);
},
async getTrainDetail() {
try {
await loadNewMapDataByGroup(this.group);
@ -419,6 +471,28 @@ export default {
faultChooseShow() {
this.$refs.faultChoose.doShow();
},
computationTime(time) {
let hours = Math.floor(time / 3600);
const newTime = time % 3600;
let minutes = Math.floor(newTime / 60) + '';
let seconds = newTime % 60;
if (hours < 0) {
hours = '00';
} else if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 0) {
minutes = '00';
} else if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 0) {
seconds = '00';
} else if (seconds < 10) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
},
showdriving() {
this.panelShow = true;
this.drivingShow = false;

View File

@ -0,0 +1,94 @@
<template>
<div class="menuTrainListOut" :style="{top: offset-5 +'px'}">
<div v-if="drawer" class="menuTrainListContent">
<div>
<div v-for="(item, index) in questionList" :key="index">
<div style="text-align: center;font-size: 16px;">{{ item.name }}</div>
<div style="text-align: left;font-size: 14px;margin-top: 5px;">{{ '描述:'+item.description }}</div>
</div>
</div>
<div class="menuTrainListBtn1In" style=";position: absolute; top: 98%;left:150px;z-index: 2;" @click="clickBtn">
<i class="el-icon-more" style="font-size: 20px;transform-origin: 50% 50%;" />
</div>
</div>
<div v-else class="menuTrainListBtn1" @click="clickBtn">
<div class="menuTrainListBtn1In">
<i class="el-icon-more" style="font-size: 20px;transform-origin: 50% 50%;" />
</div>
</div>
</div>
</template>
<script>
export default {
name: 'JsQuestion',
props: {
offset: {
type: Number,
required: true
},
questionList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
drawer: true
};
},
methods: {
clickBtn() {
this.drawer = !this.drawer;
}
}
};
</script>
<style lang="scss" scoped>
.menuTrainListBtn1In{
width: 40px;
height: 20px;
background: #fff;
text-align: center;
border-radius: 0 0 6px 6px;
cursor:pointer;
/*border: 1px #adadad solid;*/
}
.menuTrainListBtn1{
position: absolute;
}
.menuTrainListContent{
background: #fff;
text-align: center;
border-radius:0 0 6px 6px;
padding: 10px;
position: absolute;
width: 350px;
left: -150px;
z-index: 3;
cursor:pointer;
}
.menuTrainListOut{
position: absolute;
right: 30%;
height: 70%;
}
.menuTrainList{
width: 400px;
height:100%;
border-radius: 10px 0px 0px 10px;
// padding: 5px;
background: #fff;
}
.topTrainListInfo,.bottomTrainListInfo{
padding: 10px 10px;
background: #cde2ef;
font-size: 13px;
border-radius: 5px 0px 0px 0px;
}
</style>

View File

@ -12,6 +12,7 @@
<!-- <el-button type="primary" :loading="backLoading" @click="back">{{ $t('global.back') }}</el-button> -->
</el-button-group>
<template v-if="project==='jsxt'">
<div style="background: #FFF;display: inline-block;height: 40px;line-height: 40px;padding: 0 5px;border: 2px solid #F00;border-radius: 6px;margin-right: 8px;">{{ '剩余时间:'+countdownTime }}</div>
<el-button :disabled="!jsStart" type="success" @click="startCompetition">开始</el-button>
<el-button :disabled="jsStart" type="danger" @click="endCompetition">提交</el-button>
</template>
@ -34,8 +35,9 @@ import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { EventBus } from '@/scripts/event-bus';
import { getSessionStorage } from '@/utils/auth';
import RealDevice from './menuDraft/realDevice';
import { participantCompleteCompetition, refereeExitSimulation, quitCurrentRace, startPracticalCompetition, submitPracticalCompetition } from '@/api/competition';
import { refereeExitSimulation, quitCurrentRace, startPracticalCompetition, submitPracticalCompetition } from '@/api/competition';
import { prefixIntrger } from '@/utils/date';
import localStore from 'storejs';
export default {
name: 'MenuDemonJoint',
@ -56,6 +58,10 @@ export default {
type: String,
required: true
},
countdownTime: {
type: String,
required: true
},
deviceCode: {
type: String,
default() {
@ -315,6 +321,7 @@ export default {
},
startCompetition() {
startPracticalCompetition(this.group, this.$route.query.raceId).then(resp => {
this.$emit('startCounting');
this.jsStart = false;
}).catch(()=> {
this.$message.error('开始竞赛失败');
@ -326,12 +333,7 @@ export default {
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
submitPracticalCompetition(this.group, this.$route.query.raceId).then(resp => {
// this.$router.go(-1);
this.submit();
}).catch(()=> {
this.$message.error('提交试卷失败!');
});
this.submit();
});
},
refeeEndCompetition() {
@ -343,10 +345,13 @@ export default {
});
},
submit() {
// this.$store.dispatch('exam/over').then(() => {
// this.$store.dispatch('trainingList/clearTrainingList');
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate', raceId:this.$route.query.raceId } });
// });
submitPracticalCompetition(this.group, this.$route.query.raceId).then(resp => {
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
localStore.remove(storeKey);
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate', raceId:this.$route.query.raceId } });
}).catch(()=> {
this.$message.error('提交试卷失败!');
});
}
}
};