|
|
|
@ -50,18 +50,22 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import tablePageMixin from '@/mixins/tablePageMixin' |
|
|
|
import tablePageMixin from '@/mixins/tablePageMixin' |
|
|
|
import Empty from '@/components/Empty' |
|
|
|
|
|
|
|
import AutoHidden from "./AutoHidden" |
|
|
|
import AutoHidden from "./AutoHidden" |
|
|
|
|
|
|
|
import Empty from '@/components/Empty' |
|
|
|
import {search, read, readAll} from "@/api/message/user" |
|
|
|
import {search, read, readAll} from "@/api/message/user" |
|
|
|
import {isEmpty} from "@/utils" |
|
|
|
import {isEmpty} from "@/utils" |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: "MessageStream", |
|
|
|
name: "MessageStream", |
|
|
|
|
|
|
|
|
|
|
|
mixins: [tablePageMixin], |
|
|
|
mixins: [tablePageMixin], |
|
|
|
components: {Empty, AutoHidden}, |
|
|
|
|
|
|
|
|
|
|
|
components: {AutoHidden, Empty}, |
|
|
|
|
|
|
|
|
|
|
|
props: { |
|
|
|
props: { |
|
|
|
mode: String, |
|
|
|
mode: String, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
searchForm: { |
|
|
|
searchForm: { |
|
|
|
@ -69,6 +73,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
unreadCount() { |
|
|
|
unreadCount() { |
|
|
|
return this.$store.state.message.unreadCount |
|
|
|
return this.$store.state.message.unreadCount |
|
|
|
@ -77,19 +82,24 @@ |
|
|
|
return this.mode === 'unread' && this.unreadCount > 0 |
|
|
|
return this.mode === 'unread' && this.unreadCount > 0 |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
mode() { |
|
|
|
mode() { |
|
|
|
this.search() |
|
|
|
this.search() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
search() { |
|
|
|
search() { |
|
|
|
if (this.config.loading) return |
|
|
|
if (this.config.loading) return |
|
|
|
|
|
|
|
const unread = this.mode === 'unread' |
|
|
|
|
|
|
|
const currentMode = this.mode |
|
|
|
this.tableData = [] |
|
|
|
this.tableData = [] |
|
|
|
this.config.loading = true |
|
|
|
this.config.loading = true |
|
|
|
search({...this.searchForm, unread: this.mode === 'unread'}) |
|
|
|
search({...this.searchForm, unread}) |
|
|
|
.then(({list, total, data}) => { |
|
|
|
.then(({list, total}) => { |
|
|
|
!isEmpty(data) && this.$store.commit('message/unreadCount', data) |
|
|
|
if (this.mode !== currentMode) return |
|
|
|
|
|
|
|
unread && this.$store.commit('message/unreadCount', total) |
|
|
|
this.searchForm.total = total |
|
|
|
this.searchForm.total = total |
|
|
|
this.tableData = this.transformList(list) |
|
|
|
this.tableData = this.transformList(list) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|