From 7bc22c0cc2f2d56d119ecd4c5bdb88a57055a789 Mon Sep 17 00:00:00 2001 From: xsx <825657193@qq.com> Date: Tue, 21 Jan 2025 01:39:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-uniapp/App.vue | 2 ++ im-uniapp/components/chat-item/chat-item.vue | 16 +++++++----- im-uniapp/pages/chat/chat.vue | 27 ++++++++++++++------ 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/im-uniapp/App.vue b/im-uniapp/App.vue index 51d11e6..0f62016 100644 --- a/im-uniapp/App.vue +++ b/im-uniapp/App.vue @@ -9,6 +9,7 @@ import UNI_APP from '@/.env.js' export default { data() { return { + isInit: false, // 是否已经初始化 isExit: false, // 是否已退出 audioTip: null, reconnecting: false // 正在重连标志 @@ -21,6 +22,7 @@ export default { this.loadStore().then(() => { // 初始化websocket this.initWebSocket(); + this.isInit = true; }).catch((e) => { console.log(e); this.exit(); diff --git a/im-uniapp/components/chat-item/chat-item.vue b/im-uniapp/components/chat-item/chat-item.vue index ed985f6..288adef 100644 --- a/im-uniapp/components/chat-item/chat-item.vue +++ b/im-uniapp/components/chat-item/chat-item.vue @@ -42,8 +42,15 @@ export default { } }, methods: { - showChatBox() { + // 初始化期间进入会话会导致消息不刷新 + if(!getApp().$vm.isInit || this.chatStore.isLoading()){ + uni.showToast({ + title: "正在初始化页面,请稍后...", + icon: 'none' + }) + return; + } uni.navigateTo({ url: "/pages/chat/chat-box?chatIdx=" + this.index }) @@ -155,7 +162,8 @@ export default { font-size: $im-font-size-smaller; color: $im-text-color-lighter; padding-top: 8rpx; - + align-items: center; + .chat-at-text { color: $im-color-danger; } @@ -170,10 +178,6 @@ export default { overflow: hidden; text-overflow: ellipsis; - img { - width: 40rpx !important; - height: 40rpx !important; - } } } diff --git a/im-uniapp/pages/chat/chat.vue b/im-uniapp/pages/chat/chat.vue index 502f91f..43912d9 100644 --- a/im-uniapp/pages/chat/chat.vue +++ b/im-uniapp/pages/chat/chat.vue @@ -1,14 +1,20 @@