Browse Source

修复异常显示文件上传失败标志的bug

master
xie.bx 3 years ago
parent
commit
ecb270f48d
  1. 8
      im-uniapp/components/chat-message-item/chat-message-item.vue
  2. 1
      im-uniapp/components/pop-menu/pop-menu.vue
  3. 12
      im-uniapp/store/chatStore.js

8
im-uniapp/components/chat-message-item/chat-message-item.vue

@ -141,14 +141,10 @@
}, },
computed: { computed: {
loading() { loading() {
return !this.isTimeout && this.msgInfo.loadStatus && this.msgInfo.loadStatus === "loading"; return this.msgInfo.loadStatus && this.msgInfo.loadStatus === "loading";
}, },
loadFail() { loadFail() {
return this.msgInfo.loadStatus && (this.isTimeout || this.msgInfo.loadStatus === "fail"); return this.msgInfo.loadStatus && (this.msgInfo.loadStatus === "fail");
},
isTimeout() {
return (new Date().getTime() - new Date(this.msgInfo.sendTime).getTime()) > 30 * 1000;
}, },
data() { data() {
return JSON.parse(this.msgInfo.content) return JSON.parse(this.msgInfo.content)

1
im-uniapp/components/pop-menu/pop-menu.vue

@ -48,7 +48,6 @@
} }
.menu { .menu {
width: 250rpx;
position: fixed; position: fixed;
border: 1px solid #d0d0d0; border: 1px solid #d0d0d0;
box-shadow: 0 0 20rpx gray; box-shadow: 0 0 20rpx gray;

12
im-uniapp/store/chatStore.js

@ -8,7 +8,15 @@ export default {
}, },
mutations: { mutations: {
setChats(state,chats){ initChats(state,chats){
// 防止图片一直处在加载中状态
chats.forEach((chat)=>{
chat.messages.forEach((msg)=>{
if(msg.loadStatus == "loading"){
msg.loadStatus = "fail"
}
})
})
state.chats = chats; state.chats = chats;
}, },
openChat(state, chatInfo) { openChat(state, chatInfo) {
@ -190,7 +198,7 @@ export default {
uni.getStorage({ uni.getStorage({
key:"chats-"+userId, key:"chats-"+userId,
success(res) { success(res) {
context.commit("setChats",res.data); context.commit("initChats",res.data);
resolve() resolve()
}, },
fail(e) { fail(e) {

Loading…
Cancel
Save