diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index fc09bcc4..d573ccb6 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -22,6 +22,7 @@
{{dialog.name}} + {{formatTime(dialog.last_at)}}
{{formatLastMsg(dialog.last_msg)}}
@@ -82,7 +83,7 @@ export default { }, computed: { - ...mapState(['dialogId', 'dialogList']), + ...mapState(['userId', 'dialogId', 'dialogList']), dialogLists() { const {dialogKey} = this; @@ -144,6 +145,16 @@ export default { } return ''; }, + + lastMsgReadDone(data) { + if ($A.isJson(data)) { + const {userid, percentage} = data; + if (userid === this.userId) { + return percentage === 100 ? 'md-done-all' : 'md-checkmark'; + } + } + return null; + } } } diff --git a/resources/assets/js/store/mutations.js b/resources/assets/js/store/mutations.js index 58e4280c..784ed961 100644 --- a/resources/assets/js/store/mutations.js +++ b/resources/assets/js/store/mutations.js @@ -391,7 +391,6 @@ export default { if (data) { state.dialogMsgList.splice(index, 1, state.method.cloneJSON(data)); // 是最后一条消息时更新对话 last_msg - console.log(data); if (state.dialogMsgList.length - 1 == index) { const dialog = state.dialogList.find(({id}) => id == data.dialog_id); if (dialog) dialog.last_msg = data; @@ -496,10 +495,16 @@ export default { (function (msg, that) { const {mode, data} = msg; const {dialog_id} = data; + // 更新最后消息 + let dialog = state.dialogList.find(({id}) => id == dialog_id); + if (dialog) { + dialog.last_msg = data; + } else { + that.commit('getDialogOne', dialog_id); + } if (mode === "add") { - let dialog = state.dialogList.find(({id}) => id == dialog_id); if (dialog) { - dialog.last_msg = data; + // 新增未读数 if (state.dialogId !== dialog_id) dialog.unread++; // 移动到首位 const index = state.dialogList.findIndex(({id}) => id == dialog_id); @@ -508,9 +513,8 @@ export default { state.dialogList.splice(index, 1); state.dialogList.unshift(tmp); } - } else { - that.commit('getDialogOne', dialog_id); } + // 新增总未读数 if (state.dialogId !== dialog_id) state.dialogMsgUnread++; } })(msgDetail, this); diff --git a/resources/assets/sass/main.scss b/resources/assets/sass/main.scss index 5dd76152..c3012f0f 100755 --- a/resources/assets/sass/main.scss +++ b/resources/assets/sass/main.scss @@ -1124,11 +1124,17 @@ body { overflow: hidden; text-overflow: ellipsis; } + > i { + margin-left: 8px; + transform: scale(0.9); + font-size: 12px; + color: #87d068; + } > em { + margin-left: 8px; font-style: normal; color: #999999; font-size: 12px; - padding-left: 10px; } } .dialog-text {