This commit is contained in:
fan 2020-05-28 16:41:04 +08:00
commit 601aed6f5b
7 changed files with 26 additions and 12 deletions

View File

@ -146,3 +146,12 @@ export function getRaceById(id) {
method: 'get' method: 'get'
}); });
} }
/** 退出当前赛场 */
export function quitCurrentRace(id, params) {
return request({
url: `/api/v1/competition/${id}/room`,
method: 'delete',
params
});
}

View File

@ -318,8 +318,7 @@ export default class Station extends Group {
setState(model) { setState(model) {
if (!this.isShowShape) return; if (!this.isShowShape) return;
this.recover(); this.recover();
// model.controlMode && this['handle' + model.controlMode](); model.controlMode && this['handle' + model.controlMode]();
this.handleLocal();
} }
getShapeTipPoint(opts) { getShapeTipPoint(opts) {

View File

@ -147,7 +147,7 @@ export function parser(data, skinCode, showConfig) {
zrUtil.each(data.arrowList || [], elem => { zrUtil.each(data.arrowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Arrow, elem, propConvert, showConfig); mapDevice[elem.code] = createDevice(deviceType.Arrow, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.powerList || [], elem => { zrUtil.each(data.powerLineList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Power, elem, propConvert, showConfig); mapDevice[elem.code] = createDevice(deviceType.Power, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.indicatorLightList || [], elem => { zrUtil.each(data.indicatorLightList || [], elem => {
@ -329,7 +329,7 @@ export function updateMapData(state, model) {
case deviceType.SplitStation: updateForList(model, state, 'splitStationList'); break; case deviceType.SplitStation: updateForList(model, state, 'splitStationList'); break;
case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break; case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Arrow: updateForList(model, state, 'arrowList'); break; case deviceType.Arrow: updateForList(model, state, 'arrowList'); break;
case deviceType.Power: updateForList(model, state, 'powerList'); break; case deviceType.Power: updateForList(model, state, 'powerLineList'); break;
} }
} }
} }

View File

@ -342,9 +342,9 @@ const map = {
return []; return [];
} }
}, },
powerList: (state) => { powerLineList: (state) => {
if (state.map) { if (state.map) {
return state.map.powerList || []; return state.map.powerLineList || [];
} else { } else {
return []; return [];
} }

View File

@ -28,7 +28,7 @@
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js'; // import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
// import WindowResizeHandler from '@/mixin/WindowResizeHandler'; // import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Question from './question'; import Question from './question';
import { postCompetitionTheory, getTheoryQuestion } from '@/api/competition'; import { postCompetitionTheory, getTheoryQuestion, quitCurrentRace } from '@/api/competition';
export default { export default {
components: { components: {
@ -92,6 +92,8 @@ export default {
this.loadInitData(); this.loadInitData();
}, },
beforeDestroy() { beforeDestroy() {
quitCurrentRace(this.$route.query.raceId, {}).then(res=>{
});
if (this.countdown) { if (this.countdown) {
clearInterval(this.countdown); clearInterval(this.countdown);
} }

View File

@ -34,7 +34,7 @@ import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import RealDevice from './menuDraft/realDevice'; import RealDevice from './menuDraft/realDevice';
import { participantCompleteCompetition, refereeExitSimulation } from '@/api/competition'; import { participantCompleteCompetition, refereeExitSimulation, quitCurrentRace } from '@/api/competition';
import { prefixIntrger } from '@/utils/date'; import { prefixIntrger } from '@/utils/date';
export default { export default {
@ -146,6 +146,10 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('training/setGroup', ''); this.$store.dispatch('training/setGroup', '');
if (this.project === 'jsxt') {
quitCurrentRace(this.$route.query.raceId, {group:this.group}).then(res=>{
});
}
}, },
methods: { methods: {
async initLoadPage() { async initLoadPage() {

View File

@ -110,7 +110,7 @@ export default {
editModel: { editModel: {
code: '', code: '',
width: 1, width: 1,
leftTerminal: true, leftTerminal: true, //
rightTerminal: true, rightTerminal: true,
showConditions: '01', // showConditions: '01', //
points: [] points: []
@ -143,7 +143,7 @@ export default {
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'powerList' 'powerLineList'
]), ]),
form() { form() {
const form = { const form = {
@ -156,7 +156,7 @@ export default {
draw: { draw: {
name: this.$t('map.drawData'), name: this.$t('map.drawData'),
item: [ item: [
{ prop: 'code', label: '供电线路', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.powerList, change: true, deviceChange: this.deviceChange }, { prop: 'code', label: '供电线路', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.powerLineList, change: true, deviceChange: this.deviceChange },
{ prop: 'width', label: '供电线路宽度', type: 'number', min: 1, placeholder: 'px' }, { prop: 'width', label: '供电线路宽度', type: 'number', min: 1, placeholder: 'px' },
{ prop: 'showConditions', label: this.$t('map.showConditions'), type: 'radio', optionLabel: 'label', optionValue:'value', radioList: this.showConditionsList}, { prop: 'showConditions', label: this.$t('map.showConditions'), type: 'radio', optionLabel: 'label', optionValue:'value', radioList: this.showConditionsList},
{ prop: 'leftTerminal', label: '左侧端点:', type: 'select', optionLabel: 'label', optionValue:'value', options: this.terminalList}, { prop: 'leftTerminal', label: '左侧端点:', type: 'select', optionLabel: 'label', optionValue:'value', options: this.terminalList},
@ -213,7 +213,7 @@ export default {
const pointArr = JSON.stringify(this.addModel.points); const pointArr = JSON.stringify(this.addModel.points);
const model = { const model = {
_type: 'Power', _type: 'Power',
code: getUID('Power', this.powerList), code: getUID('Power', this.powerLineList),
width: this.addModel.width, width: this.addModel.width,
leftTerminal: true, leftTerminal: true,
rightTerminal: true, rightTerminal: true,