diff --git a/src/api/jmap/training.js b/src/api/jmap/training.js index a721b0a3d..e8e806ba9 100644 --- a/src/api/jmap/training.js +++ b/src/api/jmap/training.js @@ -234,10 +234,11 @@ export function startTraining(group, params) { }); } /** 结束实训 */ -export function endTraining(group) { +export function endTraining(group, data) { return request({ url: `/api/training2Simulation/${group}/finish`, - method: 'put' + method: 'put', + data }); } /** 实训完成步骤 */ diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 7ef4210d9..7d63a7b0b 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -443,9 +443,6 @@ class Jlmap { const pictureDevice = store.getters['map/getPictureDeviceByCode'](item); device._pictureHide = pictureDevice ? pictureDevice.pictureHide : false; this.$painter.updatePicture(device); - if (device.code === 'X97979') { - console.log(pictureDevice, 'pictureDevice', this.mapDevice[device.code]); - } try { if (device._type === deviceType.Section && device.type === '03') { this.mapDevice[device.switch.code]._pictureHide = pictureDevice ? pictureDevice.pictureHide : false; diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 1526cf37d..3cb4d7620 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -1,6 +1,5 @@ import store from '@/store/index'; import { copyAssign } from '@/utils/index'; -import { Notification } from 'element-ui'; function handleSockInfo(state, msg, type) { switch (type) { @@ -27,311 +26,6 @@ function handleSimulationStateMsg(state, type) { break; } } -// function handle(state, data) { -// // console.log(data, 'socket订阅'); -// const msg = data.body; -// const path = window.location.href; -// const search = window.location.search; -// if (((path.includes('/display/demon') && search.includes('project=bjd')) || path.includes('/planSchedule/window')) && !state.isFirst) { state.isFirst = true; } -// switch (data.type) { -// case 'Order_Pay_Result': // 订单支付结果消息 -// state.payOrder = msg; -// break; -// case 'Simulation_DeviceStatus': // 仿真-设备状态消息 -// state.equipmentStatus = msg; -// break; -// case 'Simulation_User': // 仿真-进出仿真消息 -// handleSimulationUserinfo(state, msg); // 用户进出仿真消息 -// break; -// case 'Simulation_Script_Action_Tip': // 剧本提示消息 -// handleSimulationScriptTipInfo(state, msg); // 剧本提示消息 -// break; -// case 'Simulation_Script_Action_Finish': -// state.simulationScriptTipFinish++; // 剧本某一部操作完成提示 -// break; -// case 'Simulation_Script_Action_Error': -// state.simulationScriptTipError++; // 剧本某一部操作执行错误 -// break; -// case 'Simulation_Over': // 用户退出仿真推送消息 -// state.simulationOver++; // 用户退出仿真推送消息 -// break; -// case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息 -// state.scriptAction = msg; -// break; -// case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息 -// state.autoFaultTrigger++; -// break; -// case 'Simulation_RunFact': // 仿真-列车实际到 发车站消息 -// if (!Array.isArray(msg)) { -// state.trainStationList = [msg]; -// } else { -// state.trainStationList = msg; -// } -// break; -// case 'Simulation_Error': // 仿真-异常消息 -// state.simulationError += 1; -// break; -// case 'Simulation_RunAsPlan_Start': // 仿真-仿真开始按计划行车消息 -// state.simulationStart = msg; -// break; -// case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车 -// state.simulationReset += 1; -// break; -// case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令) -// handleSimulationInfo(state, msg); -// break; -// case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新 -// handleSimulationInfo(state, {id: msg.id, message: msg, messageType: 'MESSAGE'}); -// break; -// case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个) -// handlePushMsgQueue(state, msg); -// break; -// case 'Simulation_Invite': // 综合演练-仿真邀请消息 -// state.simulationInvite = msg; -// break; -// case 'Be_Logged_Out': // 重复登录被登出 -// state.beLogoutCount++; -// state.loggedOutMsg = msg; -// break; -// case 'Simulation_Run_Plan_Reload': // 运行图变更 -// state.runPlanReloadCount++; -// break; -// case 'Simulation_Control_Pause': // 暂停中 -// store.dispatch('scriptRecord/updateSimulationPause', msg); -// break; -// case 'BROADCAST': // 升级通知消息 -// Notification.warning({ -// title: msg.title, -// center: true, -// message: msg.message, -// position: 'bottom-right', -// showClose: msg.showClose, -// duration: 0 -// }); -// break; -// case 'Simulation_Member': -// state.memberChangeCount++; -// break; -// case 'Simulation_Time_Sync': -// state.simulationTimeSync = msg; -// break; -// case 'Simulation_IbpStatus': -// state.simulationIbpStatus = msg; -// break; -// case 'Simulation_Competition_Practice_Finish': -// state.competitionPracticeFinish++; -// break; -// case 'Simulation_Alarm': -// state.simulationAlarmInfo = msg; -// break; -// case 'STATION_PFI_NUM': -// state.stationPfiNum = msg; -// break; -// case 'STAND_PFI': -// state.standPfiNum = msg; -// break; -// case 'TRAIN_PFI_NUM': -// state.trainPfiNum = msg; -// break; -// case 'TRAIN_PFI_BL': -// state.trainPfiBL = msg; -// break; -// case 'LPF_STRATEGY_RECOMMEND': -// state.LPFstrategy = msg; -// break; -// case 'Simulation_Scenes_Reload': -// if (msg) { -// store.dispatch('training/start'); -// } else { -// store.dispatch('training/over'); -// } -// state.trainingReloadCount++; -// break; -// case 'Simulation_PslStatus': -// state.simulationPslStatus = msg; -// break; -// // 运行图加线/抽线/变化推送消息 -// case 'Simulation_Trip_Plan_Change': -// state.simulationPlanChange = msg; -// break; -// // 占线板信息 -// case 'Simulation_RailCtcStatus': -// state.railCtcStatusMsg = msg; -// break; -// // 大铁项目 ctc 运行图初始化信息 -// // case 'SIMULATION_CTC_RUN_PLAN_INIT': -// // msg.forEach(element => { -// // const tripNumberDe = element.departRunPlan && element.departRunPlan.tripNumber; -// // const tripNumberAr = element.arriveRunPlan && element.arriveRunPlan.tripNumber; -// // if (tripNumberDe) { parseInt(tripNumberDe[tripNumberDe.length - 1]) % 2 == 0 ? element.departRunPlan.up = tripNumberDe : element.departRunPlan.down = tripNumberDe; } -// // if (tripNumberAr) { parseInt(tripNumberAr[tripNumberAr.length - 1]) % 2 == 0 ? element.arriveRunPlan.up = tripNumberAr : element.arriveRunPlan.down = tripNumberAr; } -// // const code = element.stationCode + '' + element.code; -// // state.railCtcRunplanInitMsg[code] = element; -// // }); -// // break; -// // 大铁项目 ctc 运行图改变信息 -// case 'SIMULATION_CTC_RUN_PLAN_CHANGE': -// state.voiceBroadcastMsgs = []; -// msg.forEach(element => { -// const tripNumberDe = element.departRunPlan && element.departRunPlan.tripNumber; -// const tripNumberAr = element.arriveRunPlan && element.arriveRunPlan.tripNumber; -// if (tripNumberDe) { -// element.departRunPlan.up = ''; -// element.departRunPlan.down = ''; -// parseInt(tripNumberDe[tripNumberDe.length - 1]) % 2 == 0 ? element.departRunPlan.up = tripNumberDe : element.departRunPlan.down = tripNumberDe; -// } -// if (tripNumberAr) { -// element.arriveRunPlan.up = ''; -// element.arriveRunPlan.down = ''; -// parseInt(tripNumberAr[tripNumberAr.length - 1]) % 2 == 0 ? element.arriveRunPlan.up = tripNumberAr : element.arriveRunPlan.down = tripNumberAr; -// } -// const code = element.stationCode + '' + element.code; -// if (store.state.training.roleDeviceCode === element.stationCode && element.arriveRunPlan && element.arriveRunPlan.adjacentMessage === '1') { -// state.voiceBroadcastMsgs.push(element.stationCode + '' + element.code); -// } -// state.railCtcRunplanInitMsg[code] = copyAssign(state.railCtcRunplanInitMsg[code] || {}, element); -// }); -// if (state.voiceBroadcastMsgs.length) { -// state.voiceBroadcastChange++; -// } -// state.railCtcRunplanChange++; -// break; -// // 大铁项目 ctc 调度发布行车计划 给车站下发消息 -// case 'SIMULATION_RAILWAY_RUN_PLAN_SEND': -// msg.forEach(each=>{ -// state.railwaySimulationRunplanSendMap[each.stationCode] = each; -// }); -// state.railwaySimulationRunplanSendChange++; -// break; -// // 大铁项目 ctc 车务管理端 初始化消息 -// case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT': -// state.railCtcStationManageRpMsg = {}; -// msg.forEach(element => { -// const code = element.stationCode + '' + element.tripNumber; -// state.railCtcStationManageRpMsg[code] = element; -// }); -// // state.railCtcStationManageRpChange++; -// break; -// // 大铁项目 ctc 车务管理端 修改/增加消息 -// case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE': -// msg.forEach(element => { -// const code = element.stationCode + '' + element.tripNumber; -// state.railCtcStationManageRpMsg[code] = copyAssign(state.railCtcStationManageRpMsg[code] || {}, element); -// }); -// state.railCtcStationManageRpChange++; -// break; -// // 大铁项目 ctc 车务管理端 移除消息 -// case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE': -// msg.forEach(element => { -// const code = element.stationCode + '' + element.tripNumber; -// delete state.railCtcStationManageRpMsg[code]; -// }); -// state.railCtcStationManageRpChange++; -// break; -// // 调度命令信息 -// case 'SIMULATION_RAIL_CTC_DIS_COMMAND_ADD': -// state.dispatchCommandMsg = msg; -// break; -// // 调度命令状态 -// case 'SIMULATION_RAIL_CTC_DIS_COMMAND_SYNC': -// state.dispatchCommandState = msg; -// console.log('调度命令状态', msg); -// break; -// // 车站发送计划信息 -// case 'SIMULATION_CTC_RUN_PLAN_CONFIRM_SEND': -// state.changedCtcRunplanMap = msg; -// break; -// case 'SIMULATION_RAIL_TICKET': -// state.ticketInfo = msg; -// break; -// // // 实训提示消息 -// // case 'Simulation_Training_Step_Tip': -// // state.trainingStepTip = msg; -// // break; -// case 'Simulation_Training_Finish': -// state.trainingOverCount++; -// break; -// case 'YJDDZH_TRAIN_POSITION': -// state.whTrainInfo = msg; -// break; -// case 'Simulation_Training_Step_Finish': -// state.trainingStepFinishCount++; -// break; -// case 'SIMULATION_WORK_PARAM': -// state.simulationWorkParam = msg; -// break; -// // -// // // 大铁项目 调度台 运行图信息 初始化消息 -// // case 'SIMULATION_RAILWAY_RUN_PLAN_INIT': -// // state.railwaySimulationRpMsg = {}; -// // msg.forEach(element => { -// // const code = element.stationCode + '' + element.runPlanCode; -// // state.railwaySimulationRpMsg[code] = element; -// // }); -// // break; -// // // 大铁项目 调度台 运行图信息 修改/增加消息 -// // case 'SIMULATION_RAILWAY_RUN_PLAN_CHANGE': -// // msg.forEach(element => { -// // const code = element.stationCode + '' + element.runPlanCode; -// // state.railwaySimulationRpMsg[code] = copyAssign(state.railwaySimulationRpMsg[code] || {}, element); -// // }); -// // state.railwaySimulationRpChange++; -// // break; -// // // 大铁项目 调度台 运行图信息 移除消息 -// // case 'SIMULATION_RAILWAY_RUN_PLAN_REMOVE': -// // msg.forEach(element => { -// // const code = element.stationCode + '' + element.runPlanCode; -// // delete state.railwaySimulationRpMsg[code]; -// // }); -// // state.railwaySimulationRpChange++; -// // break; -// } -// } -// 仿真内部聊天 -function handleSimulationInfo(state, data) { - switch (data.messageType) { - case 'INVITE': - state.inviteSimulationConversation = data; - break; - case 'CONNECT': - state.acceptConversionInvite = data; - break; - case 'OVER': - state.overConversation = data; - break; - case 'MESSAGE': - state.conversationInfo = data; - break; - case 'CREATE': - state.createConversation = data; - break; - case 'EXIT': - state.exitConversation = data; - break; - } -} - -// 剧本提示 -function handleSimulationScriptTipInfo(state, data) { - state.simulationScriptTip = data; -} - -function handleSimulationUserinfo(state, data) { - state.simulationRoleList = (data instanceof Array) ? data : [data]; -} - -// (旧版可能在用,新版地图不用这个) -function handlePushMsgQueue(state, msg) { - if (msg instanceof Array) { - state.msgQueue.concat(msg); - } else { - state.msgQueue.push(msg); - } - - if (!state.msgHead) { - state.msgHead = state.msgQueue[0]; - } -} const socket = { namespaced: true, @@ -407,7 +101,6 @@ const socket = { railwaySimulationRunplanSendChange:0, // 大铁项目 调度台 发布 行车计划变化 voiceBroadcastMsgs: [], // 语音播报信息 voiceBroadcastChange: 0, // 语音播报信息变化 - trainingStepTip: '', // 新实训推送消息 trainingOverCount: 0, // 新实训结束计数器 trainingReloadCount: 0, whTrainInfo: null, @@ -535,9 +228,6 @@ const socket = { state.railCtcRunplanInitMsg[code] = element; }); }, - clearTrainingStepTip: (state) => { - state.trainingStepTip = ''; - }, clearTrainingOverCount: (state) => { state.trainingOverCount = 0; }, @@ -691,9 +381,6 @@ const socket = { setTicketInfo: (state, data) => { state.ticketInfo = data; }, - setTrainingStepTip: (state, data) => { - state.trainingStepTip = data; - }, trainingOverCountIncrease: (state) => { state.trainingOverCount++; }, @@ -801,9 +488,6 @@ const socket = { initRailCtcRunplanInitMsg:({ commit }, list) => { commit('initRailCtcRunplanInitMsg', list); }, - clearTrainingStepTip: ({ commit }) => { - commit('clearTrainingStepTip'); - }, clearTrainingOverCount: ({ commit }) => { commit('clearTrainingOverCount'); }, @@ -924,9 +608,6 @@ const socket = { setTicketInfo: ({ commit }, data) => { commit('setTicketInfo', data); }, - setTrainingStepTip: ({ commit }, data) => { - commit('setTrainingStepTip', data); - }, trainingOverCountIncrease: ({ commit }) => { commit('trainingOverCountIncrease'); }, diff --git a/src/store/modules/trainingNew.js b/src/store/modules/trainingNew.js index 3301571c3..2b4434430 100644 --- a/src/store/modules/trainingNew.js +++ b/src/store/modules/trainingNew.js @@ -14,9 +14,8 @@ const training = { sceneOperate: null, stepOrder: 0, operateOrder: 0, - // stepOverCount: 0, - trainingScore: '', - operateErrMsg: '' + operateErrMsg: '', + trainingStepTip: '' }, getters: { teachMode: (state) => { @@ -34,9 +33,6 @@ const training = { stepOrder: (state) => { return state.stepOrder; }, - trainingScore: (state) => { - return state.trainingScore; - }, sceneOperate: (state) => { return state.sceneOperate; } @@ -80,14 +76,17 @@ const training = { clearStepOverCount: (state) => { state.clearStepOverCount = 0; }, - setTrainingScore: (state, score) => { - state.trainingScore = score; - }, setSceneOperate: (state, sceneOperate) => { state.sceneOperate = sceneOperate; }, setOperateErrMsg: (state, msg) => { state.operateErrMsg = msg; + }, + clearTrainingStepTip: (state) => { + state.trainingStepTip = ''; + }, + setTrainingStepTip: (state, data) => { + state.trainingStepTip = data; } }, actions: { @@ -126,9 +125,6 @@ const training = { clearStepOverCount: ({commit}) => { commit('clearStepOverCount'); }, - setTrainingScore: ({commit}, score) => { - commit('setTrainingScore', score); - }, setSceneOperate: ({commit}, sceneOperate) => { commit('setSceneOperate', sceneOperate); }, @@ -160,6 +156,12 @@ const training = { } return result; } + }, + clearTrainingStepTip: ({ commit }) => { + commit('clearTrainingStepTip'); + }, + setTrainingStepTip: ({ commit }, data) => { + commit('setTrainingStepTip', data); } } }; diff --git a/src/utils/subscribeCallback.js b/src/utils/subscribeCallback.js index 78f161061..fde6482b1 100644 --- a/src/utils/subscribeCallback.js +++ b/src/utils/subscribeCallback.js @@ -174,10 +174,6 @@ 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_Finish': store.dispatch('socket/trainingOverCountIncrease'); break; diff --git a/src/views/designPlatform/trainingMenu.vue b/src/views/designPlatform/trainingMenu.vue index 07c6f9114..7676efd01 100644 --- a/src/views/designPlatform/trainingMenu.vue +++ b/src/views/designPlatform/trainingMenu.vue @@ -146,7 +146,7 @@ export default { handlerEnd() { endTraining(this.group).then((resp) => { this.$store.dispatch('trainingNew/trainingEnd'); - this.$store.dispatch('socket/clearTrainingStepTip'); + this.$store.dispatch('trainingNew/clearTrainingStepTip'); this.$store.dispatch('trainingNew/clearStepOrder'); this.$store.dispatch('trainingNew/clearOperateOrder'); this.$store.dispatch('trainingNew/setTrainingScore', resp.data); diff --git a/src/views/designPlatform/trainingPositionTip.vue b/src/views/designPlatform/trainingPositionTip.vue index 0edb941ca..1dfec1bc6 100644 --- a/src/views/designPlatform/trainingPositionTip.vue +++ b/src/views/designPlatform/trainingPositionTip.vue @@ -38,7 +38,7 @@ export default { } }, watch: { - '$store.state.socket.trainingStepTip': function(val) { + '$store.state.trainingNew.trainingStepTip': function(val) { if (val && this.trainingDetail.type === 'SINGLE') { const member = this.$store.state.training.memberData[val.memberId]; this.$nextTick(function() { @@ -74,7 +74,7 @@ export default { if (steps && steps.length) { const step = steps[stepOrder - 1]; const distance = 5; - this.tip = this.$store.state.socket.trainingStepTip.content; + this.tip = this.$store.state.trainingNew.trainingStepTip.content; if (step && step.tipPosition && step.tipPosition.deviceCode) { const position = this.getShapeTipPoint(step.tipPosition); if (position) { diff --git a/src/views/designPlatform/trainingPreview.vue b/src/views/designPlatform/trainingPreview.vue index 3e34bcc6c..3e518d6bc 100644 --- a/src/views/designPlatform/trainingPreview.vue +++ b/src/views/designPlatform/trainingPreview.vue @@ -144,7 +144,7 @@ export default { handlerEnd() { endTraining(this.group).then((resp) => { this.$store.dispatch('trainingNew/trainingEnd'); - this.$store.dispatch('socket/clearTrainingStepTip'); + this.$store.dispatch('trainingNew/clearTrainingStepTip'); this.$store.dispatch('trainingNew/clearStepOrder'); this.$store.dispatch('trainingNew/setTrainingScore', resp.data); }).catch(() => { diff --git a/src/views/designPlatform/trainingTip.vue b/src/views/designPlatform/trainingTip.vue index 94c54fc22..427cad2e3 100644 --- a/src/views/designPlatform/trainingTip.vue +++ b/src/views/designPlatform/trainingTip.vue @@ -21,7 +21,7 @@ export default { } }, watch: { - '$store.state.socket.trainingStepTip': function(val) { + '$store.state.trainingNew.trainingStepTip': function(val) { if (val && this.trainingDetail.type === 'SCENE') { const member = this.$store.state.training.memberData[val.memberId]; this.$nextTick(function() { diff --git a/src/views/newMap/display/simulationMenu.vue b/src/views/newMap/display/simulationMenu.vue index 69ab5453d..e1add9bbe 100644 --- a/src/views/newMap/display/simulationMenu.vue +++ b/src/views/newMap/display/simulationMenu.vue @@ -57,6 +57,7 @@ + + diff --git a/src/views/newMap/display/trainingList/index.vue b/src/views/newMap/display/trainingList/index.vue deleted file mode 100644 index 250e38ba4..000000000 --- a/src/views/newMap/display/trainingList/index.vue +++ /dev/null @@ -1,235 +0,0 @@ - - - - - {{ `当前实训名称:${training.name || ''}` }} - {{ `当前实训描述:${training.description || ''}` }} - - - - - - - - - - - - - - - diff --git a/src/views/newMap/display/trainingList/trainingMenu.vue b/src/views/newMap/display/trainingList/trainingMenu.vue index ee36f6d97..2f13bc277 100644 --- a/src/views/newMap/display/trainingList/trainingMenu.vue +++ b/src/views/newMap/display/trainingList/trainingMenu.vue @@ -78,8 +78,6 @@ import { clearSimulation } from '@/api/simulation'; import { startTraining, endTraining } from '@/api/jmap/training'; import ScenePlayRole from './scenePlayRole'; import { getPublishSingleList, getPublishTrainingDetail, loadPublishTraining, getPublishScenesList } from '@/api/jmap/training'; -import Cookies from 'js-cookie'; -import ConstConfig from '@/scripts/ConstConfig'; export default { name: 'TipTrainingDetail', components: { @@ -99,6 +97,7 @@ export default { TrainingMode: ScriptMode, activeName: 'first', showMenu: false, + scoreList: [], pagerConfig: { pageSize: 'pageSize', pageIndex: 'pageNum' @@ -109,14 +108,6 @@ export default { reset: true, show:false }, - prdTypeMap: { - DISPATCHER: '02', - STATION_SUPERVISOR: '01', - STATION_ASSISTANT: '01', - DEPOT_DISPATCHER: '09', - DRIVER: '04', - RAIL_CTC: '10' - }, queryList: { query: this.queryFunction, selectCheckShow: false, @@ -132,13 +123,6 @@ export default { title: this.$t('trainingManage.description'), prop: 'description' }, - { - title: this.$t('trainingManage.type'), - prop: 'type', - type: 'tag', - columnValue: (row) => { return this.covertData(row); }, - tagType: (row) => { return ''; } - }, { title: this.$t('trainingManage.labelJson'), prop: 'labelJson' @@ -172,13 +156,6 @@ export default { title: this.$t('trainingManage.description'), prop: 'description' }, - { - title: this.$t('trainingManage.type'), - prop: 'type', - type: 'tag', - columnValue: (row) => { return this.covertData(row); }, - tagType: (row) => { return ''; } - }, { title: this.$t('trainingManage.labelJson'), prop: 'labelJson' @@ -196,16 +173,15 @@ export default { ] } ] - } + }, + playerId: '', + trainingScore: 0 }; }, computed: { trainingSwitch() { return this.$store.state.trainingNew.trainingSwitch; }, - trainingScore() { - return this.$store.state.trainingNew.trainingScore; - }, trainingDetail() { return this.$store.state.trainingNew.trainingDetail; }, @@ -222,14 +198,21 @@ export default { watch: { '$store.state.trainingNew.stepOrder': function(val) { const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson); + const scoringRule = JSON.parse(this.$store.state.trainingNew.trainingDetail.scoringRuleJson); + const rule = scoringRule.find(rule => rule.memberId == this.playerId); + if (rule.details && stepList[val - 1]) { + const scoreRule = rule.details.find(item => item.elementId == stepList[val - 1].id ); + this.scoreList.push(scoreRule); + this.trainingScore += scoreRule.score; + console.log(this.scoreList, this.trainingScore, rule, scoreRule, stepList[val - 1].id, scoreRule.score, scoreRule.elementId); + } if (val >= 1 && val < stepList.length) { const msg = {content:stepList[val].description, memberId:stepList[val].memberId}; - this.$store.dispatch('socket/setTrainingStepTip', msg); + this.$store.dispatch('trainingNew/setTrainingStepTip', msg); } else { - this.$store.dispatch('socket/setTrainingStepTip', null); + this.$store.dispatch('trainingNew/setTrainingStepTip', null); val && this.$store.dispatch('socket/trainingOverCountIncrease'); } - // operateOrder; } }, mounted() { @@ -270,21 +253,21 @@ export default { this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode); 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); + this.$store.dispatch('trainingNew/setTrainingStepTip', msg); }).catch(() => { this.$message.error('开始实训失败!'); }); }, handlerEnd() { - endTraining(this.group).then((resp) => { + endTraining(this.group, { scoreList: this.scoreList }).then((resp) => { this.$store.dispatch('trainingNew/trainingEnd'); - this.$store.dispatch('socket/clearTrainingStepTip'); + this.$store.dispatch('trainingNew/clearTrainingStepTip'); this.$store.dispatch('trainingNew/clearStepOrder'); this.$store.dispatch('trainingNew/clearOperateOrder'); - this.$store.dispatch('trainingNew/setTrainingScore', resp.data); + this.scoreList = []; + this.trainingScore = 0; }).catch(() => { this.$message.error('结束实训失败!'); }); @@ -312,41 +295,22 @@ export default { const mapLocation = JSON.parse(detailResp.data.mapLocationJson); this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y}); } + this.playerId = ''; if (detailResp.data.playerIdJson) { - const playerId = JSON.parse(detailResp.data.playerIdJson)[0]; - if (playerId) { - const member = this.$store.state.training.memberData[playerId]; - this.$store.dispatch('training/setPrdType', this.prdTypeMap[member.type]); - this.$store.dispatch('training/setRoles', member.type); - } + this.playerId = JSON.parse(detailResp.data.playerIdJson)[0]; + // if (playerId) { + // const member = this.$store.state.training.memberData[playerId]; + // this.$store.dispatch('training/setPrdType', this.prdTypeMap[member.type]); + // this.$store.dispatch('training/setRoles', member.type); + // } } + this.showMenu = true; this.$store.dispatch('trainingNew/setTrainingDetail', detailResp.data); - this.$store.dispatch('trainingNew/setTrainingScore', ''); await loadPublishTraining(this.group, data.id, {mode: this.teachMode}); this.$message.success('加载实训成功!'); } catch (e) { this.$message.error('加载实训失败!'); } - }, - covertData(row) { - const releaseReview = ConstConfig.ConstSelect.trainingType; - const lastData = Object.assign({}, row); - if (Cookies.get('user_lang') == 'en') { - releaseReview.forEach(function(element) { - const rolename = element.value; - if (lastData.type == rolename) { - lastData.type = element.enlabel; - } - }); - } else { - releaseReview.forEach(function(element) { - const rolename = element.value; - if (lastData.type == rolename) { - lastData.type = element.label; - } - }); - } - return lastData.type; } } }; diff --git a/src/views/newMap/display/trainingList/trainingPositionTip.vue b/src/views/newMap/display/trainingList/trainingPositionTip.vue index 230062398..5b9377505 100644 --- a/src/views/newMap/display/trainingList/trainingPositionTip.vue +++ b/src/views/newMap/display/trainingList/trainingPositionTip.vue @@ -38,7 +38,7 @@ export default { } }, watch: { - '$store.state.socket.trainingStepTip': function(val) { + '$store.state.trainingNew.trainingStepTip': function(val) { if (val && this.trainingDetail.type === 'SINGLE') { const member = this.$store.state.training.memberData[val.memberId]; this.$nextTick(function() { @@ -83,7 +83,7 @@ export default { if (steps && steps.length) { const step = steps[stepOrder]; const distance = 5; - this.tip = this.$store.state.socket.trainingStepTip ? this.$store.state.socket.trainingStepTip.content : ''; + this.tip = this.$store.state.trainingNew.trainingStepTip ? this.$store.state.trainingNew.trainingStepTip.content : ''; if (step && step.tipPosition && step.tipPosition.deviceCode) { const position = this.getShapeTipPoint(step.tipPosition); if (position) { diff --git a/src/views/newMap/display/trainingList/trainingTip.vue b/src/views/newMap/display/trainingList/trainingTip.vue index 1272dba96..014ec9e16 100644 --- a/src/views/newMap/display/trainingList/trainingTip.vue +++ b/src/views/newMap/display/trainingList/trainingTip.vue @@ -21,7 +21,7 @@ export default { } }, watch: { - '$store.state.socket.trainingStepTip': function(val) { + '$store.state.trainingNew.trainingStepTip': function(val) { if (val && this.trainingDetail.type === 'SCENE') { const member = this.$store.state.training.memberData[val.memberId]; this.$nextTick(function() {