t添加了提示和直播
This commit is contained in:
@@ -50,7 +50,7 @@ function IMService() {
|
||||
//群聊消息记录,map格式,每个群对应一个数组
|
||||
this.groupMessages = {};
|
||||
|
||||
|
||||
this.uid = 0;
|
||||
/*
|
||||
* 监听器们
|
||||
*
|
||||
@@ -77,6 +77,10 @@ function IMService() {
|
||||
this.whenOnlineUserChange = function () {
|
||||
|
||||
};
|
||||
this.warrings = function() {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//登录
|
||||
@@ -258,6 +262,11 @@ IMService.prototype.initialIMListeners = function () {
|
||||
//监听私聊消息
|
||||
this.im.on(GoEasyIM.EVENT.PRIVATE_MESSAGE_RECEIVED, (message) => {
|
||||
console.log(message)
|
||||
if(message.senderId == 0){
|
||||
console.log(message.payload.text)
|
||||
this.warrings(JSON.parse(message.payload.text))
|
||||
return;
|
||||
}
|
||||
//如果不是自己发的,朋友未读消息数 +1
|
||||
if (message.senderId != this.currentUser.uuid) {
|
||||
let friend = this.friends[message.senderId];
|
||||
@@ -275,6 +284,14 @@ IMService.prototype.initialIMListeners = function () {
|
||||
friends.sort(paixu)
|
||||
|
||||
}
|
||||
if(message.senderId != this.uid){
|
||||
const innerAudioContext = uni.createInnerAudioContext();
|
||||
innerAudioContext.autoplay = true;
|
||||
innerAudioContext.src = 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/audio/music.mp3';
|
||||
innerAudioContext.onPlay(() => {
|
||||
console.log('开始播放');
|
||||
});
|
||||
}
|
||||
|
||||
let that = this
|
||||
if(!friend && friend == undefined){
|
||||
|
||||
Reference in New Issue
Block a user