This commit is contained in:
luyuan 2020-08-13 16:03:01 +08:00
parent 4413250c40
commit ca9b43a597
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 33 additions and 0 deletions

View File

@ -68,6 +68,7 @@
</div>
<div class="record-loading" v-if="audio.recording"></div>
<video style="width:100%;height: 100%" :src="video.url" v-if="video.visible" id="videoPlayer" autoplay="true" @fullscreenchange="onVideoFullScreenChange" @play="onVideoPlayStart"></video>
<u-toast ref="uToast" />
</div>
</template>
@ -191,6 +192,13 @@
})
},
sendMessage() {//
if(!this.imService.status){
this.$refs.uToast.show({
title: '连接聊天中,请稍候',
type: 'warning'
})
return
}
if (this.content.trim() != '') {
this.imService.sendPrivateTextMessage(this.friend.uuid, this.content);
let that = this
@ -209,6 +217,13 @@
this.imService.loadPrivateHistoryMessage(this.friend.uuid, lastMessageTimeStamp);
},
onRecordStart () {
if(!this.imService.status){
this.$refs.uToast.show({
title: '连接聊天中,请稍候',
type: 'warning'
})
return
}
try{
recorderManager.start();
}catch(e){
@ -231,6 +246,13 @@
}
},
sendVideo () {//
if(!this.imService.status){
this.$refs.uToast.show({
title: '连接聊天中,请稍候',
type: 'warning'
})
return
}
uni.chooseVideo({
success : (res) => {
console.log(res)
@ -239,6 +261,13 @@
})
},
sendImage() {
if(!this.imService.status){
this.$refs.uToast.show({
title: '连接聊天中,请稍候',
type: 'warning'
})
return
}
uni.chooseImage({
count :1,
success :(res) => {
@ -248,6 +277,7 @@
})
},
showImageFullScreen (e) {
var imagesUrl = [e.currentTarget.dataset.url];
uni.previewImage({
urls: imagesUrl

View File

@ -37,6 +37,7 @@ function IMService() {
host:'hangzhou.goeasy.io',//qos=1
appkey:'BC-453aa755c4ea48148abefc55a86df283'
});
this.status = false
//当前“我”
this.currentUser = null;
//我的好友
@ -236,10 +237,12 @@ IMService.prototype.connectIM = function () {
IMService.prototype.initialIMListeners = function () {
this.im.on(GoEasyIM.EVENT.CONNECTED, () => {
console.log('连接成功.')
this.status = true
});
this.im.on(GoEasyIM.EVENT.DISCONNECTED, () => {
console.log('连接断开.')
this.status = false
});
//监听好友上下线