diff --git a/src/api/competition.js b/src/api/competition.js index 5cde43541..6df919cd7 100644 --- a/src/api/competition.js +++ b/src/api/competition.js @@ -47,9 +47,9 @@ export function getQuestionListByMapId(params) { } // 加载实操及内容 -export function loadQuestionList(data) { +export function loadQuestionList(competitionId, data) { return request({ - url: `/api/v1/competitionPractical/distribute`, + url: `/api/v1/competitionPractical/${competitionId}/distribute`, method: 'post', data }); diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 5cb0d22e5..5adb8568c 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -29,6 +29,9 @@ function handle(state, data) { case 'Simulation_Script_Tip': // 仿真-聊天界面用户进出仿真消息 handleSimulationScriptTipInfo(state, msg); // 用户进出仿真消息 break; + case 'Competition_Practical': // 竞赛裁判系统裁判员开始考试推送消息 + state.competitionStart++; // 竞赛裁判系统裁判员开始考试推送消息 + break; case 'Simulation_Script_Finish': // 剧本执行完成推送消息 state.scriptFinish++; // 剧本执行完成推送消息 break; @@ -199,6 +202,7 @@ const socket = { simulationRoleList:[], // 设置仿真的聊天角色信息 simulationScriptTip:{}, // 剧本推送提示信息 scriptFinish:0, // 剧本执行完成提示信息 + competitionStart:0, // 竞赛裁判系统裁判开始考试推送消息 jointRoomPrepare: false, // 演练房间准备状态 equipmentStatus: [], // 仿真-设备状态消息 trainStationList: [], // 仿真-列车实际到发车站消息 diff --git a/src/views/jsxt/refereeList/questionList.vue b/src/views/jsxt/refereeList/questionList.vue index fcf8cd37a..f5e2b24a7 100644 --- a/src/views/jsxt/refereeList/questionList.vue +++ b/src/views/jsxt/refereeList/questionList.vue @@ -62,7 +62,7 @@ export default { this.multipleSelection.forEach(question=>{ ids.push(question.id); }); - loadQuestionList(ids).then((response)=>{ + loadQuestionList(1, ids).then((response)=>{ this.$message('开始考试成功!'); this.doClose(); }).catch(()=>{ diff --git a/src/views/newMap/jointTrainingNew/menuDemon.vue b/src/views/newMap/jointTrainingNew/menuDemon.vue index c81de0c09..fcb8eaef6 100644 --- a/src/views/newMap/jointTrainingNew/menuDemon.vue +++ b/src/views/newMap/jointTrainingNew/menuDemon.vue @@ -33,6 +33,7 @@ import { EventBus } from '@/scripts/event-bus'; import { getSessionStorage } from '@/utils/auth'; import RealDevice from './menuDraft/realDevice'; import { participantCompleteCompetition } from '@/api/competition'; +import { prefixIntrger } from '@/utils/date'; export default { name: 'MenuDemonJoint', @@ -123,6 +124,11 @@ export default { }, '$store.state.map.runPlanStatus': function (val) { this.isDisable = val; + }, + '$store.state.socket.competitionStart':function(val) { + if (val) { + this.startCompetition(); + } } }, async mounted() { @@ -287,8 +293,18 @@ export default { setRelDevice() { this.$refs.realDevice.doShow(); }, + formatTime(initTime) { + const hh = prefixIntrger(initTime.getHours(), 2); + const mm = prefixIntrger(initTime.getMinutes(), 2); + const ss = prefixIntrger(initTime.getSeconds(), 2); + return `${hh}:${mm}:${ss}`; + }, startCompetition() { - this.selectBeginTime(); + const date = new Date(this.$store.state.training.initTime || null); + const model = { + initTime: this.formatTime(date) + }; + this.start(model); }, endCompetition() { this.$confirm('此操作将结束并提交本次竞赛,是否继续', this.$t('global.tips'), {