parent
46e6ec68d5
commit
13764f98a7
@ -247,7 +247,6 @@ export default {
|
|||||||
const that = this;
|
const that = this;
|
||||||
this.recorders.stopRecording(function(blobURL) {
|
this.recorders.stopRecording(function(blobURL) {
|
||||||
const data = URL.createObjectURL(that.recorders.getBlob());
|
const data = URL.createObjectURL(that.recorders.getBlob());
|
||||||
console.log('--------', data);
|
|
||||||
clearInterval(that.inter);
|
clearInterval(that.inter);
|
||||||
that.seconds = 0;
|
that.seconds = 0;
|
||||||
const blob = that.recorders.getBlob();
|
const blob = that.recorders.getBlob();
|
||||||
@ -307,6 +306,9 @@ export default {
|
|||||||
},
|
},
|
||||||
inviteMember() {
|
inviteMember() {
|
||||||
this.$refs.chatToolTip.doShow();
|
this.$refs.chatToolTip.doShow();
|
||||||
|
},
|
||||||
|
addAudioList(data) {
|
||||||
|
this.$refs.chatContent.addAudioList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -30,12 +30,20 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// currentAudioList:[],
|
currentAudioList:[],
|
||||||
// currentAudioIndex:0,
|
currentAudioIndex:0,
|
||||||
// isPlay:false,
|
isPlay:false,
|
||||||
|
isAutoPlay: false,
|
||||||
baseUrl:process.env.VUE_APP_VOICE_API + 'audio/'
|
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() {
|
mounted() {
|
||||||
// this.coversition = this.currentCoversition;
|
// this.coversition = this.currentCoversition;
|
||||||
// this.inintData();
|
// this.inintData();
|
||||||
@ -47,50 +55,36 @@ export default {
|
|||||||
document.querySelector('.chatcontentIn').scrollTop = scrollTop;
|
document.querySelector('.chatcontentIn').scrollTop = scrollTop;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// playEachAudio(audioUrl) {
|
|
||||||
// this.$nextTick(function() {
|
playEachAudio(audioUrl) {
|
||||||
// document.querySelector('#audioPlay').src = audioUrl;
|
this.$nextTick(function() {
|
||||||
// document.querySelector('#audioPlay').play();
|
this.isAutoPlay = true;
|
||||||
// const that = this;
|
document.querySelector('#audioPlay').src = this.baseUrl + audioUrl;
|
||||||
// document.querySelector('#audioPlay').onended = function() {
|
document.querySelector('#audioPlay').play();
|
||||||
// that.currentAudioList.shift();
|
const that = this;
|
||||||
// console.log(that.currentAudioList.length);
|
document.querySelector('#audioPlay').onended = function() {
|
||||||
// if (that.currentAudioList.length > 0) {
|
that.currentAudioList.shift();
|
||||||
// that.playEachAudio(that.currentAudioList[that.currentAudioIndex]);
|
if (that.currentAudioList.length > 0) {
|
||||||
// } else {
|
that.playEachAudio(that.currentAudioList[0].src);
|
||||||
// that.isPlay = false;
|
} else {
|
||||||
// }
|
that.isAutoPlay = 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;
|
|
||||||
// },
|
|
||||||
playAudio(audioUrl) {
|
playAudio(audioUrl) {
|
||||||
|
this.isPlay = true;
|
||||||
document.querySelector('#audioPlay').src = audioUrl;
|
document.querySelector('#audioPlay').src = audioUrl;
|
||||||
document.querySelector('#audioPlay').play();
|
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() {
|
// conversationChange() {
|
||||||
// this.currentAudioList = [];
|
// this.currentAudioList = [];
|
||||||
|
@ -108,9 +108,12 @@ export default {
|
|||||||
// 创建会话
|
// 创建会话
|
||||||
'$store.state.socket.createConversition':function(val) {
|
'$store.state.socket.createConversition':function(val) {
|
||||||
if (this.memberData.length > 0) {
|
if (this.memberData.length > 0) {
|
||||||
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
|
const conversitionMember = this.memberData.find(member=>{ return member.userId == this.$store.state.user.id; });
|
||||||
if (member && 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.isHasCoversition = true;
|
||||||
this.isStartRecord = true;
|
this.isStartRecord = true;
|
||||||
this.isQuitShow = true;
|
this.isQuitShow = true;
|
||||||
@ -118,6 +121,7 @@ export default {
|
|||||||
const memberList = [];
|
const memberList = [];
|
||||||
val.memberIds.forEach(id=>{
|
val.memberIds.forEach(id=>{
|
||||||
if (val.creatorId == id) {
|
if (val.creatorId == id) {
|
||||||
|
const member = this.memberData.find(member=>{ return member.id == id; });
|
||||||
member.connect = true;
|
member.connect = true;
|
||||||
memberList.push(member);
|
memberList.push(member);
|
||||||
} else {
|
} else {
|
||||||
@ -177,7 +181,11 @@ export default {
|
|||||||
'$store.state.socket.conversationInfo':function (val, old) { // 仿真聊天
|
'$store.state.socket.conversationInfo':function (val, old) { // 仿真聊天
|
||||||
const simulationText = this.$store.state.socket.conversationInfo;
|
const simulationText = this.$store.state.socket.conversationInfo;
|
||||||
if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) {
|
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) {
|
'$store.state.socket.inviteSimulationConversition':function(val) {
|
||||||
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
|
// const conversitionMember = this.memberData.find(member=>{ return member.id == val.creatorId; });
|
||||||
if (member) {
|
// if (conversitionMember) {
|
||||||
this.inviteUserName = member.label;
|
// this.inviteUserName = conversitionMember.label;
|
||||||
this.conversitionId = val.id;
|
// this.conversitionId = val.id;
|
||||||
member.connect = true;
|
// conversitionMember.connect = true;
|
||||||
member.online = true;
|
// conversitionMember.online = true;
|
||||||
this.inviteUser = member;
|
// this.inviteUser = conversitionMember;
|
||||||
|
//
|
||||||
this.currentMemberList.push(member);
|
// this.currentMemberList.push(conversitionMember);
|
||||||
const member = this.memberData.find(member=>{ return member.id == val.memberId; });
|
// const member = this.memberData.find(member=>{ return member.id == val.memberId; });
|
||||||
member.connect = true;
|
// member.connect = true;
|
||||||
this.currentMemberList.push(member);
|
// this.currentMemberList.push(member);
|
||||||
this.isStartRecord = true;
|
// this.isStartRecord = true;
|
||||||
|
// this.isHasCoversition = true;
|
||||||
// this.$refs.chatbox.inviteMember();
|
// // this.$refs.chatbox.inviteMember();
|
||||||
this.$message.success(this.inviteUserName + '与你开启会话');
|
// this.$message.success(this.inviteUserName + '与你开启会话');
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -254,6 +262,10 @@ export default {
|
|||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
},
|
},
|
||||||
|
coverName(inviteUser) {
|
||||||
|
const member = this.memberData.find(member=>{ return member.id == inviteUser.creatorId; });
|
||||||
|
return member.label;
|
||||||
|
},
|
||||||
clearAllData() {
|
clearAllData() {
|
||||||
this.resetCoversition();
|
this.resetCoversition();
|
||||||
this.createCoversition = true;
|
this.createCoversition = true;
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
<div class="record_tip_confirm" @click="stopRecording()">确定</div>
|
<div class="record_tip_confirm" @click="stopRecording()">确定</div>
|
||||||
<div class="record_tip_cancle" @click="cancleRecording()">取消</div>
|
<div class="record_tip_cancle" @click="cancleRecording()">取消</div>
|
||||||
</div>
|
</div>
|
||||||
<chat-member-list ref="chatMemberList" :conversition-member-list="conversitionMemberList" :simulation-users="simulationUsers" @connectMember="connectMember" />
|
<chat-member-list ref="chatMemberList" :conversition-member-list="conversitionMemberList" :simulation-users="simulationUsers" />
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-box-footer">
|
<div class="chat-box-footer">
|
||||||
<div class="chat-box-footer-tool" />
|
<div class="chat-box-footer-tool" />
|
||||||
@ -169,7 +169,8 @@ export default {
|
|||||||
isConversitionCreator: false,
|
isConversitionCreator: false,
|
||||||
messageList: [],
|
messageList: [],
|
||||||
commonMessageList: [],
|
commonMessageList: [],
|
||||||
privateMessageList: []
|
privateMessageList: [],
|
||||||
|
temData: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
@ -217,9 +218,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
'$store.state.socket.createConversition':function(val) {
|
'$store.state.socket.createConversition':function(val) {
|
||||||
const member = this.memberData[val.creatorId];
|
const member = this.temData.find(member=>{ return member.userId == this.$store.state.user.id; });
|
||||||
if (member && member.userId == this.$store.state.user.id) {
|
if (member && val.memberIds.includes(member.id)) {
|
||||||
const memberList = [];
|
const memberList = [];
|
||||||
|
if (val.creatorId !== member.id) {
|
||||||
|
this.$message.success(this.coverName(val) + '与你开启会话');
|
||||||
|
}
|
||||||
val.memberIds.forEach(id=>{
|
val.memberIds.forEach(id=>{
|
||||||
if (val.creatorId == id) {
|
if (val.creatorId == id) {
|
||||||
memberList.push({memberId:id, connect:true});
|
memberList.push({memberId:id, connect:true});
|
||||||
@ -278,6 +282,12 @@ export default {
|
|||||||
this.$refs.tree.filter(this.queryMember);
|
this.$refs.tree.filter(this.queryMember);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'$store.state.socket.inviteSimulationConversition':function(val) {
|
||||||
|
// this.userName = this.coverName(val);
|
||||||
|
// this.conversitionId = val.id;
|
||||||
|
// this.commonConversation = false;
|
||||||
|
// this.$message.success(this.userName + '与你开启会话');
|
||||||
|
},
|
||||||
'$store.state.training.simulationUserList': {
|
'$store.state.training.simulationUserList': {
|
||||||
handler(val, o) {
|
handler(val, o) {
|
||||||
this.simulationUsers = {};
|
this.simulationUsers = {};
|
||||||
@ -361,6 +371,7 @@ export default {
|
|||||||
type: 'role',
|
type: 'role',
|
||||||
children: depotDispatcherList
|
children: depotDispatcherList
|
||||||
}];
|
}];
|
||||||
|
this.temData = [...dispatcherList, ...stationSupervisorList, ...driverList, ...maintainerList, ...depotDispatcherList];
|
||||||
this.initCommonMemberList();
|
this.initCommonMemberList();
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.tree) {
|
if (this.$refs.tree) {
|
||||||
@ -410,6 +421,15 @@ export default {
|
|||||||
this.userString = '群聊列表为空, 请选择人员';
|
this.userString = '群聊列表为空, 请选择人员';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
coverName(inviteUser) {
|
||||||
|
const member = this.$store.state.training.memberData[inviteUser.creatorId];
|
||||||
|
if (member.userId) {
|
||||||
|
const user = this.simulationUsers[member.userId];
|
||||||
|
return member.label + '(' + user.nickName + ')';
|
||||||
|
} else {
|
||||||
|
return member.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
// 语音录制开始
|
// 语音录制开始
|
||||||
startRecording() {
|
startRecording() {
|
||||||
this.scriptTip = '';
|
this.scriptTip = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user