fix: 无法通过项目点击聊天的情况

This commit is contained in:
kuaifan 2022-07-04 00:20:14 +08:00
parent 8ca22fc209
commit 92ea7eaab7

View File

@ -1,5 +1,5 @@
<template> <template>
<DialogWrapper v-if="windowLarge && projectData.cacheParameter.chat" :dialog-id="projectData.dialog_id" class="project-dialog"> <DialogWrapper v-if="dialogShow" :dialog-id="projectData.dialog_id" class="project-dialog">
<template slot="head"> <template slot="head">
<div class="dialog-user"> <div class="dialog-user">
<div class="member-head"> <div class="member-head">
@ -24,7 +24,7 @@
</template> </template>
<script> <script>
import {mapGetters} from "vuex"; import {mapGetters, mapState} from "vuex";
import DialogWrapper from "./DialogWrapper"; import DialogWrapper from "./DialogWrapper";
export default { export default {
@ -32,12 +32,38 @@ export default {
components: {DialogWrapper}, components: {DialogWrapper},
data() { data() {
return { return {
loadIng: false,
memberShowAll: false, memberShowAll: false,
} }
}, },
computed: { computed: {
...mapGetters(['projectData']) ...mapState(['cacheDialogs']),
...mapGetters(['projectData']),
dialogShow() {
return this.windowLarge && this.projectData.dialog_id && this.projectData.cacheParameter.chat
}
},
watch: {
dialogShow: {
handler(show) {
if (show) {
const {dialog_id} = this.projectData
if (!this.cacheDialogs.find(({id}) => id == dialog_id)) {
if (this.loadIng === true) {
return
}
this.loadIng = true
this.$store.dispatch("getDialogOne", dialog_id).catch(() => {}).finally(_ => {
this.loadIng = false
})
}
}
},
immediate: true
}
}, },
methods: { methods: {