剧本预览代码调整
This commit is contained in:
parent
0a4de52bb9
commit
42fb506612
@ -139,9 +139,9 @@ export function previewRunPlan(planId) {
|
||||
}
|
||||
|
||||
/** 剧本预览选择角色 */
|
||||
export function loadDraftScriptNew(memberId, group) {
|
||||
export function loadDraftScriptNew(memberId, group, mode) {
|
||||
return request({
|
||||
url: `/api/scriptSimulation/${group}/chooseMemberAndStart?memberId=${memberId}`,
|
||||
url: `/api/scriptSimulation/${group}/chooseMemberAndStart?memberId=${memberId}&mode=${mode}`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
@setMemberList="setMemberList"
|
||||
@clearAllData="clearAllData"
|
||||
@setTreeData="setTreeData"
|
||||
@changeScriptMode="changeScriptMode"
|
||||
@setMapLocation="setMapLocation"
|
||||
/>
|
||||
<script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :offset="offset" />
|
||||
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
|
||||
@ -45,6 +47,7 @@ import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { loadDraftScriptNew } from '@/api/designPlatform';
|
||||
import Vue from 'vue';
|
||||
import { ScriptMode } from '@/scripts/ConstDic';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
|
||||
export default {
|
||||
@ -79,7 +82,8 @@ export default {
|
||||
userRole:'',
|
||||
isDrive: this.prdType == '04',
|
||||
treeData:[],
|
||||
memberList:[]
|
||||
memberList:[],
|
||||
scriptMode: ScriptMode.TEACH
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -118,6 +122,11 @@ export default {
|
||||
// this.setMode();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$store.dispatch('training/setRoles', '');
|
||||
this.$store.dispatch('training/setPrdType', '');
|
||||
this.clearAllData();
|
||||
},
|
||||
created() {
|
||||
this.group = this.$route.query.group || '';
|
||||
},
|
||||
@ -125,15 +134,19 @@ export default {
|
||||
back() {
|
||||
this.$refs.scriptButtonGroup.back();
|
||||
},
|
||||
changeScriptMode(scriptMode) {
|
||||
this.scriptMode = scriptMode;
|
||||
},
|
||||
async selectRole(role) {
|
||||
try {
|
||||
const res = await loadDraftScriptNew(role.id, this.group);
|
||||
const res = await loadDraftScriptNew(role.id, this.group, this.scriptMode);
|
||||
if (res && res.code == 200) {
|
||||
if (this.querymapLocation) {
|
||||
const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale};
|
||||
Vue.prototype.$jlmap.setOptions(newMapLocation);
|
||||
}
|
||||
// if (this.querymapLocation) {
|
||||
const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale};
|
||||
Vue.prototype.$jlmap.setOptions(newMapLocation);
|
||||
// }
|
||||
}
|
||||
this.$store.dispatch('scriptRecord/updateAudioPlay', false);
|
||||
this.$store.dispatch('scriptRecord/updateBgSet', true);
|
||||
this.$refs.scriptButtonGroup.setIsscriptRun(true);
|
||||
if (role.type) {
|
||||
@ -223,6 +236,9 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
setMapLocation(mapLocation) {
|
||||
this.mapLocation = mapLocation;
|
||||
},
|
||||
switchMode(prdType) {
|
||||
this.$store.dispatch('training/setPrdType', prdType);
|
||||
},
|
||||
|
@ -1,10 +1,20 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 左下角按钮列表 -->
|
||||
<!-- 右下角按钮列表 -->
|
||||
<div class="display-draft">
|
||||
<el-button v-if="isscriptRun&&!dataError" type="danger" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button>
|
||||
<el-button type="primary" @click="back">{{ $t('display.demon.back') }}</el-button>
|
||||
</div>
|
||||
<!-- 左上角按钮 -->
|
||||
<div class="trainingButton" :style="{top: (offset+45)+'px'}">
|
||||
<el-row>
|
||||
<el-radio-group v-model="scriptMode" class="mode" size="small" @change="changeScriptMode">
|
||||
<el-radio-button :label="scriptModeList.TEACH" :disabled="isscriptRun">{{ $t('display.lesson.teachingMode') }}</el-radio-button>
|
||||
<el-radio-button :label="scriptModeList.PRACTICE" :disabled="isscriptRun">{{ $t('display.lesson.practiceMode') }}</el-radio-button>
|
||||
<el-radio-button :label="scriptModeList.TEST" :disabled="isscriptRun">{{ $t('display.lesson.testMode') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- 右上角按钮列表 -->
|
||||
<div class="schema" :style="{top: offset+'px'}">
|
||||
<template v-if="!dataError">
|
||||
@ -33,6 +43,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { ScriptMode } from '@/scripts/ConstDic';
|
||||
import DemonMenu from '@/views/newMap/displayNew/demonMenu';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import {covertMemberData} from '@/views/newMap/displayNew/utils';
|
||||
@ -75,7 +86,9 @@ export default {
|
||||
viewDisabled: true,
|
||||
firstLoad:true,
|
||||
activeTrainList:[],
|
||||
isscriptRun:false // 剧本是否正在加载
|
||||
isscriptRun:false, // 剧本是否正在加载
|
||||
scriptMode: ScriptMode.TEACH,
|
||||
planRunning:false
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
@ -96,6 +109,9 @@ export default {
|
||||
},
|
||||
isStation() {
|
||||
return this.$store.state.training.prdType == '01';
|
||||
},
|
||||
scriptModeList() {
|
||||
return ScriptMode;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
@ -114,10 +130,13 @@ export default {
|
||||
await this.$store.dispatch('training/reset');
|
||||
await this.$store.dispatch('map/mapClear');
|
||||
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
|
||||
this.$store.dispatch('scriptRecord/updateAudioPlay', false);
|
||||
this.$store.dispatch('map/resetActiveTrainList', true);
|
||||
},
|
||||
methods:{
|
||||
// 加载地图数据
|
||||
async initLoadData() {
|
||||
this.changeScriptMode(this.scriptMode);
|
||||
this.$store.dispatch('training/setPrdType', '');
|
||||
this.setWindowSize();
|
||||
this.$store.dispatch('training/reset');
|
||||
@ -139,6 +158,7 @@ export default {
|
||||
} else {
|
||||
this.$store.dispatch('training/over');// 仿真按计划行车结束
|
||||
}
|
||||
this.planRunning = resp.data.planRunning;
|
||||
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
|
||||
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
|
||||
this.dataError = true;
|
||||
@ -240,6 +260,8 @@ export default {
|
||||
this.$emit('setMemberData', lastMemberList);
|
||||
}
|
||||
let newMemberList = [];
|
||||
// planRunning
|
||||
// debugger;
|
||||
const activeMemberList = [];
|
||||
resp.data.actionList.forEach((activeMember)=>{
|
||||
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
|
||||
@ -262,7 +284,7 @@ export default {
|
||||
const lastData = JSON.stringify(playerList);
|
||||
newMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
|
||||
if (resp.data.mapLocation) {
|
||||
this.mapLocation = resp.data.mapLocation;
|
||||
this.$emit('setMapLocation', resp.data.mapLocation);
|
||||
}
|
||||
const memberList = newMemberList || [];
|
||||
memberList.unshift({ id: '', label: this.$t('display.script.none'), role: 'no', disabled:false });
|
||||
@ -320,6 +342,7 @@ export default {
|
||||
getSimulationInfoNew(this.group).then(()=>{
|
||||
this.isscriptRun = false;
|
||||
this.$store.dispatch('scriptRecord/updateBgSet', false);
|
||||
this.$store.dispatch('scriptRecord/updateAudioPlay', false);
|
||||
// this.userRole = '';
|
||||
this.$store.dispatch('training/setRoles', '');
|
||||
this.$store.dispatch('training/setPrdType', '');
|
||||
@ -372,7 +395,22 @@ export default {
|
||||
this.$store.dispatch('config/resize', { width, height });
|
||||
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
|
||||
});
|
||||
},
|
||||
changeScriptMode(scriptMode) {
|
||||
const ScriptModeList = {
|
||||
TEACHING_MODE:'teach',
|
||||
PRACTICE_MODE:'practice',
|
||||
TEST_MODE:'test'
|
||||
};
|
||||
this.$store.dispatch('training/setScriptOperationType', ScriptModeList[scriptMode]);
|
||||
this.$emit('changeScriptMode', scriptMode);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.trainingButton{
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user