From 4888cf2ad172aed1a3548dfef5cb1b23bef84d44 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 24 Feb 2022 13:19:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=92=A4=E5=9B=9E=E4=BF=AE?= =?UTF-8?q?=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