Browse Source

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

master
xie.bx 2 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: {
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)

1
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;

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

Loading…
Cancel
Save