From 4a1e3d0aa796b1418d05f976b4da07dde0fc1b64 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Tue, 1 Sep 2020 11:17:29 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E7=BB=B4?= =?UTF-8?q?=E7=94=B5=E5=AD=90=E6=B2=99=E7=9B=98=E5=86=85=E5=A4=96=E4=BE=A7?= =?UTF-8?q?=E7=AB=99=E5=8F=B0=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=85=A8bug?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=A4=96=E8=BD=A6=E7=AB=99=E5=8F=B0?= =?UTF-8?q?=E6=BC=AB=E6=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jlmap3d/jl3dsimulation/jlmap3d.js | 23 +++++++++++-------- src/jlmap3d/main/loaders/SimulationLoadNew.js | 14 ++++++++++- .../main/newmodel/StationStandListN.js | 13 +++++++---- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/jlmap3d/jl3dsimulation/jlmap3d.js b/src/jlmap3d/jl3dsimulation/jlmap3d.js index 2db744224..192002b2d 100644 --- a/src/jlmap3d/jl3dsimulation/jlmap3d.js +++ b/src/jlmap3d/jl3dsimulation/jlmap3d.js @@ -420,7 +420,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { } if(scope.raycasterswitch == "signal"){ - console.log(signallist); + let intersects = raycaster.intersectObjects( signallist.group.children,true); if(intersects[0]){ @@ -449,10 +449,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { camerarail.progress = 0; let points = []; let stationp1 = stationstandlist.group.children[0].position; - let stationp2 = stationstandlist.group.children[20].position; - //全线漫游 - // points.push(new THREE.Vector3(stationp1.x-20,10,stationp1.z)); - // points.push(new THREE.Vector3(stationp2.x+20,10,stationp2.z)); + //站内漫游(晕) // points.push(new THREE.Vector3(stationp1.x-65,11,stationp1.z+15)); // points.push(new THREE.Vector3(stationp1.x,11,stationp1.z+15)); @@ -462,10 +459,18 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { // points.push(new THREE.Vector3(stationp1.x+38,11,stationp1.z+2)); // points.push(new THREE.Vector3(stationp1.x+13,5,stationp1.z+2)); - points.push(new THREE.Vector3(stationp1.x-65,11,stationp1.z+12)); - points.push(new THREE.Vector3(stationp1.x+60,11,stationp1.z+12)); - points.push(new THREE.Vector3(stationp1.x+60,7,stationp1.z+12)); - points.push(new THREE.Vector3(stationp1.x-55,5,stationp1.z+12)); + if(stationstandlist.group.children[0].inside == false){ + points.push(new THREE.Vector3(stationp1.x-65,11,stationp1.z-26)); + points.push(new THREE.Vector3(stationp1.x+60,11,stationp1.z-26)); + points.push(new THREE.Vector3(stationp1.x+60,7,stationp1.z-26)); + points.push(new THREE.Vector3(stationp1.x-55,5,stationp1.z-26)); + }else{ + points.push(new THREE.Vector3(stationp1.x-65,11,stationp1.z+12)); + points.push(new THREE.Vector3(stationp1.x+60,11,stationp1.z+12)); + points.push(new THREE.Vector3(stationp1.x+60,7,stationp1.z+12)); + points.push(new THREE.Vector3(stationp1.x-55,5,stationp1.z+12)); + } + // points.push(new THREE.Vector3(stationp1.x+40,3,stationp1.z+15)); // controls.target = new THREE.Vector3(camera.position.x+1,camera.position.y,camera.position.z); // controls.update(); diff --git a/src/jlmap3d/main/loaders/SimulationLoadNew.js b/src/jlmap3d/main/loaders/SimulationLoadNew.js index 5f07c0902..487f5a3ed 100644 --- a/src/jlmap3d/main/loaders/SimulationLoadNew.js +++ b/src/jlmap3d/main/loaders/SimulationLoadNew.js @@ -46,6 +46,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce } function initnew3d(data,netdata){ + // console.log(JSON.parse(netdata.assets)); Materialload(scope,JSON.parse(netdata.assets).stationTextureList[0]); let mapdata = data; @@ -68,7 +69,18 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce let switchdata = JSON.parse(netdata.switchs); let signaldata = JSON.parse(netdata.signals); let standsdata = JSON.parse(netdata.stands); - let psddata = data.psdList; + let psddata = mapdata.psdList; + + if(standsdata[0].inside == undefined){ + for(let i=0;i Date: Tue, 1 Sep 2020 11:20:53 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 716e7c21179da096498330d79f68aedea64e5e65) --- src/views/newMap/chatView/chatBox.vue | 4 +- src/views/newMap/chatView/chatContent.vue | 82 +++++++++---------- src/views/newMap/displayNew/demonChat.vue | 52 +++++++----- .../jointTrainingNew/chatView/chatBox.vue | 28 ++++++- 4 files changed, 97 insertions(+), 69 deletions(-) diff --git a/src/views/newMap/chatView/chatBox.vue b/src/views/newMap/chatView/chatBox.vue index 2ebc567cb..d0f1a3948 100644 --- a/src/views/newMap/chatView/chatBox.vue +++ b/src/views/newMap/chatView/chatBox.vue @@ -247,7 +247,6 @@ export default { const that = this; this.recorders.stopRecording(function(blobURL) { const data = URL.createObjectURL(that.recorders.getBlob()); - console.log('--------', data); clearInterval(that.inter); that.seconds = 0; const blob = that.recorders.getBlob(); @@ -307,6 +306,9 @@ export default { }, inviteMember() { this.$refs.chatToolTip.doShow(); + }, + addAudioList(data) { + this.$refs.chatContent.addAudioList(data); } } }; diff --git a/src/views/newMap/chatView/chatContent.vue b/src/views/newMap/chatView/chatContent.vue index 3938b7cb7..df9b5d61e 100644 --- a/src/views/newMap/chatView/chatContent.vue +++ b/src/views/newMap/chatView/chatContent.vue @@ -30,12 +30,20 @@ export default { }, data() { return { - // currentAudioList:[], - // currentAudioIndex:0, - // isPlay:false, + currentAudioList:[], + currentAudioIndex:0, + isPlay:false, + isAutoPlay: false, baseUrl:process.env.VUE_APP_VOICE_API + 'audio/' }; }, + watch: { + 'currentAudioList': function(val) { + if (val.length > 0 && !this.isPlay && !this.isAutoPlay) { + this.playEachAudio(val[0].src); + } + } + }, mounted() { // this.coversition = this.currentCoversition; // this.inintData(); @@ -47,50 +55,36 @@ export default { document.querySelector('.chatcontentIn').scrollTop = scrollTop; }); }, - // playEachAudio(audioUrl) { - // this.$nextTick(function() { - // document.querySelector('#audioPlay').src = audioUrl; - // document.querySelector('#audioPlay').play(); - // const that = this; - // document.querySelector('#audioPlay').onended = function() { - // that.currentAudioList.shift(); - // console.log(that.currentAudioList.length); - // if (that.currentAudioList.length > 0) { - // that.playEachAudio(that.currentAudioList[that.currentAudioIndex]); - // } else { - // that.isPlay = false; - // } - // }; - // }); - // }, - // covertName(data, status) { - // if (status) { - // let result = ''; - // const members = data.members || this.conversitionMemberList; - // (members || []).forEach(member => { - // if (member.memberId != data.memberId) { - // result += ('@' + this.covertEachName(member.memberId)); - // } - // }); - // return result; - // } else { - // return this.covertEachName(data.memberId); - // } - // }, - // covertEachName(memberId) { - // let name = ''; - // const member = this.$store.state.training.memberData[memberId]; - // if (member && member.userId) { - // const user = this.simulationUsers[member.userId]; - // name = member.label + '(' + user.nickName + ')'; - // } else if (member) { - // name = member.label; - // } - // return name; - // }, + + playEachAudio(audioUrl) { + this.$nextTick(function() { + this.isAutoPlay = true; + document.querySelector('#audioPlay').src = this.baseUrl + audioUrl; + document.querySelector('#audioPlay').play(); + const that = this; + document.querySelector('#audioPlay').onended = function() { + that.currentAudioList.shift(); + if (that.currentAudioList.length > 0) { + that.playEachAudio(that.currentAudioList[0].src); + } else { + that.isAutoPlay = false; + } + }; + }); + }, playAudio(audioUrl) { + this.isPlay = true; document.querySelector('#audioPlay').src = audioUrl; document.querySelector('#audioPlay').play(); + const that = this; + document.querySelector('#audioPlay').onended = function() { + that.isPlay = false; + that.isAutoPlay = false; + }; + }, + addAudioList(converstion) { + this.currentAudioList.push(converstion); + this.scrollTop(); } // conversationChange() { // this.currentAudioList = []; diff --git a/src/views/newMap/displayNew/demonChat.vue b/src/views/newMap/displayNew/demonChat.vue index fb696e4c8..0ff21f0fa 100644 --- a/src/views/newMap/displayNew/demonChat.vue +++ b/src/views/newMap/displayNew/demonChat.vue @@ -108,9 +108,12 @@ export default { // 创建会话 '$store.state.socket.createConversition':function(val) { if (this.memberData.length > 0) { - const member = this.memberData.find(member=>{ return member.id == val.creatorId; }); - if (member && member.userId == this.$store.state.user.id) { + const conversitionMember = this.memberData.find(member=>{ return member.userId == this.$store.state.user.id; }); + if (conversitionMember && val.memberIds.includes(conversitionMember.id)) { // 当前用户创建的会话 + if (val.creatorId !== conversitionMember.id) { + this.$message.success(this.coverName(val) + '与你开启会话'); + } this.isHasCoversition = true; this.isStartRecord = true; this.isQuitShow = true; @@ -118,6 +121,7 @@ export default { const memberList = []; val.memberIds.forEach(id=>{ if (val.creatorId == id) { + const member = this.memberData.find(member=>{ return member.id == id; }); member.connect = true; memberList.push(member); } else { @@ -177,7 +181,11 @@ export default { '$store.state.socket.conversationInfo':function (val, old) { // 仿真聊天 const simulationText = this.$store.state.socket.conversationInfo; if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) { - this.chatContentList.push(this.addContent(simulationText.message)); + const content = this.addContent(simulationText.message); + this.chatContentList.push(content); + if (!content.self) { + this.$refs.chatbox.addAudioList(content); + } } }, // 按计划行车的列车列表更新(更新司机列表) @@ -217,23 +225,23 @@ export default { }, // 邀请会话的消息 '$store.state.socket.inviteSimulationConversition':function(val) { - const member = this.memberData.find(member=>{ return member.id == val.creatorId; }); - if (member) { - this.inviteUserName = member.label; - this.conversitionId = val.id; - member.connect = true; - member.online = true; - this.inviteUser = member; - - this.currentMemberList.push(member); - const member = this.memberData.find(member=>{ return member.id == val.memberId; }); - member.connect = true; - this.currentMemberList.push(member); - this.isStartRecord = true; - - // this.$refs.chatbox.inviteMember(); - this.$message.success(this.inviteUserName + '与你开启会话'); - } + // const conversitionMember = this.memberData.find(member=>{ return member.id == val.creatorId; }); + // if (conversitionMember) { + // this.inviteUserName = conversitionMember.label; + // this.conversitionId = val.id; + // conversitionMember.connect = true; + // conversitionMember.online = true; + // this.inviteUser = conversitionMember; + // + // this.currentMemberList.push(conversitionMember); + // const member = this.memberData.find(member=>{ return member.id == val.memberId; }); + // member.connect = true; + // this.currentMemberList.push(member); + // this.isStartRecord = true; + // this.isHasCoversition = true; + // // this.$refs.chatbox.inviteMember(); + // this.$message.success(this.inviteUserName + '与你开启会话'); + // } } }, @@ -254,6 +262,10 @@ export default { } return text; }, + coverName(inviteUser) { + const member = this.memberData.find(member=>{ return member.id == inviteUser.creatorId; }); + return member.label; + }, clearAllData() { this.resetCoversition(); this.createCoversition = true; diff --git a/src/views/newMap/jointTrainingNew/chatView/chatBox.vue b/src/views/newMap/jointTrainingNew/chatView/chatBox.vue index 420ec5fad..f112dd848 100644 --- a/src/views/newMap/jointTrainingNew/chatView/chatBox.vue +++ b/src/views/newMap/jointTrainingNew/chatView/chatBox.vue @@ -92,7 +92,7 @@
确定
取消
- +