no message

This commit is contained in:
kuaifan 2021-06-23 00:57:41 +08:00
parent dd509d8140
commit b5041b92d0
4 changed files with 29 additions and 8 deletions

View File

@ -106,6 +106,7 @@ export default {
autoInterval: null,
dialogDrag: false,
dialogReady: false,
msgText: '',
msgNew: 0,
@ -162,17 +163,39 @@ export default {
},
dialogId: {
handler(id) {
handler() {
this.dialogReady = false;
this.autoBottom = true;
this.msgNew = 0;
this.topId = -1;
this.$store.dispatch("getDialogMsgs", id);
this.getMsg();
},
immediate: true
},
dialogs: {
handler() {
this.getMsg();
},
deep: true
}
},
methods: {
getMsg() {
if (!this.dialogId) {
return;
}
if (this.dialogs.findIndex(({id}) => id == this.dialogId) === -1) {
return;
}
if (this.dialogReady) {
return;
}
this.dialogReady = true;
this.$store.dispatch("getDialogMsgs", this.dialogId);
},
sendMsg(text) {
if (typeof text === "string" && text) {
this.msgText = text;

View File

@ -1,6 +1,6 @@
<template>
<div class="project-dialog">
<DialogWrapper v-if="dialogs.length > 0" :dialog-id="projectData.dialog_id" class="project-dialog-wrapper">
<DialogWrapper :dialog-id="projectData.dialog_id" class="project-dialog-wrapper">
<div slot="head">
<div class="dialog-user">
<div class="member-head">
@ -22,7 +22,7 @@
</template>
<script>
import {mapGetters, mapState} from "vuex";
import {mapGetters} from "vuex";
import DialogWrapper from "./DialogWrapper";
export default {
@ -35,7 +35,6 @@ export default {
},
computed: {
...mapState(['dialogs']),
...mapGetters(['projectData'])
},
}

View File

@ -332,7 +332,7 @@
</div>
<div class="task-dialog" :style="dialogStyle">
<template v-if="taskDetail.dialog_id > 0">
<DialogWrapper ref="dialog" v-if="dialogs.length" :dialog-id="taskDetail.dialog_id">
<DialogWrapper ref="dialog" :dialog-id="taskDetail.dialog_id">
<div slot="head" class="head">
<Icon class="icon" type="ios-chatbubbles-outline" />
<div class="nav">
@ -475,7 +475,6 @@ export default {
'taskContents',
'taskFiles',
'taskPriority',
'dialogs'
]),
projectName() {

View File

@ -60,7 +60,7 @@
</div>
<div class="messenger-msg">
<DialogWrapper v-if="dialogs.length > 0 && dialogId > 0" :dialogId="dialogId" @on-active="scrollIntoActive"/>
<DialogWrapper v-if="dialogId > 0" :dialogId="dialogId" @on-active="scrollIntoActive"/>
<div v-else class="dialog-no">
<div class="dialog-no-icon"><Icon type="ios-chatbubbles" /></div>
<div class="dialog-no-text">{{$L('选择一个会话开始聊天')}}</div>