From 826b4da85409fb3c3487e3399965d5fbaf80d622 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Mon, 20 Jul 2020 10:48:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=85=AC=E5=85=B1=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jointTrainingNew/chatView/chatBox.vue | 132 ++++++++++-------- .../jointTrainingNew/chatView/chatContent.vue | 29 +--- 2 files changed, 77 insertions(+), 84 deletions(-) diff --git a/src/views/newMap/jointTrainingNew/chatView/chatBox.vue b/src/views/newMap/jointTrainingNew/chatView/chatBox.vue index f13aa450d..9ac79faef 100644 --- a/src/views/newMap/jointTrainingNew/chatView/chatBox.vue +++ b/src/views/newMap/jointTrainingNew/chatView/chatBox.vue @@ -37,7 +37,7 @@ @@ -61,6 +61,7 @@ :message-list="messageList" :simulation-users="simulationUsers" :user-role="userRole" + :common-conversation="commonConversation" @changeMessageList="changeMessageList" />
@@ -75,9 +76,9 @@ @@ -126,7 +127,7 @@ export default { recordSending:false, currentCoversition:{}, conversitionId: '', - commonConversation: true, + commonConversation: false, seconds:0, inter:null, recorders: null, @@ -152,8 +153,12 @@ export default { memberIdList: [], quitLoading: false, conversitionMemberList: [], + commonMemberList: [], + privateMemberList: [], isConversitionCreator: false, - messageList: [] + messageList: [], + commonMessageList: [], + privateMessageList: [] }; }, computed:{ @@ -178,7 +183,8 @@ export default { }, userRole(val) { if (val === 'AUDIENCE') { - this.isAudienceInitData(); + // this.isAudienceInitData(); + this.goCommonConversation(); } }, '$store.state.map.mapViewLoadedCount':function(val) { @@ -208,8 +214,8 @@ export default { memberList.push({memberId:id, connect:false}); } }); - console.log(memberList, val.memberIds); this.conversitionMemberList = memberList; + this.privateMemberList = memberList; } }, '$store.state.map.activeTrainListChange': function (val) { // 按计划行车的列车列表更新标识 @@ -236,10 +242,12 @@ export default { deep: true }, '$store.state.socket.overConversition': function (val) { - if (val.id === this.conversitionId) { + if (val.id === this.conversitionId) { this.conversitionId = ''; this.conversitionMemberList = []; + this.privateMemberList = []; this.messageList = []; + this.privateMessageList = []; } }, '$store.state.training.memberList': function (val) { @@ -324,18 +332,6 @@ export default { setSetting(data) { this.form = data; }, - setCurrentCoversition(coversition) { - if (coversition && coversition.id) { - this.currentCoversition = coversition; - this.headerTitle = coversition.name; - } else { - this.headerTitle = ''; - } - if (this.recordSending) { - this.cancleRecording(); - } - this.$refs.chatContent.scrollTop(); - }, setHeadTitle(headerTitle) { this.headerTitle = headerTitle; }, @@ -346,8 +342,8 @@ export default { this.createLoading = true; startConversition(this.group, this.memberIdList).then(resp => { this.conversitionId = resp.data.id; - // this.conversitionMemberList = resp.data.memberList; this.messageList = []; + this.privateMessageList = []; this.userString = ''; this.isConversitionCreator = true; this.$message.success('创建会话成功!'); @@ -502,7 +498,9 @@ export default { overSimulationConversition(this.group, this.conversitionId).then(resp => { this.conversitionId = ''; this.conversitionMemberList = []; + this.privateMemberList = []; this.messageList = []; + this.privateMessageList = []; this.quitLoading = false; }).catch(() => { this.$message.error('退出会话失败!'); @@ -513,8 +511,10 @@ export default { this.userString = ''; this.conversitionId = data.id; this.conversitionMemberList = data.memberList; + this.commonMemberList = data.memberList; this.isConversitionCreator = false; this.messageList = []; + this.privateMessageList = []; if (data.messageList && data.messageList) { data.messageList.forEach(message => { const member = this.memberData[message.memberId]; @@ -523,6 +523,7 @@ export default { message.self = this.$store.state.userId == member.userId; } this.messageList.push(message); + this.privateMessageList.push(message); }); } }, @@ -541,18 +542,43 @@ export default { isAudienceInitData() { getAllConversition(this.group).then(resp => { if (resp.data && resp.data.length) { - const messageList = []; + const messages = []; resp.data.forEach(conversation => { + (conversation.messageList || []).forEach(message => { + const member = this.memberData[message.memberId]; + message.src = `/audio/${message.audioPath}`; + message.members = conversation.memberList; + if (member) { + message.self = this.$store.state.userId == member.userId; + } + messages.push(message); + }); + this.commonMessageList = messages.sort(this.sortByMessageTime); + console.log(this.userRole); if (this.userRole == 'AUDIENCE') { - (conversation.messageList || []).forEach(message => { - const member = this.memberData[message.memberId]; - message.src = `/audio/${message.audioPath}`; - message.members = conversation.memberList; - if (member) { - message.self = this.$store.state.userId == member.userId; + this.messageList = this.commonMessageList; + this.conversitionMemberList = []; + const temDispatcherList = []; + const temStationSupervisorList = []; + const temMaintainerList = []; + const temDriverList = []; + this.$store.state.training.memberList.forEach(item =>{ + switch (item.type) { + case 'DISPATCHER': + temDispatcherList.push({memberId: item.id, connect:true }); + break; + case 'STATION_SUPERVISOR': + temStationSupervisorList.push({memberId: item.id, connect:true }); + break; + case 'MAINTAINER': + temMaintainerList.push({memberId: item.id, connect:true }); + break; + case 'DRIVER': + temDriverList.push({memberId: item.id, connect:true }); + break; } - messageList.push(message); }); + this.conversitionMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList]; } else { const user = this.simulationUsers[this.$store.state.user.id]; this.isConversitionCreator = conversation.creatorId == user.memberId; @@ -567,47 +593,35 @@ export default { if (member) { message.self = this.$store.state.userId == member.userId; } + this.privateMessageList.push(message); this.messageList.push(message); }); } }); } }); - this.messageList = messageList.sort(this.sortByMessageTime); } }); - this.conversitionMemberList = []; - const temDispatcherList = []; - const temStationSupervisorList = []; - const temMaintainerList = []; - const temDriverList = []; - this.$store.state.training.memberList.forEach(item =>{ - switch (item.type) { - case 'DISPATCHER': - temDispatcherList.push({memberId: item.id, connect:true }); - break; - case 'STATION_SUPERVISOR': - temStationSupervisorList.push({memberId: item.id, connect:true }); - break; - case 'MAINTAINER': - temMaintainerList.push({memberId: item.id, connect:true }); - break; - case 'DRIVER': - temDriverList.push({memberId: item.id, connect:true }); - break; - } - }); - this.conversitionMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList]; }, changeMessageList(data) { this.messageList.push(data); + this.commonMessageList.push(data); + if (this.userRole !== 'AUDIENCE') { + this.privateMessageList.push(data); + } + }, + goCommonConversation() { + !this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange(); + this.commonConversation = true; + this.conversitionMemberList = this.commonMemberList; + this.messageList = this.commonMemberList; + }, + cancelCommonConversation() { + this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange(); + this.commonConversation = false; + this.conversitionMemberList = this.privateMemberList; + this.messageList = this.privateMessageList; } - // goCommonConversation() { - // this.commonConversation = true; - // }, - // cancelCommonConversation() { - // this.commonConversation = false; - // } } }; diff --git a/src/views/newMap/jointTrainingNew/chatView/chatContent.vue b/src/views/newMap/jointTrainingNew/chatView/chatContent.vue index e19195685..05fbe494f 100644 --- a/src/views/newMap/jointTrainingNew/chatView/chatContent.vue +++ b/src/views/newMap/jointTrainingNew/chatView/chatContent.vue @@ -93,37 +93,13 @@ export default { // this.inintData(); }, methods:{ - inintData() { - // if (this.coversition.id) { - // getSimulationContextListNew(this.$route.query.group, this.coversition.id).then(res=>{ - // const userId = this.$store.state.user.id; - // const coversitionList = res.data.map(coversition=>{ - // coversition.self = false; - // if (coversition.member.userId == userId) { - // coversition.self = true; - // } - // coversition.src = coversition.isAudio ? `/audio/${coversition.audioPath}` : ''; - // coversition.targetUser = coversition.targetMember ? coversition.targetMember : 'All'; - // return coversition; - // }); - // this.chatContentList = coversitionList; - // this.scrollTop(); - // }); - // } - // const coversitionListAll = Object.assign({}, this.$store.state.socket.coversitionList); - // const coversitionList = coversitionListAll[this.coversition.id] || []; - // // console.log('inintData---coversitionList' + JSON.stringify(this.$store.state.socket.coversitionList[this.coversition.id])); - // this.chatContentList = coversitionList; - }, scrollTop() { this.$nextTick(function() { const scrollTop = document.querySelector('.chatcontentInner').offsetHeight - document.querySelector('.chatcontentIn').offsetHeight + 30; document.querySelector('.chatcontentIn').scrollTop = scrollTop; }); }, - // formatTime(time) { - // return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time; - // }, + playAllAudio() { this.playEachAudio(this.currentAudioList[this.currentAudioIndex]); }, @@ -171,6 +147,9 @@ export default { playAudio(audioUrl) { document.querySelector('#audioPlay').src = audioUrl; document.querySelector('#audioPlay').play(); + }, + conversationChange() { + } } }; From 05cf1251b95daa1a16ceb1b81576fc4cdc584e70 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Mon, 20 Jul 2020 11:18:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?psl=E6=B7=BB=E5=8A=A0=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=97=A8=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/deviceManage/editConfigGateway.vue | 118 +++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/src/views/system/deviceManage/editConfigGateway.vue b/src/views/system/deviceManage/editConfigGateway.vue index 4374acfc5..3a6c212ff 100644 --- a/src/views/system/deviceManage/editConfigGateway.vue +++ b/src/views/system/deviceManage/editConfigGateway.vue @@ -1,6 +1,48 @@