实训调整

This commit is contained in:
fan 2022-12-30 10:02:49 +08:00
parent f7d25d6d76
commit 4510d06b28
3 changed files with 16 additions and 10 deletions

View File

@ -3,12 +3,14 @@ import Handler from './newHandler.js';
import { ScriptMode } from '@/scripts/ConstDic';
import store from '@/store/index';
import LangStorage from '@/utils/lang';
import { OperationEvent } from './OperationHandler';
class ValidateHandler {
validate(mode, operate) {
let valid = true;
if (Handler.getTrainingStart()) {
valid = this.judgeTraining(operate);
if (mode === ScriptMode.PRACTICE || mode === ScriptMode.TEACH) {
console.log(operate, valid, 'valid');
if ((mode === ScriptMode.PRACTICE || mode === ScriptMode.TEACH) && operate.operation !== OperationEvent.Conversation.Chat.record.operation) {
const rightMsg = {errMsg: LangStorage.getLang() === 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green'};
const errorMsg = {errMsg: LangStorage.getLang() === 'en' ? 'operation mistake!' : '操作错误!', color: 'red'};
store.dispatch('trainingNew/setOperateErrMsg', valid ? rightMsg : errorMsg);

View File

@ -1,6 +1,7 @@
import Handler from '@/scripts/cmdPlugin/newHandler';
import store from '@/store/index';
import { SimulationUserType, OperateMode } from '@/scripts/ConstDic';
import LangStorage from '@/utils/lang';
const training = {
namespaced: true,
state: {
@ -178,8 +179,9 @@ const training = {
commit('clearVoiceStepList');
},
handleMatchVoice: ({ commit }, info) => {
console.log(info);
if (info && info.content === 'true') {
const rightMsg = {errMsg: LangStorage.getLang() === 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green'};
commit('setOperateErrMsg', rightMsg);
if (Handler.isLastOperation()) {
Handler.nextStep();
commit('clearVoiceStepList');
@ -189,6 +191,8 @@ const training = {
Handler.judgeIsTextSendOperation();
}
} else if (info && info.content === 'false') {
const errorMsg = {errMsg: LangStorage.getLang() === 'en' ? 'operation mistake!' : '操作错误!', color: 'red'};
commit('setOperateErrMsg', errorMsg);
Handler.handleVoiceStepList();
}
}

View File

@ -31,14 +31,14 @@ export default {
this.trainingTipMessage = '';
}
},
'$store.state.trainingNew.voiceStepIndex': function(val) {
if (val > -1 && this.trainingDetail.type === 'SCENE' && (this.teachMode === ScriptMode.TEACH || this.teachMode === ScriptMode.PRACTICE)) {
const stepInfo = this.$store.state.trainingNew.voiceStepList[this.$store.state.trainingNew.voiceStepIndex];
this.trainingTipMessage = stepInfo ? stepInfo.description : this.$store.state.trainingNew.stepInfo.description;
} else {
this.trainingTipMessage = '';
}
},
// '$store.state.trainingNew.voiceStepIndex': function(val) {
// if (val > -1 && this.trainingDetail.type === 'SCENE' && (this.teachMode === ScriptMode.TEACH || this.teachMode === ScriptMode.PRACTICE)) {
// const stepInfo = this.$store.state.trainingNew.voiceStepList[this.$store.state.trainingNew.voiceStepIndex];
// this.trainingTipMessage = stepInfo ? stepInfo.description : this.$store.state.trainingNew.stepInfo.description;
// } else {
// this.trainingTipMessage = '';
// }
// },
'$store.state.trainingNew.trainingSwitch': function(val) {
if (!val) {
this.trainingTipMessage = '';