From b8291a4222a942ebd0c90c0cc658effbbfccc73f Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 24 Feb 2022 11:34:28 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=95=BF=E6=8C=89=E7=BE=A4=E4=B8=BB?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=B1=95=E7=A4=BA=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/components/groupUserList.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pages/im/components/groupUserList.vue b/pages/im/components/groupUserList.vue index 281b643..a4009aa 100644 --- a/pages/im/components/groupUserList.vue +++ b/pages/im/components/groupUserList.vue @@ -104,7 +104,10 @@ hideAction(item) { this.actionShow = false }, - showAction(item) { + showAction(item) { + if (item.is_admin == 2) { + return + } this.currentUser = item this.actionTitle = item.name // 只有管理员以上才会弹窗 From 4760adc504ee903ea0b96ab57b6b5782fccd1be9 Mon Sep 17 00:00:00 2001 From: zhangdongxue Date: Thu, 24 Feb 2022 11:50:33 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E4=BF=A1?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=8F=AF=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/friends/mine.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pages/im/friends/mine.vue b/pages/im/friends/mine.vue index ee25682..8b3a920 100644 --- a/pages/im/friends/mine.vue +++ b/pages/im/friends/mine.vue @@ -4,7 +4,7 @@ - + {{infoObj.name}} {{infoObj.address}} @@ -47,7 +47,13 @@ this.infoObj = res }) }, - methods: { + methods: { + previewImg(item){ + console.log(item) + uni.previewImage({ + urls:[item] + }) + }, copy() { uni.setClipboardData({ data: this.downUrl, @@ -100,7 +106,7 @@ .avatar { // padding: 14rpx; - border-radius: 10rpx; + border-radius: 20rpx; background-color: #fff; border: solid 14rpx rgba($color: #fff, $alpha:1); } From fb6f5697c700b700ff3f8e896cbc32f803dd6347 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 24 Feb 2022 11:52:24 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E5=88=B0=E7=BE=A4?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=BE=A4=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/group/chat.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/im/group/chat.vue b/pages/im/group/chat.vue index ac1260c..d5a3aa2 100644 --- a/pages/im/group/chat.vue +++ b/pages/im/group/chat.vue @@ -119,6 +119,7 @@ initGroupInfo() { // 获取群信息,成员数量,设置标题 getGroupBase(this.targetId).then(res => { + this.$store.dispatch('updateContact', res) uni.setNavigationBarTitle({ title: res.name + `(${res.members})` }) From 831776f7dda89ba4ae84bc2c3fcfe8c55e58955b Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 24 Feb 2022 12:10:06 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A5=BD=E5=8F=8B?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=AF=B9=E6=96=B9=E4=B9=9F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BC=9A=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/group/chat.vue | 1 - utils/im/listeners.js | 33 ++++++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/pages/im/group/chat.vue b/pages/im/group/chat.vue index d5a3aa2..ac1260c 100644 --- a/pages/im/group/chat.vue +++ b/pages/im/group/chat.vue @@ -119,7 +119,6 @@ initGroupInfo() { // 获取群信息,成员数量,设置标题 getGroupBase(this.targetId).then(res => { - this.$store.dispatch('updateContact', res) uni.setNavigationBarTitle({ title: res.name + `(${res.members})` }) diff --git a/utils/im/listeners.js b/utils/im/listeners.js index 0555ba7..ecd4614 100644 --- a/utils/im/listeners.js +++ b/utils/im/listeners.js @@ -67,7 +67,7 @@ const imLibListeners = () => { // 添加消息监听函数 IMLib.addReceiveMessageListener((res) => { const message = res.data.message - console.error('[收到消息]',IMLib.ObjectName.GroupNotification, message) + console.error('[收到消息]', message) checkContactExists(message) if (utils.inArray(message.objectName, notifyMsgTypes)) { onReceiveMessage(message) @@ -78,29 +78,36 @@ const imLibListeners = () => { // 调用完更新之后,删除这条消息 IMLib.deleteMessagesByIds([message.messageId]) } else if (message.objectName === IMLib.ObjectName.ContactNotification) { - // 触发一个新好友的通知事件,【会话列表,通讯录,新朋友】页面 - uni.$emit('onNewContactConversation', message) - uni.$emit('onNewContactFriends', message) - uni.$emit('onNewContactPendings', message) - } else if (message.objectName === IMLib.ObjectName.GroupNotification) { - console.log('踢出用户',message); + if (message.content.operation === 'Request') { + // 触发一个新好友的通知事件,【会话列表,通讯录,新朋友】页面 + uni.$emit('onNewContactConversation', message) + uni.$emit('onNewContactFriends', message) + uni.$emit('onNewContactPendings', message) + } else if (message.content.operation === 'Delete') { + console.log('解除好友关系', message.targetId); + IMLib.cleanHistoryMessages(1, message.targetId, message.sentTime, false) + // 解散了就删了吧 + IMLib.removeConversation(1, message.targetId) + // 刷新会话列表 + uni.$emit('onReceiveMessage', message) + } + } else if (message.objectName === IMLib.ObjectName.GroupNotification) { // 解散群 if (message.content.operation === 'Dismiss') { - IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime, + IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime, false) // 解散了就删了吧 - IMLib.removeConversation(message.conversationType, message.targetId) + IMLib.removeConversation(3, message.targetId) // 发布群解散的消息 uni.$emit('onGroupDismiss') uni.$emit('onGroupDismiss_' + message.targetId) - } else if (message.content.operation === 'REMOVE') { - console.log('踢出', message.content); + } else if (message.content.operation === 'REMOVE') { // 要判断是否当前用户,然后把当前用户踢出到主页去, 删除聊天记录,会话列表 if (message.content.extra == store.getters.sender.userId) { - IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime, + IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime, false) // 解散了就删了吧 - IMLib.removeConversation(message.conversationType, message.targetId) + IMLib.removeConversation(3, message.targetId) // 为了更新群列表 uni.$emit('onGroupDismiss') uni.$emit('onGroupRemoveYou_' + message.targetId) From 0eb6be37be1902ca1eee741198cdea98d402164c Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 24 Feb 2022 13:03:41 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E8=A7=A3=E9=99=A4=EF=BC=8C=E4=BB=8E=E4=BC=9A=E8=AF=9D=E9=A1=B5?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/private/chat.vue | 10 ++++++++++ utils/im/listeners.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/im/private/chat.vue b/pages/im/private/chat.vue index 65c7491..f74b500 100644 --- a/pages/im/private/chat.vue +++ b/pages/im/private/chat.vue @@ -84,8 +84,18 @@ } }) }) + uni.$once('onUserDelete_' + this.targetId, () => { + uni.showToast({ + icon: 'none', + title: '好友关系已解除' + }) + uni.switchTab({ + url: '/pages/im/index' + }) + }) }, onUnload() { + uni.$off('onUserDelete_' + this.targetId) uni.$off('onReceiveMessage_' + this.targetId) uni.$off('onRecallMessage_' + this.targetId) uni.$off('onRecallMessage') diff --git a/utils/im/listeners.js b/utils/im/listeners.js index ecd4614..bad1d7a 100644 --- a/utils/im/listeners.js +++ b/utils/im/listeners.js @@ -84,11 +84,11 @@ const imLibListeners = () => { uni.$emit('onNewContactFriends', message) uni.$emit('onNewContactPendings', message) } else if (message.content.operation === 'Delete') { - console.log('解除好友关系', message.targetId); IMLib.cleanHistoryMessages(1, message.targetId, message.sentTime, false) // 解散了就删了吧 IMLib.removeConversation(1, message.targetId) - // 刷新会话列表 + // 刷新会话列表 + uni.$emit('onUserDelete_' + message.targetId) uni.$emit('onReceiveMessage', message) } } else if (message.objectName === IMLib.ObjectName.GroupNotification) { From 4888cf2ad172aed1a3548dfef5cb1b23bef84d44 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 24 Feb 2022 13:19:59 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/components/showMessageCell.vue | 4 ++-- store/modules/im.js | 12 ++++++++---- utils/im/index.js | 2 +- utils/im/models.js | 8 ++++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pages/im/components/showMessageCell.vue b/pages/im/components/showMessageCell.vue index 395eac3..1c8e2ac 100644 --- a/pages/im/components/showMessageCell.vue +++ b/pages/im/components/showMessageCell.vue @@ -121,8 +121,8 @@ icon: 'none', title: '消息撤回成功' }) - IMLib.getMessage(this.message.messageId, res => { - uni.$emit('onRecallMessage', res.message) + IMLib.getMessage(this.message.messageId, res => { + uni.$emit('onRecallMessage_' + this.message.targetId, res.message) }) } else { uni.showToast({ diff --git a/store/modules/im.js b/store/modules/im.js index fdc88d5..770eb7e 100644 --- a/store/modules/im.js +++ b/store/modules/im.js @@ -76,7 +76,8 @@ export default { name: contactInfo.name, hash: contactInfo.hash, portraitUrl: contactInfo.portraitUrl, - localAvatar: savedFilePath + localAvatar: savedFilePath, + type: contactInfo.type } model.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => { @@ -90,7 +91,8 @@ export default { name: contactInfo.name, hash: contactInfo.hash, portraitUrl: contactInfo.portraitUrl, - localAvatar: result[0].localAvatar + localAvatar: result[0].localAvatar, + type: contactInfo.type } model.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => { console.log('UPDATE NAME, ERR', err, info); @@ -117,7 +119,8 @@ export default { name: contactInfo.name, hash: contactInfo.hash, portraitUrl: contactInfo.portraitUrl, - localAvatar: savedFilePath + localAvatar: savedFilePath, + type: contactInfo.type } model.insert(info, (err, res) => {}) // 保存头像后,更新信息 @@ -130,7 +133,8 @@ export default { name: contactInfo.name, hash: contactInfo.hash, portraitUrl: contactInfo.portraitUrl, - localAvatar: '' + localAvatar: '', + type: contactInfo.type } model.insert(info, (err, res) => {}) } diff --git a/utils/im/index.js b/utils/im/index.js index 320af90..ca8477c 100644 --- a/utils/im/index.js +++ b/utils/im/index.js @@ -62,7 +62,7 @@ const connect = (token, userInfo, callback) => { // 设置未读消息数量 setNotifyBadge() // 首次运行获取好友列表 - const FK = 'ZHKD_' + userInfo.targetId + const FK = 'ZH_V_' + userInfo.targetId uni.getStorage({ key: FK, diff --git a/utils/im/models.js b/utils/im/models.js index a7c6ef0..e7d4031 100644 --- a/utils/im/models.js +++ b/utils/im/models.js @@ -13,9 +13,13 @@ const contactModel = usqlite.model('contacts', { type: String, unique: true }, - portraitUrl: String, + type: { + type: Number, + default: 0 + }, + portraitUrl: String, localAvatar: String -}) +}) export default { contactModel From ae0fa1bde30ba8b55a31a8e44213b143047cacee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= Date: Thu, 24 Feb 2022 14:19:22 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'pages/im/.DS=5FStore'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/im/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pages/im/.DS_Store diff --git a/pages/im/.DS_Store b/pages/im/.DS_Store deleted file mode 100644 index 33ddb7920b287ee287f505ae5118dd9b8ced25a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKI|>3Z5S{S@f{mqRuHX%V=n3`$7J`lJilFsYp39^8=F=>TofgU)n7m{%FCnkk z*%1-l-i{lQm540hhVrmsY_@McvPni12*(+hdvk5iU3(hkz6%(4E+@H4C$|CLc4$<9 z3Qz$mKn1A4rxnNwyI6kuV4g<>sKC!FVBd!VH>`<$pnp0rcnbiWA?${^_Y%Nj0bot+ z0}+8~P=P_!Y%w(Gh?mT(iG5(uMYH+PyjinDQNJDM7f%