no message

This commit is contained in:
kuaifan 2021-06-23 01:10:49 +08:00
parent b5041b92d0
commit e761820df1
2 changed files with 24 additions and 11 deletions

View File

@ -225,19 +225,13 @@ export default {
},
}).then(({data}) => {
this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId)
this.$store.dispatch("saveDialog", {
id: this.dialogId,
last_msg: data,
last_at: $A.formatDate("Y-m-d H:i:s")
});
this.$store.dispatch("saveDialogMsg", data);
this.sendSuccess(data);
}).catch(({msg}) => {
$A.modalError(msg);
this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId)
});
//
this.msgText = '';
this.$store.dispatch("dialogMoveTop", this.dialogId);
},
chatKeydown(e) {
@ -300,7 +294,6 @@ export default {
msg: { },
});
this.autoBottom = true;
this.$store.dispatch("dialogMoveTop", this.dialogId);
this.onActive();
break;
@ -310,11 +303,22 @@ export default {
case 'success':
this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId)
this.$store.dispatch("saveDialogMsg", file.data);
this.sendSuccess(file.data)
break;
}
},
sendSuccess(data) {
this.$store.dispatch("saveDialog", {
id: this.dialogId,
last_msg: data,
last_at: $A.formatDate("Y-m-d H:i:s")
});
this.$store.dispatch("saveDialogMsg", data);
this.$store.dispatch("dialogMoveTop", this.dialogId);
this.$store.dispatch("increaseTaskMsgNum", this.dialogId);
},
chatScroll(res) {
switch (res.directionreal) {
case 'up':

View File

@ -598,6 +598,16 @@ export default {
})
},
/**
* 增加任务消息数量
* @param state
* @param dialog_id
*/
increaseTaskMsgNum({state}, dialog_id) {
const task = state.tasks.find((task) => task.dialog_id === dialog_id);
if (task) task.msg_num++;
},
/**
* 获取任务
* @param state
@ -1284,8 +1294,7 @@ export default {
dispatch("dialogMoveTop", dialog_id);
}
// 新增任务消息数量
const task = state.tasks.find(({dialog_id}) => dialog_id === dialog_id);
if (task) task.msg_num++;
dispatch("increaseTaskMsgNum", dialog_id);
}
})(msgDetail);
break;