diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index db020dbab..8daaecd83 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -126,7 +126,10 @@ -
  • {{$L('共' + contactsFilter.length + '位联系人')}}
  • +
  • + + +
  • @@ -137,7 +140,7 @@ @on-clickoutside="operateVisible = false" transfer>
    - + {{ $L(operateItem.top_at ? '取消置顶' : '置顶') }} @@ -208,6 +211,7 @@ export default { contactsKey: '', contactsLoad: 0, contactsData: null, + contactsTotal: 0, contactsCurrentPage: 1, contactsHasMorePages: false, contactsLastTime: 0, @@ -532,11 +536,7 @@ export default { switch (res.directionreal) { case 'up': if (res.scrollE < 10) { - if (this.tabActive === 'contacts' - && this.contactsLoad == 0 - && this.contactsHasMorePages) { - this.getContactsList(this.contactsCurrentPage + 1); - } + this.getContactsNextPage() } break; } @@ -704,12 +704,11 @@ export default { getContactsList(page) { this.contactsLoad++; + const key = this.contactsKey this.$store.dispatch("call", { url: 'users/search', data: { - keys: { - key: this.contactsKey - }, + keys: {key}, sorts: { az: 'asc' }, @@ -717,6 +716,9 @@ export default { pagesize: 50 }, }).then(({data}) => { + if (key == '') { + this.contactsTotal = data.total; + } if (this.contactsData === null) { this.contactsData = []; } @@ -727,7 +729,11 @@ export default { }); this.contactsCurrentPage = data.current_page; this.contactsHasMorePages = data.current_page < data.last_page; + this.$nextTick(this.getContactsNextPage); }).catch(() => { + if (key == '') { + this.contactsTotal = 0; + } this.contactsHasMorePages = false; }).finally(_ => { this.contactsLoad--; @@ -735,6 +741,16 @@ export default { }); }, + getContactsNextPage() { + const {scrollE} = this.$refs.list.scrollInfo(); + if (scrollE < 10 + && this.tabActive === 'contacts' + && this.contactsLoad === 0 + && this.contactsHasMorePages) { + this.getContactsList(this.contactsCurrentPage + 1); + } + }, + updateContactsList(timeout) { this.__updateContactsList && clearTimeout(this.__updateContactsList) if (timeout > -1) {