diff --git a/pageD/privateChat/privateChat.vue b/pageD/privateChat/privateChat.vue
index 4509e4a..aa55234 100644
--- a/pageD/privateChat/privateChat.vue
+++ b/pageD/privateChat/privateChat.vue
@@ -68,6 +68,7 @@
+
@@ -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
diff --git a/static/imservice.js b/static/imservice.js
index 098524d..57453ef 100644
--- a/static/imservice.js
+++ b/static/imservice.js
@@ -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
});
//监听好友上下线