This commit is contained in:
fan 2023-05-30 17:54:40 +08:00
parent b863211cca
commit f13252ff27
9 changed files with 67 additions and 19 deletions

View File

@ -265,3 +265,11 @@ export function loadTrainingBg(group, trainingId) {
method: 'post'
});
}
/** 预备开始场景 */
export function prepareScene(group, params) {
return request({
url:`/api/training2Simulation/${group}/prepare/start`,
method: 'post',
params
});
}

View File

@ -83,7 +83,6 @@ class ValidateHandler {
if (stepOperation.val) {
valid = ((operate.val).toString() === stepOperation.val.toString()) && valid;
}
const opParam = operate.param === undefined ? {} : operate.param;
if ((opParam || stepOperation.params) && !opParam.hasOwnProperty('fileBase64Str')) {
valid = this.checkParamConsistent(opParam, stepOperation.params, operate.operation) && valid;
@ -100,7 +99,7 @@ class ValidateHandler {
Handler.judgeIsTextSendOperation();
} else {
store.dispatch('trainingNew/handleStepRecord', { type:'ERROR', stepOperation });
console.error('校验失败;');
console.error('校验失败;', stepOperation, operate);
}
return valid;
}

View File

@ -20,7 +20,8 @@ const training = {
voiceStepList: [], // 实训特殊语音步骤列表
voiceStepIndex: -1,
examSwitch: false, // 考试开始结束标注
stepRecord: [] // 操作记录
stepRecord: [], // 操作记录
joinTrainingInfo: null
},
getters: {
teachMode: (state) => {
@ -125,6 +126,9 @@ const training = {
if (type === 'OVER') {
step.success = true;
}
},
setJoinTrainingInfo: (state, joinTrainingInfo) => {
state.joinTrainingInfo = joinTrainingInfo;
}
},
actions: {
@ -200,7 +204,7 @@ const training = {
},
handleMatchVoice: ({ commit }, info) => {
const stepOperation = Handler.getTrainingOperation();
if (info && info.content === 'true') {
if (info && info.content === 'true' && store.state.training.myMemberId == info.memberId) {
const rightMsg = {errMsg: LangStorage.getLang() === 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green'};
commit('setOperateErrMsg', rightMsg);
if (Handler.isLastOperation()) {
@ -225,6 +229,9 @@ const training = {
},
handleStepRecord: ({ commit }, { type, stepOperation }) => {
commit('handleStepRecord', { type, stepOperation });
},
setJoinTrainingInfo: ({ commit }, joinTrainingInfo ) => {
commit('setJoinTrainingInfo', joinTrainingInfo);
}
}
};

View File

@ -31,7 +31,7 @@ export function handlerUrl() {
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -213,6 +213,16 @@ function handle(data) {
case 'Simulation_Control_Transfer_Result':
store.dispatch('socket/setControlTransfer', msg);
break;
case 'Simulation_Training_Prepare_Start': // 仿真预加载
store.dispatch('trainingNew/setJoinTrainingInfo', msg);
break;
case 'Simulation_Training_Status': // 仿真实训开始结束状态
if (msg == 1) {
store.dispatch('trainingNew/trainingStart');
} else {
store.dispatch('trainingNew/trainingEnd');
}
break;
}
}
// 仿真内部聊天

View File

@ -111,7 +111,7 @@ export default {
submitAnswer(postData).then(resp => {
this.$set(this.questionStateList[1], this.currentQuestionIndex, true);
this.$store.dispatch('trainingNew/trainingEnd');
// this.$store.dispatch('trainingNew/trainingEnd');
}).catch(() => {
this.$message.error('记录数据失败!');
});

View File

@ -8,7 +8,7 @@
center
>
<template v-for="user in userList">
<div :key="user.id" style="display: flex;justify-content: space-between;">
<div :key="user.id" style="display: flex;justify-content: space-between;margin-bottom: 10px;">
<div>{{ user.nickName }}</div>
<el-select v-model="user.memberId" size="mini" placeholder="请选择">
<el-option

View File

@ -4,9 +4,9 @@
<div ref="drapBox" class="reminder-box">
<div class="tip-title">
<div style="display: flex;justify-content: center;align-items: center;">
<i v-if="!trainingDesign && !examSwitch" class="icon el-icon-document" @click="trainingListShow" />
<i v-show="!isShrink && !trainingSwitch && trainingDetail" class="icon el-icon-video-play" @click="handlerStart" />
<i v-show="!isShrink && trainingSwitch" class="icon el-icon-switch-button" @click="handlerEnd" />
<i v-if="!trainingDesign && !examSwitch && simulationCreator" class="icon el-icon-document" @click="trainingListShow" />
<i v-show="!isShrink && !trainingSwitch && trainingDetail && simulationCreator" class="icon el-icon-video-play" @click="handlerStart" />
<i v-show="!isShrink && trainingSwitch && simulationCreator" class="icon el-icon-switch-button" @click="handlerEnd" />
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
</div>
@ -26,7 +26,7 @@
<p v-if="!examSwitch" class="list-item">
<span class="list-label">实训模式</span>
<span class="list-elem">
<el-radio-group v-model="demoMode" :disabled="trainingSwitch" class="mode" size="small" @change="changeMode">
<el-radio-group v-model="demoMode" :disabled="trainingSwitch || !simulationCreator" class="mode" size="small" @change="changeMode">
<el-radio :label="TrainingMode.TEACH" border>{{ $t('display.lesson.teachingMode') }}</el-radio>
<el-radio :label="TrainingMode.PRACTICE" border>{{ $t('display.lesson.practiceMode') }}</el-radio>
<el-radio :label="TrainingMode.TEST" border>{{ $t('display.lesson.testMode') }}</el-radio>
@ -37,18 +37,18 @@
<span class="list-label" style="vertical-align: top;"> {{ $t('display.training.trainingInstructions') }}</span>
<span class="list-elem elem-span">{{ trainingDetail ?trainingDetail.description:'' }}</span>
</p>
<p class="list-item">
<p v-if="simulationCreator" class="list-item">
<span class="list-label">操作按钮</span>
<span class="list-elem">
<el-button v-if="!trainingSwitch && trainingDetail" size="small" type="success" @click="handlerStart">开始</el-button>
<el-button v-if="trainingSwitch" size="small" type="danger" @click="handlerEnd">结束</el-button>
</span>
</p>
<p v-if="!examSwitch" class="list-item">
<p v-if="!examSwitch && simulationCreator" class="list-item">
<span class="list-label"> </span>
<span class="list-elem elem-span training-box" @click="loadTraining(previousTraining)">{{ previousTraining? previousTraining.name: '' }}</span>
</p>
<p v-if="!examSwitch" class="list-item">
<p v-if="!examSwitch && simulationCreator" class="list-item">
<span class="list-label"> </span>
<span class="list-elem elem-span training-box" @click="loadTraining(nextTraining)">{{ nextTraining? nextTraining.name:'' }}</span>
</p>
@ -68,7 +68,7 @@
<script>
import { ScriptMode } from '@/scripts/ConstDic';
import { startTraining, endTraining, getPublishTrainingDetail, loadPublishTraining } from '@/api/jmap/training';
import { startTraining, endTraining, getPublishTrainingDetail, loadPublishTraining, prepareScene } from '@/api/jmap/training';
import ScenePlayRole from './scenePlayRole';
import TestResult from './testResult';
import { EventBus } from '@/scripts/event-bus';
@ -116,11 +116,25 @@ export default {
},
examSwitch() {
return this.$store.state.trainingNew.examSwitch;
},
simulationCreator() {
return this.$store.state.training.simulationCreator;
}
},
watch: {
'$store.state.trainingNew.trainingDetail': function(val) {
this.initAdjacentTraining();
},
'$store.state.trainingNew.joinTrainingInfo': function(val) {
if (!this.simulationCreator && val && val.id) {
this.loadTraining({ id: val.id });
this.changeMode(val.mode);
}
},
'$store.state.trainingNew.trainingSwitch': function(val) {
if (!val && !this.simulationCreator) {
this.handlerEnd();
}
}
},
mounted() {
@ -159,15 +173,22 @@ export default {
handlerStart() {
Handler.clear();
if (this.trainingDetail.type === 'SCENE' && !this.examSwitch) {
this.$refs.scenePlayRole.doShow();
this.handlePrepareScene();
} else {
this.startTraining();
}
},
handlePrepareScene() {
prepareScene(this.group, {mode: this.demoMode}).then(() => {
this.$refs.scenePlayRole.doShow();
}).catch(() => {
this.$message.error('预开始场景实训失败!');
});
},
startTraining() {
this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode);
startTraining(this.group, {mode: this.demoMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
// this.$store.dispatch('trainingNew/trainingStart');
}).catch(() => {
this.$message.error('开始实训失败!');
});
@ -185,7 +206,7 @@ export default {
if (this.demoMode === ScriptMode.TEST) {
this.$refs.testResult.doShow(resp.data);
}
this.$store.dispatch('trainingNew/trainingEnd');
// this.$store.dispatch('trainingNew/trainingEnd');
}).catch((e) => {
this.$message.error('结束实训失败!');
});

View File

@ -21,6 +21,9 @@ export default {
},
myMemberId() {
return this.$store.state.training.myMemberId;
},
simulationCreator() {
return this.$store.state.training.simulationCreator;
}
},
watch: {
@ -37,7 +40,7 @@ export default {
}
},
'$store.state.socket.trainingOverCount': function(val) {
if (this.teachMode === ScriptMode.TEACH || this.teachMode === ScriptMode.PRACTICE) {
if ((this.teachMode === ScriptMode.TEACH || this.teachMode === ScriptMode.PRACTICE) && this.simulationCreator) {
this.trainingTipMessage = '实训完成,请点击结束按钮。';
}
},