From 224965c7747ba26bd6c4f52d7d35f1c0f6b71718 Mon Sep 17 00:00:00 2001 From: ysn <2126564605@qq.com> Date: Thu, 18 Jun 2026 17:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF-=E7=BE=A4=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/message/components/GroupSetting.vue | 28 +++++++++---- .../message/components/MessageDisplay.vue | 41 ++++++++++--------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/views/message/components/GroupSetting.vue b/src/views/message/components/GroupSetting.vue index 3de6da1..1c23d66 100644 --- a/src/views/message/components/GroupSetting.vue +++ b/src/views/message/components/GroupSetting.vue @@ -9,7 +9,10 @@ >
-
+
群成员 {{ groupInfo.user_num }}人
-
+
- {{ member.name }} + {{ + member.name + }}
群管理员
@@ -93,12 +105,14 @@ member.avatar " /> - {{ member.name }} + {{ + member.name + }}
-
+
退出群组 @@ -369,7 +383,7 @@ export default { font-size: 12px; color: #606266; text-align: center; - width: 100%; + width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/src/views/message/components/MessageDisplay.vue b/src/views/message/components/MessageDisplay.vue index 5e2fc2a..ac39ba8 100644 --- a/src/views/message/components/MessageDisplay.vue +++ b/src/views/message/components/MessageDisplay.vue @@ -19,7 +19,7 @@ type="text" icon="el-icon-s-tools" @click="handleGroupSetting" - v-if="currentChat && currentChat.scene === ContactsScene.GROUP" + v-if="currentChat" />
@@ -676,14 +676,11 @@ export default { text = text.replace(/\n/g, "
"); // @高亮 - 添加 data 属性存储用户名和索引 let atIndex = 0; - text = text.replace( - /@([^\s@]+)/g, - (match, username) => { - const result = `@${username}`; - atIndex++; - return result; - } - ); + text = text.replace(/@([^\s@]+)/g, (match, username) => { + const result = `@${username}`; + atIndex++; + return result; + }); // URL链接 text = text.replace( /(https?:\/\/[^\s]+)/g, @@ -697,11 +694,11 @@ export default { if (target.classList.contains("at-highlight")) { const username = target.dataset.username; const atIndex = parseInt(target.dataset.atIndex, 10); - + // 从 at_users(tp_ids)中根据顺序取出对应的用户 ID const tpIds = msg.at_users || msg.tp_ids || []; const userId = tpIds[atIndex]; - + if (userId) { this.getUserInfoById(userId); } else if (username) { @@ -713,9 +710,9 @@ export default { async getUserInfoById(userId) { try { const response = await this.$http.get(`/api/v1/users/info`, { - params: { user_id: userId } + params: { user_id: userId }, }); - + if (response.data.code === 200) { const userInfo = response.data.data; this.showUserInfoModal(userInfo); @@ -729,19 +726,25 @@ export default { }, showUserInfoModal(userInfo) { - this.$alert(` + this.$alert( + `
-

${userInfo.name || userInfo.username}

+

${ + userInfo.name || userInfo.username + }

账号:${userInfo.username}

手机:${userInfo.phone || "-"}

邮箱:${userInfo.email || "-"}

部门:${userInfo.department || "-"}

职位:${userInfo.position || "-"}

- `, '用户信息', { - dangerouslyUseHTMLString: true, - confirmButtonText: '关闭' - }); + `, + "用户信息", + { + dangerouslyUseHTMLString: true, + confirmButtonText: "关闭", + } + ); }, getFileUrl(pathOrUrl) {