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) {