Skip to content

Commit

Permalink
fix 聊天会员搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Nov 28, 2021
1 parent d22ee4b commit 86e968a
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions resources/assets/js/pages/manage/messenger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<div class="messenger-select" :class="{'show768-menu':dialogId == 0}">
<div class="messenger-search">
<div class="search-wrapper">
<Input prefix="ios-search" v-model="dialogKey" :placeholder="$L('搜索...')" clearable />
<Input v-if="tabActive==='dialog'" prefix="ios-search" v-model="dialogKey" :placeholder="$L('搜索...')" clearable />
<Input v-else prefix="ios-search" v-model="contactsKey" :placeholder="$L('搜索...')" clearable />
</div>
</div>
<div v-if="tabActive==='dialog'" class="messenger-nav">
Expand Down Expand Up @@ -97,6 +98,7 @@ export default {
dialogKey: '',
dialogId: 0,
contactsKey: '',
contactsLoad: 0,
contactsLists: null,
}
Expand Down Expand Up @@ -177,11 +179,19 @@ export default {
watch: {
tabActive(val) {
if (val && this.contactsLists === null) {
this.getContactsList();
this.getContactsList(1);
}
},
dialogOpenId(id) {
this.dialogId = id;
},
contactsKey(val) {
setTimeout(() => {
if (this.contactsKey == val) {
this.contactsLists = null;
this.getContactsList(1);
}
}, 600);
}
},
Expand Down Expand Up @@ -212,19 +222,26 @@ export default {
});
},
getContactsList() {
getContactsList(page) {
if (this.contactsLists === null) {
this.contactsLists = {};
}
this.contactsLoad++;
this.$store.dispatch("call", {
url: 'users/search',
data: {
take: 50
keys: {
key: this.contactsKey
},
sorts: {
az: 'asc'
},
page: page,
pagesize: 50
},
}).then(({data}) => {
this.contactsLoad--;
data.some((user) => {
data.data.some((user) => {
if (user.userid === this.userId) {
return false;
}
Expand All @@ -238,6 +255,9 @@ export default {
this.contactsLists[az].push(user);
}
});
if (data.next_page_url && data.current_page < 3) {
this.getContactsList(data.current_page + 1)
}
}).catch(() => {
this.contactsLoad--;
});
Expand Down

0 comments on commit 86e968a

Please sign in to comment.