14
This commit is contained in:
@@ -44,14 +44,47 @@
|
||||
selectFlag: false,
|
||||
selectItems: [],
|
||||
forwardItems: [],
|
||||
forwardMerge: false
|
||||
forwardMerge: false,
|
||||
Audio:null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentConversation","storeCurrentMsg",'storeCurrentMsgID'
|
||||
]),
|
||||
},
|
||||
created() {
|
||||
this.Audio = uni.createInnerAudioContext(); //音频
|
||||
/*
|
||||
设置音频播放模式,可取值:
|
||||
"ambient" - 不中止其他声音播放,不能后台播放,静音后无声音;
|
||||
"soloAmbient" - 中止其他声音播放,不能后台播放,静音后无声音;
|
||||
"playback" - 中止其他声音,可以后台播放,静音后有声音。
|
||||
默认值为"playback"。
|
||||
*/
|
||||
this.Audio.sessionCategory="soloAmbient";
|
||||
this.Audio.onError((r)=>{
|
||||
console.log(r);
|
||||
this.updateCurrentMsg({});
|
||||
})
|
||||
this.Audio.onEnded((r)=>{
|
||||
console.log(r);
|
||||
this.updateCurrentMsg({});
|
||||
})
|
||||
},
|
||||
watch:{
|
||||
storeCurrentMsgID(nv,ov){
|
||||
if(nv!=ov && nv){
|
||||
if(this.storeCurrentMsg.soundElem.soundPath){
|
||||
this.Audio.src= this.storeCurrentMsg.soundElem.soundPath;
|
||||
this.Audio.play();
|
||||
return ;
|
||||
}
|
||||
this.updateCurrentMsg({});
|
||||
}
|
||||
console.log(nv,ov,this.Audio,this.storeCurrentMsg);
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
//console.log("onload");
|
||||
this.setPageListener();
|
||||
@@ -62,16 +95,25 @@
|
||||
onUnload() {
|
||||
//console.log("unload");
|
||||
this.disposePageListener();
|
||||
markConversationAsRead({
|
||||
...this.$store.getters.storeCurrentConversation,
|
||||
},
|
||||
true
|
||||
);
|
||||
markConversationAsRead({...this.$store.getters.storeCurrentConversation,},true);
|
||||
this.resetConversationState();
|
||||
this.resetMessageState();
|
||||
// #ifdef APP-PLUS
|
||||
if (this.Audio) {
|
||||
this.Audio.stop();
|
||||
this.Audio.destroy();
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
onHide() {
|
||||
// #ifdef APP-PLUS
|
||||
if (this.Audio) {
|
||||
this.Audio.stop();
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
...mapActions("message", ["resetMessageState", "deleteMessages", "pushNewMessage", "updateOneMessage"]),
|
||||
...mapActions("message", ["updateCurrentMsg","resetMessageState", "deleteMessages", "pushNewMessage", "updateOneMessage"]),
|
||||
...mapActions("conversation", ["resetConversationState"]),
|
||||
scrollToBottom(isRecv = false) {
|
||||
this.$refs.chatingListRef.scrollToBottom(false, isRecv);
|
||||
@@ -177,7 +219,6 @@
|
||||
if (!founded) {
|
||||
arr.push(data);
|
||||
}
|
||||
console.log(arr.length);
|
||||
this.selectItems = [...arr];
|
||||
}
|
||||
return;
|
||||
@@ -258,7 +299,14 @@
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.type == 'audio_msg_click'){
|
||||
if(_this.storeCurrentMsgID){
|
||||
_this.updateCurrentMsg({clientMsgID:""});
|
||||
}else{
|
||||
_this.updateCurrentMsg(e.message);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
if (e.type == 'longtapMsgContent') {
|
||||
let menu = [];
|
||||
if (data.contentType == MessageType.TextMessage) {
|
||||
|
||||
Reference in New Issue
Block a user