实训调整

This commit is contained in:
fan 2022-09-14 16:44:44 +08:00
parent 82857e9808
commit aef684e320
3 changed files with 92 additions and 6 deletions

View File

@ -27,11 +27,11 @@ export function handlerUrl(data) {
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'http://114.116.51.125/jlcloud';
BASE_API = 'http://192.168.3.90:9100'; // 周寅
// BASE_API = 'http://192.168.3.90:9100'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -1,28 +1,104 @@
<template>
<el-dialog
title="提示"
title="角色扮演"
:visible.sync="dialogVisible"
width="30%"
:before-close="doClose"
center
>
<span />
<template v-for="user in userList">
<div :key="user.id" style="display: flex;justify-content: space-between;">
<div>{{ user.nickName }}</div>
<el-select v-model="user.memberId" size="mini" placeholder="请选择">
<el-option
v-for="item in roleList"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select>
</div>
</template>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="commit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
export default {
name: 'ScenePlayRole',
data() {
return {
dialogVisible: false
dialogVisible: false,
userList: [],
roleList: []
};
},
computed: {
trainingDetail() {
return this.$store.state.trainingNew.trainingDetail;
}
},
watch: {
'$store.state.training.simulationUserList': function(val) {
this.userList = [];
this.$store.state.training.simulationUserList.forEach(user => {
this.userList.push({id: user.userId, nickName: user.nickName, memberId: ''});
});
}
// '$store.state.training.memberList': function (val) {
// if (val && val.length) {
// const memberData = this.$store.state.training.memberData;
// let activeTrainList = [];
// if (this.$store.state.training.started) {
// activeTrainList = this.$store.state.map.activeTrainList;
// }
// // 仿
// const result = covertMemberData(activeTrainList, Object.values(memberData));
// let list = [];
// result.deviceListData.forEach(item => {
// list = list.concat(item);
// });
// this.roleList = list;
// }
// }
},
methods: {
doClose() {
this.dialogVisible = false;
},
doShow() {
const playerList = JSON.parse(this.trainingDetail.playerIdJson);
const memberData = this.$store.state.training.memberData;
const activeTrainList = this.$store.state.map.activeTrainList || [];
const newMemberData = {};
playerList.forEach(playerId => {
newMemberData[playerId] = memberData[playerId];
});
const result = covertMemberData(activeTrainList, Object.values(newMemberData));
let list = [];
result.deviceListData.forEach(item => {
list = list.concat(item);
});
this.roleList = list;
this.dialogVisible = true;
},
commit() {
const list = [];
this.userList.forEach(user => {
list.push({userId: user.id, memberId: user.memberId});
});
console.log(this.userList, '-----');
assignUsersPlayRoles(list, this.$route.query.group).then(resp => {
this.$emit('startTraining');
this.doClose();
}).catch(() => {
this.$message.error('扮演角色失败!');
});
}
}
};

View File

@ -4,6 +4,7 @@
<training-jlmap refs="trainingJlmap" />
<training-tip ref="trainingTip" />
<training-position-tip ref="trainingPositionTip" />
<scene-play-role ref="scenePlayRole" @startTraining="startTraining" />
<!-- <training-menu ref="trainingMenu" :offset-bottom="offsetBottom" />-->
<div class="trainBack">
<el-button-group>
@ -21,6 +22,7 @@ import MenuDemon from './demonMenu.vue';
import TrainingTip from './trainingTip';
import TrainingPositionTip from './trainingPositionTip';
import TrainingJlmap from './trainingJlmap';
import ScenePlayRole from './scenePlayRole';
// import TrainingMenu from './trainingMenu';
export default {
name: 'TrainingDesign',
@ -28,7 +30,8 @@ export default {
MenuDemon,
TrainingTip,
TrainingJlmap,
TrainingPositionTip
TrainingPositionTip,
ScenePlayRole
// TrainingMenu
},
props: {
@ -102,6 +105,13 @@ export default {
}
},
handlerStart() {
if (this.trainingDetail.type === 'SCENE') {
this.$refs.scenePlayRole.doShow();
} else {
this.startTraining();
}
},
startTraining() {
startTraining(this.group, {mode: this.teachMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
this.$store.dispatch('trainingNew/setTrainingScore', '');