代码调整

This commit is contained in:
joylink_cuiweidong 2022-11-01 17:31:49 +08:00
parent 071143992e
commit 49d15b50a1
8 changed files with 49 additions and 24 deletions

View File

@ -29,7 +29,6 @@ class Handler {
if (operation.start === true) {
this.clear();
}
this.operations.push(operation);
}

View File

@ -244,10 +244,10 @@ function handle(state, data) {
case 'SIMULATION_RAIL_TICKET':
state.ticketInfo = msg;
break;
// 实训提示消息
case 'Simulation_Training_Step_Tip':
state.trainingStepTip = msg;
break;
// // 实训提示消息
// case 'Simulation_Training_Step_Tip':
// state.trainingStepTip = msg;
// break;
case 'Simulation_Training_Finish':
state.trainingOverCount++;
break;

View File

@ -1,4 +1,5 @@
import { setLocalStorage } from '@/utils/auth';
import { addTrainingNew } from '../../api/jmap/training';
const training = {
namespaced: true,
state: {
@ -10,7 +11,7 @@ const training = {
sceneOperate: null,
stepOrder: 0,
operateOrder: 0,
stepOverCount: 0,
// stepOverCount: 0,
trainingScore: ''
},
getters: {
@ -29,9 +30,9 @@ const training = {
stepOrder: (state) => {
return state.stepOrder;
},
stepOverCount: (state) => {
return state.stepOverCount;
},
// stepOverCount: (state) => {
// return state.stepOverCount;
// },
trainingScore: (state) => {
return state.trainingScore;
},
@ -72,9 +73,9 @@ const training = {
state.operateOrder = 0;
setLocalStorage('operateOrder', JSON.stringify(state.operateOrder));
},
stepOverCountChange: (state) => {
state.stepOverCount++;
},
// stepOverCountChange: (state) => {
// state.stepOverCount++;
// },
clearStepOverCount: (state) => {
state.clearStepOverCount = 0;
},
@ -132,7 +133,10 @@ const training = {
const index = state.stepOrder > 0 ? state.stepOrder - 1 : 0;
const step = stepList[index];
if (valid && step.operations.length === (state.operateOrder + 1 )) {
commit('stepOverCountChange');
// commit('stepOverCountChange');
// commit('stepOrderIncrease');
// debugger;
state.operateOrder = 0;
} else if (valid) {
commit('operateOrderIncrease');
} else {

View File

@ -174,10 +174,10 @@ function handle(data) {
case 'SIMULATION_RAIL_TICKET':
store.dispatch('socket/setTicketInfo', msg);
break;
// 实训提示消息
case 'Simulation_Training_Step_Tip':
store.dispatch('socket/setTrainingStepTip', msg);
break;
// // 实训提示消息
// case 'Simulation_Training_Step_Tip':
// store.dispatch('socket/setTrainingStepTip', msg);
// break;
case 'Simulation_Training_Finish':
store.dispatch('socket/trainingOverCountIncrease');
break;

View File

@ -135,11 +135,11 @@ export default {
},
nextStep() {
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
const step = stepList[this.$store.state.trainingNew.stepOrder - 1];
endTrainingStep(this.group, step.id).then(resp => {
}).catch(() => {
this.$message.error('进入下一步实训失败!');
});
// const step = stepList[this.$store.state.trainingNew.stepOrder - 1];
// endTrainingStep(this.group, step.id).then(resp => {
// }).catch(() => {
// this.$message.error('');
// });
},
handlerEnd() {
endTraining(this.group).then((resp) => {

View File

@ -102,7 +102,20 @@ export default {
return this.$store.state.trainingNew.teachMode;
}
},
watch: {},
watch: {
'$store.state.trainingNew.stepOrder': function(val) {
debugger;
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
if (val < stepList.length) {
const msg = {content:stepList[val - 1].description, memberId:stepList[val - 1].memberId};
this.$store.dispatch('socket/setTrainingStepTip', msg);
} else {
this.$store.dispatch('socket/setTrainingStepTip', null);
this.$store.dispatch('trainingNew/clearStepOrder');
}
// operateOrder;
}
},
mounted() {
this.loadInitData();
},
@ -139,6 +152,9 @@ export default {
startTraining(this.group, {mode: this.demoMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
this.$store.dispatch('trainingNew/setTrainingScore', '');
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
const msg = {content:stepList[0].description, memberId:stepList[0].memberId};
this.$store.dispatch('socket/setTrainingStepTip', msg);
}).catch(() => {
this.$message.error('开始实训失败!');
});

View File

@ -61,6 +61,12 @@ export default {
this.popShow = false;
this.tipShow = false;
this.position = { x: 0, y: 0 };
},
'$store.state.training.tipEvent': function (val) {
setTimeout(() => { this.tipInit(); }, 300);
this.$nextTick(function() {
this.tipInit();
});
}
},
methods: {

View File

@ -1,7 +1,7 @@
<template>
<el-tabs v-model="activeName" style="height: 100%;margin: 10px;" type="border-card">
<el-tab-pane label="仿真系统" name="first" style="height: 100%;">
<div style="display: flex;flex-wrap:wrap; justify-content:center;height: 100%;overflow-y: auto;">
<div style="display: flex;flex-wrap:wrap; justify-content:center;height: 100%;overflow-y: auto;padding-bottom:30px">
<template v-for="system in systemList">
<el-card :key="system.id" class="box-card">
<div style="text-align: center;font-size: 26px;font-weight: bolder;color: #0C161A;">{{ system.name }}</div>