From ecb270f48daa3d33397ca2b20fbf8325a9e1b5b6 Mon Sep 17 00:00:00 2001 From: "xie.bx" Date: Mon, 16 Oct 2023 22:18:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=82=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=A0=87=E5=BF=97=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat-message-item/chat-message-item.vue | 8 ++------ im-uniapp/components/pop-menu/pop-menu.vue | 1 - im-uniapp/store/chatStore.js | 12 ++++++++++-- 3 files changed, 12 insertions(+), 9 deletions(-) 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 83bbb02..f0c3ee1 100644 --- a/im-uniapp/components/chat-message-item/chat-message-item.vue +++ b/im-uniapp/components/chat-message-item/chat-message-item.vue @@ -141,14 +141,10 @@ }, computed: { loading() { - return !this.isTimeout && this.msgInfo.loadStatus && this.msgInfo.loadStatus === "loading"; + return this.msgInfo.loadStatus && this.msgInfo.loadStatus === "loading"; }, loadFail() { - return this.msgInfo.loadStatus && (this.isTimeout || this.msgInfo.loadStatus === "fail"); - }, - isTimeout() { - return (new Date().getTime() - new Date(this.msgInfo.sendTime).getTime()) > 30 * 1000; - + return this.msgInfo.loadStatus && (this.msgInfo.loadStatus === "fail"); }, data() { return JSON.parse(this.msgInfo.content) diff --git a/im-uniapp/components/pop-menu/pop-menu.vue b/im-uniapp/components/pop-menu/pop-menu.vue index 065890a..d5cc19c 100644 --- a/im-uniapp/components/pop-menu/pop-menu.vue +++ b/im-uniapp/components/pop-menu/pop-menu.vue @@ -48,7 +48,6 @@ } .menu { - width: 250rpx; position: fixed; border: 1px solid #d0d0d0; box-shadow: 0 0 20rpx gray; diff --git a/im-uniapp/store/chatStore.js b/im-uniapp/store/chatStore.js index 60c4c91..b2ccbdc 100644 --- a/im-uniapp/store/chatStore.js +++ b/im-uniapp/store/chatStore.js @@ -8,7 +8,15 @@ export default { }, mutations: { - setChats(state,chats){ + initChats(state,chats){ + // 防止图片一直处在加载中状态 + chats.forEach((chat)=>{ + chat.messages.forEach((msg)=>{ + if(msg.loadStatus == "loading"){ + msg.loadStatus = "fail" + } + }) + }) state.chats = chats; }, openChat(state, chatInfo) { @@ -190,7 +198,7 @@ export default { uni.getStorage({ key:"chats-"+userId, success(res) { - context.commit("setChats",res.data); + context.commit("initChats",res.data); resolve() }, fail(e) {