no message
This commit is contained in:
parent
2ca3e04221
commit
ab5a7544f2
@ -22,6 +22,7 @@
|
|||||||
<div class="dialog-box">
|
<div class="dialog-box">
|
||||||
<div class="dialog-title">
|
<div class="dialog-title">
|
||||||
<span>{{dialog.name}}</span>
|
<span>{{dialog.name}}</span>
|
||||||
|
<Icon v-if="dialog.type == 'user' && lastMsgReadDone(dialog.last_msg)" :type="lastMsgReadDone(dialog.last_msg)"/>
|
||||||
<em v-if="dialog.last_at">{{formatTime(dialog.last_at)}}</em>
|
<em v-if="dialog.last_at">{{formatTime(dialog.last_at)}}</em>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-text">{{formatLastMsg(dialog.last_msg)}}</div>
|
<div class="dialog-text">{{formatLastMsg(dialog.last_msg)}}</div>
|
||||||
@ -82,7 +83,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['dialogId', 'dialogList']),
|
...mapState(['userId', 'dialogId', 'dialogList']),
|
||||||
|
|
||||||
dialogLists() {
|
dialogLists() {
|
||||||
const {dialogKey} = this;
|
const {dialogKey} = this;
|
||||||
@ -144,6 +145,16 @@ export default {
|
|||||||
}
|
}
|
||||||
return '';
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
12
resources/assets/js/store/mutations.js
vendored
12
resources/assets/js/store/mutations.js
vendored
@ -391,7 +391,6 @@ export default {
|
|||||||
if (data) {
|
if (data) {
|
||||||
state.dialogMsgList.splice(index, 1, state.method.cloneJSON(data));
|
state.dialogMsgList.splice(index, 1, state.method.cloneJSON(data));
|
||||||
// 是最后一条消息时更新对话 last_msg
|
// 是最后一条消息时更新对话 last_msg
|
||||||
console.log(data);
|
|
||||||
if (state.dialogMsgList.length - 1 == index) {
|
if (state.dialogMsgList.length - 1 == index) {
|
||||||
const dialog = state.dialogList.find(({id}) => id == data.dialog_id);
|
const dialog = state.dialogList.find(({id}) => id == data.dialog_id);
|
||||||
if (dialog) dialog.last_msg = data;
|
if (dialog) dialog.last_msg = data;
|
||||||
@ -496,10 +495,16 @@ export default {
|
|||||||
(function (msg, that) {
|
(function (msg, that) {
|
||||||
const {mode, data} = msg;
|
const {mode, data} = msg;
|
||||||
const {dialog_id} = data;
|
const {dialog_id} = data;
|
||||||
if (mode === "add") {
|
// 更新最后消息
|
||||||
let dialog = state.dialogList.find(({id}) => id == dialog_id);
|
let dialog = state.dialogList.find(({id}) => id == dialog_id);
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
dialog.last_msg = data;
|
dialog.last_msg = data;
|
||||||
|
} else {
|
||||||
|
that.commit('getDialogOne', dialog_id);
|
||||||
|
}
|
||||||
|
if (mode === "add") {
|
||||||
|
if (dialog) {
|
||||||
|
// 新增未读数
|
||||||
if (state.dialogId !== dialog_id) dialog.unread++;
|
if (state.dialogId !== dialog_id) dialog.unread++;
|
||||||
// 移动到首位
|
// 移动到首位
|
||||||
const index = state.dialogList.findIndex(({id}) => id == dialog_id);
|
const index = state.dialogList.findIndex(({id}) => id == dialog_id);
|
||||||
@ -508,9 +513,8 @@ export default {
|
|||||||
state.dialogList.splice(index, 1);
|
state.dialogList.splice(index, 1);
|
||||||
state.dialogList.unshift(tmp);
|
state.dialogList.unshift(tmp);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
that.commit('getDialogOne', dialog_id);
|
|
||||||
}
|
}
|
||||||
|
// 新增总未读数
|
||||||
if (state.dialogId !== dialog_id) state.dialogMsgUnread++;
|
if (state.dialogId !== dialog_id) state.dialogMsgUnread++;
|
||||||
}
|
}
|
||||||
})(msgDetail, this);
|
})(msgDetail, this);
|
||||||
|
8
resources/assets/sass/main.scss
vendored
8
resources/assets/sass/main.scss
vendored
@ -1124,11 +1124,17 @@ body {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
> i {
|
||||||
|
margin-left: 8px;
|
||||||
|
transform: scale(0.9);
|
||||||
|
font-size: 12px;
|
||||||
|
color: #87d068;
|
||||||
|
}
|
||||||
> em {
|
> em {
|
||||||
|
margin-left: 8px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding-left: 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dialog-text {
|
.dialog-text {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user