rt-sim-training-client/src/store/modules/scriptRecord.js
joylink_cuiweidong 3003a5eb2a 代码调整
2020-10-28 13:05:13 +08:00

85 lines
2.6 KiB
JavaScript

/**
* 实训状态数据
*/
const scriptRecord = {
namespaced: true,
state: {
mapLocation: {}, // 地图定位,
simulationPause: true, // 剧本 暂停判断
bgSet: false,
updateRoleStatus:0, // 剧本更新角色标志
updateRoleId:'', // 剧本更新角色id
updateCoversitionStatus:0, // 剧本仿真更新会话信息
userRole:null, // 剧本更新的角色
audioPlay:false // 语音是否自动播放
},
getters: {
mapLocation: (state)=>{
return state.mapLocation;
},
simulationPause: (state)=>{
return state.simulationPause;
},
bgSet: (state)=>{
return state.bgSet;
},
updateRoleStatus:(state)=>{
return state.updateRoleStatus;
}
},
mutations: {
setMapLocation: (state, mapLocation) => {
state.mapLocation = mapLocation;
},
setSimulationPause: (state, simulationPause) => {
state.simulationPause = simulationPause;
},
setBgSet: (state, bgSet) => {
state.bgSet = bgSet;
},
updateRole:(state, userRole) => {
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 = '';
}
},
updateCoversitionInfo:(state) => {
state.updateCoversitionStatus += 1;
},
setAudioPlay:(state, audioPlay) => {
state.audioPlay = audioPlay;
}
},
actions: {
/**
* 设置地图定位
*/
updateMapLocation: ({ commit }, mapLocation) => {
commit('setMapLocation', mapLocation);
},
updateSimulationPause: ({ commit }, simulationPause) => {
commit('setSimulationPause', simulationPause);
},
updateBgSet: ({ commit }, bgSet) => {
commit('setBgSet', bgSet);
},
updateRole:({ commit }, userRole) => {
commit('updateRole', userRole);
},
updateCoversitionInfo:({ commit }) => {
commit('updateCoversitionInfo');
},
updateAudioPlay:({ commit }, audioPlay) => {
commit('setAudioPlay', audioPlay);
}
}
};
export default scriptRecord;