Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly1

This commit is contained in:
fan 2022-12-01 15:38:31 +08:00
commit 3acaf45b5d
4 changed files with 218 additions and 171 deletions

View File

@ -14,7 +14,8 @@ const training = {
scoringRules: [], // 当前实训评分规则
operateOrder: 0, // 操作order
operateErrMsg: '',
scoreList: [] // 实训得分
scoreList: [], // 实训得分
draftStepList: null // 显示的步骤列表
},
getters: {
teachMode: (state) => {
@ -85,6 +86,9 @@ const training = {
},
pushScoreList: (state, scoring) => {
state.scoreList.push(scoring);
},
editDraftStepList: (state, draftStepList) => {
state.draftStepList = draftStepList;
}
},
actions: {
@ -145,6 +149,9 @@ const training = {
},
pushScoreList: ({ commit }, scoring) => {
commit('pushScoreList', scoring);
},
editDraftStepList: ({ commit }, draftStepList) => {
commit('editDraftStepList', draftStepList);
}
}
};

View File

@ -256,6 +256,7 @@ export default {
},
backDesignPane(data) {
this.showMode = 'designPane';
this.$store.dispatch('trainingNew/editDraftStepList', null);
},
handleDelete(index, row) {
console.log('删除', index, row);
@ -277,6 +278,15 @@ export default {
return;
}
this.$store.dispatch('trainingNew/setTrainingDetail', null);
const list = [];
this.tableData.forEach((item, ind) => {
const obj = {
...item,
isActive: ind === index
};
list.push(obj);
});
this.$store.dispatch('trainingNew/editDraftStepList', list);
const member = this.$store.state.training.memberData[row.memberId];
if (!member.userId) {
assignUsersPlayRoles([{ userId: this.$store.state.user.id, memberId: member.id}], this.$route.query.group).then(resp => {

View File

@ -75,6 +75,9 @@ export default {
}
}
},
beforeDestroy() {
this.$store.dispatch('trainingNew/editDraftStepList', null);
},
methods: {
initData(data) {
this.editMode = true;

View File

@ -3,7 +3,7 @@
<div v-if="min" :id="sideButtonDom.domId" @click="clickBtn">
<el-button circle style="color: #0C161A;" icon="el-icon-mic" />
</div>
<div v-if="!min" class="chat-box-main">
<div v-show="!min" class="chat-box-main">
<div class="chat-box-header">
<div style="margin-right: 10px;cursor: pointer;">
<i class="el-icon-minus" style="color: #000;" @click="minimize" />
@ -55,6 +55,7 @@ import { getUserListCommon } from '@/api/rtSimulation';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import {UserOperationType} from '../../../../scripts/ConstDic';
import { timestampFormat } from '@/utils/date';
export default {
name: 'NewChatBox',
components:{
@ -133,16 +134,16 @@ export default {
connect() {
return (this.conversitionStateMap[this.myMemberId] || {connect:false}).connect;
},
privateMemberList() {
return (this.conversitionStateMap[this.myMemberId] || {privateMemberList: []}).privateMemberList;
},
privateMessageList() {
if (this.conversitionStateMap[this.myMemberId] && this.conversitionStateMap[this.myMemberId].connect) {
return (this.conversitionStateMap[this.myMemberId] || {privateMessageList: []}).privateMessageList;
} else {
return [];
}
},
// privateMemberList() {
// return (this.conversitionStateMap[this.myMemberId] || {privateMemberList: []}).privateMemberList;
// },
// privateMessageList() {
// if (this.conversitionStateMap[this.myMemberId] && this.conversitionStateMap[this.myMemberId].connect) {
// return (this.conversitionStateMap[this.myMemberId] || {privateMessageList: []}).privateMessageList;
// } else {
// return [];
// }
// },
sendTextId() {
return OperationEvent.Conversation.Chat.menu.domId;
},
@ -154,12 +155,12 @@ export default {
}
},
watch:{
connect(val) {
if (val) {
this.conversitionMemberList = this.privateMemberList;
this.messageList = [...this.privateMessageList];
}
},
// connect(val) {
// if (val) {
// this.conversitionMemberList = this.privateMemberList;
// this.messageList = [...this.privateMessageList];
// }
// },
// userRole(val) {
// if (val == 'AUDIENCE') {
// this.goCommonConversation();
@ -200,33 +201,33 @@ export default {
// }
// });
// },
'$store.state.socket.createConversation':function(val) {
val.memberList.forEach(member => {
// if (val.creatorId == member.memberId) {
this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: [], connect:member.connect});
// }
});
},
'$store.state.socket.inviteSimulationConversation':function(val) {
this.treeData.forEach(item => {
if (item.children) {
const memberList = Object.values(item.children);
memberList.forEach(data =>{
data.disabled = true;
});
if (item.children[val.creatorId]) {
item.children[val.creatorId].isInviting = true;
// const offsetTop = document.getElementById('proper_content_box' + val.creatorId).parentNode.offsetTop;
// document.querySelector('.chat-box-content').scrollTop = (offsetTop - 40) > 0 ? (offsetTop - 80) : 0;
if (!document.querySelector('#voiceName').classList.contains('flash')) {
document.querySelector('#voiceName').classList.add('flash');
document.querySelector('#teleRing').play();
}
}
// '$store.state.socket.createConversation':function(val) {
// val.memberList.forEach(member => {
// // if (val.creatorId == member.memberId) {
// this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: [], connect:member.connect});
// // }
// });
// },
// '$store.state.socket.inviteSimulationConversation':function(val) {
// this.treeData.forEach(item => {
// if (item.children) {
// const memberList = Object.values(item.children);
// memberList.forEach(data =>{
// data.disabled = true;
// });
// if (item.children[val.creatorId]) {
// item.children[val.creatorId].isInviting = true;
// // const offsetTop = document.getElementById('proper_content_box' + val.creatorId).parentNode.offsetTop;
// // document.querySelector('.chat-box-content').scrollTop = (offsetTop - 40) > 0 ? (offsetTop - 80) : 0;
// if (!document.querySelector('#voiceName').classList.contains('flash')) {
// document.querySelector('#voiceName').classList.add('flash');
// document.querySelector('#teleRing').play();
// }
// }
}
});
},
// }
// });
// },
'$store.state.map.activeTrainListChange': function (val) { //
this.activeTrains = [];
const activeTrainList = this.$store.state.map.activeTrainList;
@ -255,36 +256,37 @@ export default {
});
this.myMemberId = this.simulationUsers[this.userId].memberId;
}
this.getStepConversition();
},
deep: true
},
'$store.state.socket.exitConversation': function (val) {
for (const memberId in this.conversitionStateMap) {
if (memberId == val.memberId) {
this.conversitionStateMap[memberId].connect = false;
this.conversitionStateMap[memberId].conversitionId = '';
this.conversitionStateMap[memberId].privateMemberList = [];
this.conversitionStateMap[memberId].privateMessageList = [];
} else if ( this.conversitionStateMap[memberId].conversitionId == val.id ) {
const mList = [];
this.conversitionStateMap[memberId].privateMemberList.forEach(member => {
if (member.memberId != val.memberId) {
mList.push(member);
}
});
this.conversitionStateMap[memberId].privateMemberList = mList;
}
}
// 退
this.treeData.forEach(item => {
if (item.children && item.children[val.memberId]) {
const member = item.children[val.memberId];
member.active = false;
member.isConnect = false;
member.disabled = false;
}
});
},
// '$store.state.socket.exitConversation': function (val) {
// for (const memberId in this.conversitionStateMap) {
// if (memberId == val.memberId) {
// this.conversitionStateMap[memberId].connect = false;
// this.conversitionStateMap[memberId].conversitionId = '';
// this.conversitionStateMap[memberId].privateMemberList = [];
// this.conversitionStateMap[memberId].privateMessageList = [];
// } else if ( this.conversitionStateMap[memberId].conversitionId == val.id ) {
// const mList = [];
// this.conversitionStateMap[memberId].privateMemberList.forEach(member => {
// if (member.memberId != val.memberId) {
// mList.push(member);
// }
// });
// this.conversitionStateMap[memberId].privateMemberList = mList;
// }
// }
// // 退
// this.treeData.forEach(item => {
// if (item.children && item.children[val.memberId]) {
// const member = item.children[val.memberId];
// member.active = false;
// member.isConnect = false;
// member.disabled = false;
// }
// });
// },
'$store.state.training.memberList': function (val) {
if (val && val.length) {
this.memberData = this.$store.state.training.memberData;
@ -523,87 +525,87 @@ export default {
}
document.querySelector('#teleRing').pause();
},
'$store.state.socket.acceptConversionInvite':function(val) {
this.conversitionStateMap[val.memberId].connect = true;
this.conversitionStateMap[val.memberId].conversitionId = val.id;
if (this.conversitionId == val.id) {
this.treeData.forEach(data => {
if (data.children && val.memberId != this.myMemberId) {
const member = data.children[val.memberId];
if (member) {
member.isConnect = true;
member.active ? member.loading = false : member.active = true;
}
}
});
}
if (this.myMemberId == val.memberId) {
this.connectSuccess = true;
document.querySelector('#voiceName').classList.remove('flash');
document.querySelector('#teleRing').pause();
this.treeData.forEach(data => {
if (data.children) {
const member = data.children[val.creatorId];
if (member) {
member.active = true;
member.isConnect = true;
member.isInviting = false;
}
}
});
}
},
// '$store.state.socket.acceptConversionInvite':function(val) {
// this.conversitionStateMap[val.memberId].connect = true;
// this.conversitionStateMap[val.memberId].conversitionId = val.id;
// if (this.conversitionId == val.id) {
// this.treeData.forEach(data => {
// if (data.children && val.memberId != this.myMemberId) {
// const member = data.children[val.memberId];
// if (member) {
// member.isConnect = true;
// member.active ? member.loading = false : member.active = true;
// }
// }
// });
// }
// if (this.myMemberId == val.memberId) {
// this.connectSuccess = true;
// document.querySelector('#voiceName').classList.remove('flash');
// document.querySelector('#teleRing').pause();
// this.treeData.forEach(data => {
// if (data.children) {
// const member = data.children[val.creatorId];
// if (member) {
// member.active = true;
// member.isConnect = true;
// member.isInviting = false;
// }
// }
// });
// }
// },
'$store.state.scriptRecord.audioPlay':function(val) {
this.audioPlay = val;
},
'$store.state.scriptRecord.updateRoleId':function(val) {
if (this.conversitionStateMap[val]) {
this.treeData.forEach(item => {
if (item.children) {
const memberList = Object.values(item.children);
memberList.forEach(data =>{
const member = this.conversitionStateMap[val];
// && privateMem.connect;
const memberInfo = member.privateMemberList.find(privateMem=>{ return privateMem.memberId == data.id; });
// member.connect
if (member && data.id != val && memberInfo) {
data.isConnect = true;
data.active = true;
this.connectSuccess = true;
} else {
data.active = false;
data.isConnect = false;
this.connectSuccess = false;
}
data.loading = false;
data.disabled = false;
data.isInviting = false;
});
}
});
if (!this.connect) {
this.memberIdList = [];
this.memberObject = '';
}
} else {
this.memberIdList = [];
this.memberObject = '';
this.connectSuccess = false;
this.treeData.forEach(item => {
if (item.children) {
const memberList = Object.values(item.children);
memberList.forEach(data =>{
data.active = false;
data.isConnect = false;
data.loading = false;
data.disabled = false;
data.isInviting = false;
});
}
});
}
}
// '$store.state.scriptRecord.updateRoleId':function(val) {
// if (this.conversitionStateMap[val]) {
// this.treeData.forEach(item => {
// if (item.children) {
// const memberList = Object.values(item.children);
// memberList.forEach(data =>{
// const member = this.conversitionStateMap[val];
// // && privateMem.connect;
// const memberInfo = member.privateMemberList.find(privateMem=>{ return privateMem.memberId == data.id; });
// // member.connect
// if (member && data.id != val && memberInfo) {
// data.isConnect = true;
// data.active = true;
// this.connectSuccess = true;
// } else {
// data.active = false;
// data.isConnect = false;
// this.connectSuccess = false;
// }
// data.loading = false;
// data.disabled = false;
// data.isInviting = false;
// });
// }
// });
// if (!this.connect) {
// this.memberIdList = [];
// this.memberObject = '';
// }
// } else {
// this.memberIdList = [];
// this.memberObject = '';
// this.connectSuccess = false;
// this.treeData.forEach(item => {
// if (item.children) {
// const memberList = Object.values(item.children);
// memberList.forEach(data =>{
// data.active = false;
// data.isConnect = false;
// data.loading = false;
// data.disabled = false;
// data.isInviting = false;
// });
// }
// });
// }
// }
},
beforeDestroy() {
this.$store.dispatch('scriptRecord/updateAudioPlay', false);
@ -873,27 +875,52 @@ export default {
}
messages.push(message);
});
const tempMessageList = [];
!conversation.over && conversation.messageList.forEach(message => {
message.src = `${message.audioPath}`;
tempMessageList.push(message);
});
!conversation.over && conversation.memberList.forEach(member => {
const param = {
conversitionId: conversation.id,
privateMemberList: conversation.memberList,
privateMessageList: tempMessageList
};
this.$set(this.conversitionStateMap, member.memberId, param);
});
// const tempMessageList = [];
// !conversation.over && conversation.messageList.forEach(message => {
// message.src = `${message.audioPath}`;
// tempMessageList.push(message);
// });
// !conversation.over && conversation.memberList.forEach(member => {
// const param = {
// conversitionId: conversation.id,
// privateMemberList: conversation.memberList,
// privateMessageList: tempMessageList
// };
// this.$set(this.conversitionStateMap, member.memberId, param);
// });
});
this.getUserRole();
}
this.commonMessageList = messages.sort(this.sortByMessageTime);
this.messageList = [...this.commonMessageList];
this.getUserRole();
this.getStepConversition();
this.initCommonMemberList();
});
},
// --
getStepConversition() {
const list = [];
const data = this.$store.state.trainingNew.draftStepList;
const simulationTime = this.$store.state.socket.simulationTimeSync;
if (data && !this.$store.state.trainingNew.trainingSwitch) {
for (let index = 0; index < data.length; index++) {
if (data[index].isActive) {
break;
}
data[index].operations.forEach(it => {
if (it.operationType == 'Conversation_Chat_Text') {
list.push({
content: it.params.content,
id: list.length,
memberId: data[index].memberId,
time: timestampFormat('YYYY-MM-DD HH:mm:ss', simulationTime - (data.length - index) * 2000),
type: 'Text'
});
}
});
}
this.messageList = list;
}
},
//
initCommonMemberList() {
const temDispatcherList = [];
@ -967,11 +994,11 @@ export default {
},
changeMessageList(data) {
this.commonMessageList.push(data.message);
if (this.conversitionStateMap[data.message.memberId]) {
(this.conversitionStateMap[data.message.memberId].privateMemberList || []).forEach(member => {
this.conversitionStateMap[member.memberId] && this.conversitionStateMap[member.memberId].privateMessageList.push(data.message);
});
}
// if (this.conversitionStateMap[data.message.memberId]) {
// (this.conversitionStateMap[data.message.memberId].privateMemberList || []).forEach(member => {
// this.conversitionStateMap[member.memberId] && this.conversitionStateMap[member.memberId].privateMessageList.push(data.message);
// });
// }
// if (this.commonConversation) {
// this.messageList.push(data.message);
// } else if (!this.commonConversation && this.conversitionId === data.id && this.conversitionStateMap[this.myMemberId] && this.conversitionStateMap[this.myMemberId].connect) {
@ -988,8 +1015,8 @@ export default {
cancelCommonConversation() {
this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = false;
this.conversitionMemberList = this.privateMemberList;
this.messageList = [...this.privateMessageList];
this.conversitionMemberList = this.commonMemberList;
this.messageList = [...this.commonMessageList];
this.$nextTick(() => {
// this.$refs.tree && this.$refs.tree.filter(this.queryMember);
this.filterNode();