添加了消息铃声

This commit is contained in:
luyuan 2020-08-27 11:06:11 +08:00
parent af612ef89e
commit 18c99cd668
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
4 changed files with 16 additions and 1 deletions

View File

@ -128,6 +128,8 @@
this.friend = JSON.parse(options.id); this.friend = JSON.parse(options.id);
this.currentUser = this.imService.currentUser; this.currentUser = this.imService.currentUser;
let privateMessages = this.imService.getPrivateMessages(this.friend.uuid); let privateMessages = this.imService.getPrivateMessages(this.friend.uuid);
this.imService.uid = this.friend.uuid;
this.messages = privateMessages.sentMessages; this.messages = privateMessages.sentMessages;
this.pendingMessages = privateMessages.pendingMessages; this.pendingMessages = privateMessages.pendingMessages;
@ -153,6 +155,7 @@
this.imService.onPrivateHistoryLoad = (friendId, messages) =>{}; this.imService.onPrivateHistoryLoad = (friendId, messages) =>{};
// //
this.imService.resetFriendUnReadMessage(this.friend); this.imService.resetFriendUnReadMessage(this.friend);
this.imService.uid = 0;
}, },
methods: { methods: {
bindtapInput(){ bindtapInput(){

View File

@ -29,7 +29,7 @@
<!-- <image class="liketap" src="../../static/like.png" @click=""> --> <!-- <image class="liketap" src="../../static/like.png" @click=""> -->
<view class="danmuinputbox" v-if="danmu"> <view class="danmuinputbox" v-if="danmu">
<input type="text" focus="true" style="width:600rpx;margin-left:30rpx;font-size:26rpx" maxlength="20" @blur="danmu=false" :focus="danmu" v-model="danmutext"> <input type="text" focus="true" style="width:600rpx;margin-left:30rpx;font-size:26rpx" maxlength="100" @blur="danmu=false" :focus="danmu" v-model="danmutext">
<view class="danmufasong" @click="sendMessage(room.MessageType.CHAT,danmutext)"> <view class="danmufasong" @click="sendMessage(room.MessageType.CHAT,danmutext)">
<text style="font-size:24rpx;color:#fff">发送</text> <text style="font-size:24rpx;color:#fff">发送</text>
</view> </view>

View File

@ -8,6 +8,8 @@
import GoEasyIM from './goeasy-im-1.0.9'; import GoEasyIM from './goeasy-im-1.0.9';
// import GoEasyIM from './goeasy-im-1.1.1'; // import GoEasyIM from './goeasy-im-1.1.1';
import restApi from './restapi'; import restApi from './restapi';
import music from './music.mp3'
function Friend(uuid, name, avatar,time = "", text = "",date = "",unReadMessage = 0) { function Friend(uuid, name, avatar,time = "", text = "",date = "",unReadMessage = 0) {
this.uuid = uuid; this.uuid = uuid;
@ -52,6 +54,8 @@ function IMService() {
//群聊消息记录map格式每个群对应一个数组 //群聊消息记录map格式每个群对应一个数组
this.groupMessages = {}; this.groupMessages = {};
this.uid = 0;
/* /*
* 监听器们 * 监听器们
@ -283,6 +287,14 @@ IMService.prototype.initialIMListeners = function () {
friends.sort(paixu) friends.sort(paixu)
} }
if(message.senderId != this.uid){
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = music;
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
}
let that = this let that = this
if(!friend && friend == undefined){ if(!friend && friend == undefined){

BIN
static/music.mp3 Normal file

Binary file not shown.