From 17e1ae4795b1be3d4bfd7005fb1bb559d5e30115 Mon Sep 17 00:00:00 2001 From: Mr.Shi <1878285526@qq.com> Date: 星期四, 07 九月 2023 09:08:17 +0800 Subject: [PATCH] 小程序 --- minipro_standard/pages_adjust/components/user.vue | 57 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 41 insertions(+), 16 deletions(-) diff --git a/minipro_standard/pages_adjust/components/user.vue b/minipro_standard/pages_adjust/components/user.vue index ad496c9..4e82b0f 100644 --- a/minipro_standard/pages_adjust/components/user.vue +++ b/minipro_standard/pages_adjust/components/user.vue @@ -5,11 +5,11 @@ </view> <view class="content"> <view class="content_search"> - <u-search :showAction="false" placeholder="鎼滅储濮撳悕" v-model="keyword"></u-search> + <u-search :showAction="false" placeholder="鎼滅储濮撳悕" v-model="form.name" @search="searchInput"></u-search> </view> - <div class="content_total">鍏眥{total}}鏉℃暟鎹�</div> + <div class="content_total">鍏眥{form.total}}鏉℃暟鎹�</div> <scroll-view class="content_list" scroll-y> - <div class="content_list_item" v-for="(item, index) in indexList" :key="index" @click="getVal(item)"> + <div class="content_list_item" v-for="(item, index) in list" :key="index" @click="jump(item)"> <div class="content_list_item_name"> <span>{{item.name}}</span> </div> @@ -20,35 +20,60 @@ </template> <script> + import { allUser } from '@/util/api/PlanningAPI' export default { props: { show: Boolean }, data() { return { - keyword: '', - total: 0, - indexList: [] + list: [], + loading: false, + finished: false, + refreshing: false, + form: { + capacity: 50, + page: 0, + total: 0, + name: '' + } }; }, methods: { - getVal(item) { + // 鎼滅储妗� + searchInput(data) { + this.form.page = 0 + this.finished = false + this.list = [] + this.loadmore() + }, + jump(item) { this.$emit('value', item) }, open() { - this.indexList = [] - this.loadmore() - }, - scrolltolower() { + this.list = [] + this.form.page = 0 + this.finished = false + this.list = [] this.loadmore() }, loadmore() { - for (let i = 0; i < 20; i++) { - this.indexList.push({ - id: i, - name: `鏉庝紵锝滅敓浜ч儴锝�${i}` + allUser({ name: this.form.name }) + .then(res => { + if (res.code === 200 && res.data && res.data.length !== 0) { + this.form.total = res.data.length + this.list = res.data + } else { + this.finished = true; + } + }).catch(err => { + this.loading = false; + this.finished = true; + if (this.refreshing) { + this.list = [] + this.refreshing = false; + } }) - } }, close() { this.$emit('close') -- Gitblit v1.9.3