From 12913617c19885c515fc7f36ad8ca916018436d0 Mon Sep 17 00:00:00 2001 From: zengBin Date: Thu, 31 Oct 2024 18:05:31 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=BD=91=E6=98=93=E4=BA=91=E4=BF=A1?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=80=9A=E7=9F=A5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.wpy | 3 +- src/pages/news/editGroupMembers.wpy | 293 +++++++++++++++++++++++++ src/pages/news/groupChitchat.wpy | 57 ++++- src/pages/news/groupChitchatDetail.wpy | 30 ++- src/utils/im.js | 71 +++--- 5 files changed, 411 insertions(+), 43 deletions(-) create mode 100644 src/pages/news/editGroupMembers.wpy diff --git a/src/app.wpy b/src/app.wpy index 9932905..21bf44b 100644 --- a/src/app.wpy +++ b/src/app.wpy @@ -35,7 +35,7 @@ wepy.app({ } }, globalData: { - versions: 'v5.5.74', // 版本号 + versions: 'v5.5.75', // 版本号 navBarHeight: 0, // 导航栏高度 navRight: 0, // 胶囊距右方间距(方保持左、右间距一致) navTop: 0, // 胶囊距顶部间距 @@ -180,6 +180,7 @@ subPackages: [ 'root': 'pages/news', 'pages': [ 'chitchat', +'editGroupMembers', 'friendRequest', 'groupChitchat', 'groupChitchatDetail', diff --git a/src/pages/news/editGroupMembers.wpy b/src/pages/news/editGroupMembers.wpy new file mode 100644 index 0000000..a5ae0dc --- /dev/null +++ b/src/pages/news/editGroupMembers.wpy @@ -0,0 +1,293 @@ + + + + + +{ +navigationBarTitleText: '', +backgroundColorTop: '#ffffff', +backgroundColorBottom: '#ffffff', +} + diff --git a/src/pages/news/groupChitchat.wpy b/src/pages/news/groupChitchat.wpy index 246b757..9077cf8 100644 --- a/src/pages/news/groupChitchat.wpy +++ b/src/pages/news/groupChitchat.wpy @@ -1000,6 +1000,7 @@ wepy.page({ if (e.to != vm.otherUserId) { return } + console.log(e, '777') // 标记IM消息已读 vm.sendMsgReceipt() if (e.type == 'text' && /\[[^\]]+\]/.test(e.body)) { @@ -1326,12 +1327,62 @@ wepy.page({ // 群通知消息判断 groupNotification (e) { let text = `` - if (e.type == '7' && e.attach.type == 'addTeamMembers') { - text = `${e.attach.users[1].nick}邀请${e.attach.users[0].nick}加入群` + // 内部接口判断邀请加入群 + if (e.type == '7' && e.body_arr.id == 0) { + if (e.body_arr.data.uinfos.length > 2) { + text = `${e.body_arr.data.uinfos[e.body_arr.data.uinfos.length - 1][3]}邀请${e.body_arr.data.uinfos[0][3]}等${e.body_arr.data.uinfos.length - 1}人加入群` + } else { + text = `${e.body_arr.data.uinfos[1][3]}邀请${e.body_arr.data.uinfos[0][3]}加入群` + } } - if (e.type == '7' && e.attach.type == 'leaveTeam') { + // 内部接口判断踢出群 + if (e.type == '7' && e.body_arr.id == 1) { + if (e.body_arr.data.uinfos.length > 2) { + text = `${e.body_arr.data.uinfos[e.body_arr.data.uinfos.length - 1][3]}将${e.body_arr.data.uinfos[0][3]}等${e.body_arr.data.uinfos.length - 1}人踢出群` + } else { + text = `${e.body_arr.data.uinfos[1][3]}将${e.body_arr.data.uinfos[0][3]}踢出群` + } + } + // 内部接口判断退出群聊 + if (e.type == '7' && e.body_arr.id == 2) { + text = `${e.body_arr.data.uinfos[0][3]}退出群` + } + // 内部接口判断将谁设为管理员 + if (e.type == '7' && e.body_arr.id == 7) { + text = `${e.body_arr.data.uinfos[1][3]}将${e.body_arr.data.uinfos[0][3]}设为管理员` + } + // 内部接口判断将谁取消管理员 + if (e.type == '7' && e.body_arr.id == 8) { + text = `${e.body_arr.data.uinfos[1][3]}取消${e.body_arr.data.uinfos[0][3]}的管理员身份` + } + // 网易云信回调邀请进群 + if (e.type == 'notification' && e.attach.type == 'addTeamMembers') { + if (e.attach.users.length > 2) { + text = `${e.attach.users[e.attach.users.length - 1].nick}邀请${e.attach.users[0].nick}等${e.attach.users.length - 1}人加入群` + } else { + text = `${e.attach.users[1].nick}邀请${e.attach.users[0].nick}加入群` + } + } + // 网易云信回调添加管理员身份 + if (e.type == 'notification' && e.attach.type == 'addTeamManagers') { + text = `${e.attach.users[1].nick}将${e.attach.users[0].nick}设为管理员` + } + // 网易云信回调删除管理员身份 + if (e.type == 'notification' && e.attach.type == 'removeTeamManagers') { + text = `${e.attach.users[1].nick}取消${e.attach.users[0].nick}的管理员身份` + } + // 网易云信回调离开群 + if (e.type == 'notification' && e.attach.type == 'leaveTeam') { text = `${e.attach.users[0].nick}离开群` } + // 网易云信回调踢出群 + if (e.type == 'notification' && e.attach.type == 'removeTeamMembers') { + if (e.attach.users.length > 2) { + text = `${e.attach.users[e.attach.users.length - 1].nick}将${e.attach.users[0].nick}等${e.attach.users.length - 1}人踢出群` + } else { + text = `${e.attach.users[1].nick}将${e.attach.users[0].nick}踢出群` + } + } return text }, // 图片大小计算 diff --git a/src/pages/news/groupChitchatDetail.wpy b/src/pages/news/groupChitchatDetail.wpy index 547d480..3b8b0fe 100644 --- a/src/pages/news/groupChitchatDetail.wpy +++ b/src/pages/news/groupChitchatDetail.wpy @@ -137,14 +137,24 @@ page {