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

View File

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

View File

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

View File

@ -60,7 +60,7 @@
</div> </div>
<div class="messenger-msg"> <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 v-else class="dialog-no">
<div class="dialog-no-icon"><Icon type="ios-chatbubbles" /></div> <div class="dialog-no-icon"><Icon type="ios-chatbubbles" /></div>
<div class="dialog-no-text">{{$L('选择一个会话开始聊天')}}</div> <div class="dialog-no-text">{{$L('选择一个会话开始聊天')}}</div>