rt-sim-training-client/src/store/modules/scriptRecord.js

85 lines
2.6 KiB
JavaScript
Raw Normal View History

2019-08-08 10:31:46 +08:00
/**
* 实训状态数据
*/
const scriptRecord = {
namespaced: true,
state: {
mapLocation: {}, // 地图定位,
2020-07-31 16:22:29 +08:00
simulationPause: true, // 剧本 暂停判断
bgSet: false,
2020-06-22 18:37:09 +08:00
updateRoleStatus:0, // 剧本更新角色标志
2020-07-08 18:35:46 +08:00
updateRoleId:'', // 剧本更新角色id
2020-06-23 10:57:35 +08:00
updateCoversitionStatus:0, // 剧本仿真更新会话信息
2020-10-12 15:59:28 +08:00
userRole:null, // 剧本更新的角色
2020-10-20 11:06:41 +08:00
audioPlay:false // 语音是否自动播放
},
getters: {
mapLocation: (state)=>{
return state.mapLocation;
},
simulationPause: (state)=>{
return state.simulationPause;
},
bgSet: (state)=>{
return state.bgSet;
},
2020-06-22 18:37:09 +08:00
updateRoleStatus:(state)=>{
return state.updateRoleStatus;
}
},
mutations: {
setMapLocation: (state, mapLocation) => {
state.mapLocation = mapLocation;
},
setSimulationPause: (state, simulationPause) => {
state.simulationPause = simulationPause;
},
setBgSet: (state, bgSet) => {
state.bgSet = bgSet;
},
2020-06-22 18:37:09 +08:00
updateRole:(state, userRole) => {
2020-07-08 18:35:46 +08:00
if (userRole) {
const userRoleParam = userRole.split(':');
if ( state.userRole == userRoleParam[0]) {
state.updateRoleStatus += 1;
}
state.updateRoleId = userRoleParam[1];
state.userRole = userRoleParam[0];
} else {
state.updateRoleId = '';
state.userRole = '';
2020-06-24 09:24:08 +08:00
}
2020-06-23 10:57:35 +08:00
},
updateCoversitionInfo:(state) => {
state.updateCoversitionStatus += 1;
2020-10-12 15:59:28 +08:00
},
2020-10-20 11:06:41 +08:00
setAudioPlay:(state, audioPlay) => {
state.audioPlay = audioPlay;
}
},
actions: {
/**
2019-08-08 17:32:38 +08:00
* 设置地图定位
*/
updateMapLocation: ({ commit }, mapLocation) => {
commit('setMapLocation', mapLocation);
},
updateSimulationPause: ({ commit }, simulationPause) => {
commit('setSimulationPause', simulationPause);
},
updateBgSet: ({ commit }, bgSet) => {
commit('setBgSet', bgSet);
},
2020-06-22 18:37:09 +08:00
updateRole:({ commit }, userRole) => {
commit('updateRole', userRole);
2020-06-23 10:57:35 +08:00
},
updateCoversitionInfo:({ commit }) => {
commit('updateCoversitionInfo');
2020-10-12 15:59:28 +08:00
},
2020-10-20 11:06:41 +08:00
updateAudioPlay:({ commit }, audioPlay) => {
commit('setAudioPlay', audioPlay);
}
}
2019-08-08 10:31:46 +08:00
};
2019-08-29 17:16:33 +08:00
export default scriptRecord;