剧本预览代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-06 17:44:36 +08:00
parent 0a4de52bb9
commit 42fb506612
3 changed files with 65 additions and 11 deletions

View File

@ -139,9 +139,9 @@ export function previewRunPlan(planId) {
} }
/** 剧本预览选择角色 */ /** 剧本预览选择角色 */
export function loadDraftScriptNew(memberId, group) { export function loadDraftScriptNew(memberId, group, mode) {
return request({ return request({
url: `/api/scriptSimulation/${group}/chooseMemberAndStart?memberId=${memberId}`, url: `/api/scriptSimulation/${group}/chooseMemberAndStart?memberId=${memberId}&mode=${mode}`,
method: 'put' method: 'put'
}); });
} }

View File

@ -17,6 +17,8 @@
@setMemberList="setMemberList" @setMemberList="setMemberList"
@clearAllData="clearAllData" @clearAllData="clearAllData"
@setTreeData="setTreeData" @setTreeData="setTreeData"
@changeScriptMode="changeScriptMode"
@setMapLocation="setMapLocation"
/> />
<script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :offset="offset" /> <script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :offset="offset" />
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" /> <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 { mapGetters } from 'vuex';
import { loadDraftScriptNew } from '@/api/designPlatform'; import { loadDraftScriptNew } from '@/api/designPlatform';
import Vue from 'vue'; import Vue from 'vue';
import { ScriptMode } from '@/scripts/ConstDic';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
export default { export default {
@ -79,7 +82,8 @@ export default {
userRole:'', userRole:'',
isDrive: this.prdType == '04', isDrive: this.prdType == '04',
treeData:[], treeData:[],
memberList:[] memberList:[],
scriptMode: ScriptMode.TEACH
}; };
}, },
computed: { computed: {
@ -118,6 +122,11 @@ export default {
// this.setMode(); // this.setMode();
} }
}, },
beforeDestroy() {
this.$store.dispatch('training/setRoles', '');
this.$store.dispatch('training/setPrdType', '');
this.clearAllData();
},
created() { created() {
this.group = this.$route.query.group || ''; this.group = this.$route.query.group || '';
}, },
@ -125,15 +134,19 @@ export default {
back() { back() {
this.$refs.scriptButtonGroup.back(); this.$refs.scriptButtonGroup.back();
}, },
changeScriptMode(scriptMode) {
this.scriptMode = scriptMode;
},
async selectRole(role) { async selectRole(role) {
try { 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 (res && res.code == 200) {
if (this.querymapLocation) { // if (this.querymapLocation) {
const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale}; const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(newMapLocation); Vue.prototype.$jlmap.setOptions(newMapLocation);
// }
} }
} this.$store.dispatch('scriptRecord/updateAudioPlay', false);
this.$store.dispatch('scriptRecord/updateBgSet', true); this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$refs.scriptButtonGroup.setIsscriptRun(true); this.$refs.scriptButtonGroup.setIsscriptRun(true);
if (role.type) { if (role.type) {
@ -223,6 +236,9 @@ export default {
} }
}); });
}, },
setMapLocation(mapLocation) {
this.mapLocation = mapLocation;
},
switchMode(prdType) { switchMode(prdType) {
this.$store.dispatch('training/setPrdType', prdType); this.$store.dispatch('training/setPrdType', prdType);
}, },

View File

@ -1,10 +1,20 @@
<template> <template>
<div> <div>
<!-- 下角按钮列表 --> <!-- 下角按钮列表 -->
<div class="display-draft"> <div class="display-draft">
<el-button v-if="isscriptRun&&!dataError" type="danger" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button> <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> <el-button type="primary" @click="back">{{ $t('display.demon.back') }}</el-button>
</div> </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'}"> <div class="schema" :style="{top: offset+'px'}">
<template v-if="!dataError"> <template v-if="!dataError">
@ -33,6 +43,7 @@
</div> </div>
</template> </template>
<script> <script>
import { ScriptMode } from '@/scripts/ConstDic';
import DemonMenu from '@/views/newMap/displayNew/demonMenu'; import DemonMenu from '@/views/newMap/displayNew/demonMenu';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import {covertMemberData} from '@/views/newMap/displayNew/utils'; import {covertMemberData} from '@/views/newMap/displayNew/utils';
@ -75,7 +86,9 @@ export default {
viewDisabled: true, viewDisabled: true,
firstLoad:true, firstLoad:true,
activeTrainList:[], activeTrainList:[],
isscriptRun:false // isscriptRun:false, //
scriptMode: ScriptMode.TEACH,
planRunning:false
}; };
}, },
computed:{ computed:{
@ -96,6 +109,9 @@ export default {
}, },
isStation() { isStation() {
return this.$store.state.training.prdType == '01'; return this.$store.state.training.prdType == '01';
},
scriptModeList() {
return ScriptMode;
} }
}, },
watch:{ watch:{
@ -114,10 +130,13 @@ export default {
await this.$store.dispatch('training/reset'); await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear'); await this.$store.dispatch('map/mapClear');
this.$store.dispatch('scriptRecord/updateSimulationPause', false); this.$store.dispatch('scriptRecord/updateSimulationPause', false);
this.$store.dispatch('scriptRecord/updateAudioPlay', false);
this.$store.dispatch('map/resetActiveTrainList', true);
}, },
methods:{ methods:{
// //
async initLoadData() { async initLoadData() {
this.changeScriptMode(this.scriptMode);
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setPrdType', '');
this.setWindowSize(); this.setWindowSize();
this.$store.dispatch('training/reset'); this.$store.dispatch('training/reset');
@ -139,6 +158,7 @@ export default {
} else { } else {
this.$store.dispatch('training/over');// 仿 this.$store.dispatch('training/over');// 仿
} }
this.planRunning = resp.data.planRunning;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`)); 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) { } else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true; this.dataError = true;
@ -240,6 +260,8 @@ export default {
this.$emit('setMemberData', lastMemberList); this.$emit('setMemberData', lastMemberList);
} }
let newMemberList = []; let newMemberList = [];
// planRunning
// debugger;
const activeMemberList = []; const activeMemberList = [];
resp.data.actionList.forEach((activeMember)=>{ resp.data.actionList.forEach((activeMember)=>{
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) { if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
@ -262,7 +284,7 @@ export default {
const lastData = JSON.stringify(playerList); const lastData = JSON.stringify(playerList);
newMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); newMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
if (resp.data.mapLocation) { if (resp.data.mapLocation) {
this.mapLocation = resp.data.mapLocation; this.$emit('setMapLocation', resp.data.mapLocation);
} }
const memberList = newMemberList || []; const memberList = newMemberList || [];
memberList.unshift({ id: '', label: this.$t('display.script.none'), role: 'no', disabled:false }); memberList.unshift({ id: '', label: this.$t('display.script.none'), role: 'no', disabled:false });
@ -320,6 +342,7 @@ export default {
getSimulationInfoNew(this.group).then(()=>{ getSimulationInfoNew(this.group).then(()=>{
this.isscriptRun = false; this.isscriptRun = false;
this.$store.dispatch('scriptRecord/updateBgSet', false); this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$store.dispatch('scriptRecord/updateAudioPlay', false);
// this.userRole = ''; // this.userRole = '';
this.$store.dispatch('training/setRoles', ''); this.$store.dispatch('training/setRoles', '');
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setPrdType', '');
@ -372,7 +395,22 @@ export default {
this.$store.dispatch('config/resize', { width, height }); this.$store.dispatch('config/resize', { width, height });
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode }); // 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> </script>
<style lang="scss" scoped>
.trainingButton{
position: absolute;
left: 5px;
}
</style>