From f116ef5ea8c7937e5775090a75a77eda0f8abb0b Mon Sep 17 00:00:00 2001 From: "[yxf]" <[1524240689@qq.com]> Date: Wed, 15 Apr 2026 18:27:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=8B=B1=E6=96=87=E4=B8=8E?= =?UTF-8?q?=E6=B8=85=E9=99=A4=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../implatform/controller/UserController.java | 8 -------- im-uniapp/common/date.js | 6 +++--- .../chat-message-item/chat-message-item.vue | 4 ++-- im-uniapp/pages/chat/chat-box.vue | 10 ++++------ im-web/src/api/date.js | 6 +++--- im-web/src/components/chat/ChatBox.vue | 18 ++++++++++-------- im-web/src/components/chat/ChatMessageItem.vue | 4 ++-- im-web/src/store/chatStore.js | 8 +++++--- 8 files changed, 29 insertions(+), 35 deletions(-) diff --git a/im-platform/src/main/java/com/bx/implatform/controller/UserController.java b/im-platform/src/main/java/com/bx/implatform/controller/UserController.java index c434311..6ec4583 100644 --- a/im-platform/src/main/java/com/bx/implatform/controller/UserController.java +++ b/im-platform/src/main/java/com/bx/implatform/controller/UserController.java @@ -68,10 +68,6 @@ public class UserController { Long userId = jsonObject.getLong("userId"); String groupId = jsonObject.getStr("groupIds"); // 前端传分组ID - if (ObjectUtil.isNull(userId) || ObjectUtil.isEmpty(groupId)) { - return ResultUtils.error(ResultCode.PROGRAM_ERROR, "参数不能为空"); - } - userService.saveUserGroup(userId, groupId); return ResultUtils.success(); } @@ -82,10 +78,6 @@ public class UserController { Long userId = jsonObject.getLong("userId"); String labelIds = jsonObject.getStr("labelIds"); -// if (ObjectUtil.isNull(userId) || ObjectUtil.isEmpty(labelIds)) { -// return ResultUtils.error(ResultCode.PROGRAM_ERROR, "参数不能为空"); -// } - userService.saveUserLabel(userId, labelIds); return ResultUtils.success(); } diff --git a/im-uniapp/common/date.js b/im-uniapp/common/date.js index cd4fc17..3407a13 100644 --- a/im-uniapp/common/date.js +++ b/im-uniapp/common/date.js @@ -4,16 +4,16 @@ let toTimeText = (timeStamp, simple) => { var timeDiff = currentTime - dateTime; //与当前时间误差 var timeText = ''; if (timeDiff <= 60000) { //一分钟内 - timeText = '刚刚'; + timeText = 'Just now'; } else if (timeDiff > 60000 && timeDiff < 3600000) { //1小时内 - timeText = Math.floor(timeDiff / 60000) + '分钟前'; + timeText = Math.floor(timeDiff / 60000) + ' minutes ago'; } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { //今日 timeText = formatDateTime(dateTime).substr(11, 5); } else if (isYestday(dateTime)) { //昨天 - timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); + timeText = 'Yesterday ' + formatDateTime(dateTime).substr(11, 5); } else if (isYear(dateTime)) { //今年 timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14); diff --git a/im-uniapp/components/chat-message-item/chat-message-item.vue b/im-uniapp/components/chat-message-item/chat-message-item.vue index 1574785..459ef52 100644 --- a/im-uniapp/components/chat-message-item/chat-message-item.vue +++ b/im-uniapp/components/chat-message-item/chat-message-item.vue @@ -72,8 +72,8 @@ class="send-fail iconfont icon-warning-circle-fill"> - 已读 - 未读 + Read + Unread diff --git a/im-uniapp/pages/chat/chat-box.vue b/im-uniapp/pages/chat/chat-box.vue index 9cdc6f5..081ae2a 100644 --- a/im-uniapp/pages/chat/chat-box.vue +++ b/im-uniapp/pages/chat/chat-box.vue @@ -3,9 +3,8 @@ {{ title }} - - 猜你想问 + @@ -29,7 +28,7 @@ - {{ newMessageSize > 0 ? newMessageSize+'条新消息' :'回到底部'}} + {{ newMessageSize > 0 ? newMessageSize+'条新消息' :'⬇️'}} @@ -1371,11 +1370,10 @@ export default { .scroll-box { height: 100%; - padding-top: 180rpx; /* 给常见问题条留出空间 */ + padding-top: 200rpx; box-sizing: border-box; } - // 猜你想问 样式(完全匹配参考图) .guess-question-box { position: absolute; top: 0; @@ -1406,7 +1404,7 @@ export default { align-items: center; gap: 10rpx; font-size: 30rpx; - color: #009E5F; // 参考图的绿色 + color: #009E5F; cursor: pointer; .item-bullet { diff --git a/im-web/src/api/date.js b/im-web/src/api/date.js index cd4fc17..f215f3b 100644 --- a/im-web/src/api/date.js +++ b/im-web/src/api/date.js @@ -2,18 +2,18 @@ let toTimeText = (timeStamp, simple) => { var dateTime = new Date(timeStamp) var currentTime = Date.parse(new Date()); //当前时间 var timeDiff = currentTime - dateTime; //与当前时间误差 - var timeText = ''; + var timeText = 'Just now'; if (timeDiff <= 60000) { //一分钟内 timeText = '刚刚'; } else if (timeDiff > 60000 && timeDiff < 3600000) { //1小时内 - timeText = Math.floor(timeDiff / 60000) + '分钟前'; + timeText = Math.floor(timeDiff / 60000) + ' minutes ago'; } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { //今日 timeText = formatDateTime(dateTime).substr(11, 5); } else if (isYestday(dateTime)) { //昨天 - timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); + timeText = 'Yesterday ' + formatDateTime(dateTime).substr(11, 5); } else if (isYear(dateTime)) { //今年 timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14); diff --git a/im-web/src/components/chat/ChatBox.vue b/im-web/src/components/chat/ChatBox.vue index c9cb325..2f6938c 100644 --- a/im-web/src/components/chat/ChatBox.vue +++ b/im-web/src/components/chat/ChatBox.vue @@ -75,10 +75,6 @@
来源地址
{{ userInfo.sourceUrl }}
-
-
性别
-
{{ userInfo.sex === 1 ? '女' : '男' }}
-
标签
@@ -108,6 +104,7 @@ @@ -911,17 +908,22 @@ export default { if (!value.trim()) return this.createNewGroup(value.trim()) }) + } else if (groupId === '' || groupId === null || groupId === undefined) { + // 清空分组 + this.doSaveGroup('') } else { this.doSaveGroup(groupId) } }, doSaveGroup(groupId) { + // 如果 groupId 为空字符串,表示移除分组 + const saveGroupId = groupId || ''; this.$http.post('/user/group/save', { userId: this.userInfo.id, - groupIds: String(groupId) + groupIds: String(saveGroupId) }).then(() => { - console.log('res',groupId) - this.$message.success('分组设置成功') + console.log('res', saveGroupId) + this.$message.success(saveGroupId ? '分组设置成功' : '已移除分组') this.loadFriend(this.chat.targetId) }) }, @@ -1376,7 +1378,7 @@ export default { word-break: break-all; ::v-deep .el-select { .el-tag { - background-color: #4d4949 !important; + background-color: #bdbaba !important; color: #fff !important; border-color: #1d1b1b !important; .el-tag__close { diff --git a/im-web/src/components/chat/ChatMessageItem.vue b/im-web/src/components/chat/ChatMessageItem.vue index edb801c..7489fcd 100644 --- a/im-web/src/components/chat/ChatMessageItem.vue +++ b/im-web/src/components/chat/ChatMessageItem.vue @@ -54,8 +54,8 @@ {{ msgInfo.content }}
- 已读 - 未读 + Read + Unread
diff --git a/im-web/src/store/chatStore.js b/im-web/src/store/chatStore.js index f3658b1..91d0c75 100644 --- a/im-web/src/store/chatStore.js +++ b/im-web/src/store/chatStore.js @@ -30,7 +30,7 @@ export default defineStore('chatStore', { chats: [], privateMsgMaxId: 0, groupMsgMaxId: 0, - loading: false + loading: true } }, actions: { @@ -95,7 +95,9 @@ export default defineStore('chatStore', { readedMessage(pos) { let chat = this.findChatByFriend(pos.friendId); if (!chat) return; - for (let idx = chat.readedMessageIdx; idx < chat.messages.length; idx++) { + // 已读回执没有做可靠性投递,通过回溯100条的方式去修正 + let idx = Math.max(0, chat.readedMessageIdx - 100); + for (; idx < chat.messages.length; idx++) { let m = chat.messages[idx]; if (m.id && m.selfSend && m.status < MESSAGE_STATUS.RECALL) { // pos.maxId为空表示整个会话已读 @@ -449,7 +451,7 @@ export default defineStore('chatStore', { this.activeChat = null; this.privateMsgMaxId = 0; this.groupMsgMaxId = 0; - this.loading = false; + this.loading = true; }, loadChat() { return new Promise((resolve, reject) => {