From 645834e1c3efb3a8c50dcbda98d87caba04bd421 Mon Sep 17 00:00:00 2001 From: fei.wang <wf18701153496@163.com> Date: 星期三, 13 八月 2025 14:34:02 +0800 Subject: [PATCH] v1.2.8 --- components/data-list/data-list.vue | 187 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 145 insertions(+), 42 deletions(-) diff --git a/components/data-list/data-list.vue b/components/data-list/data-list.vue index 39366e8..44a6760 100644 --- a/components/data-list/data-list.vue +++ b/components/data-list/data-list.vue @@ -6,10 +6,11 @@ @touchmove.stop.prevent > <u-search class="searchbg" shape="true" bg-color="rgba(255, 255, 255, 0.5)" :placeholder="place" :show-action="false" v-model="keyword" @search="searchxinxi" - :style="{top: topheight+'px',position: 'absolute',width: width,right: '5%'}"></u-search> + :style="{top: topheight-6+'px',position: 'absolute',width: width,right: '5%'}"></u-search> <scroll-view class="scroll-view" :scroll-top="scrollTop" + scroll-x="false" :scroll-y="scrollingEnabled" :lower-threshold="lowerThreshold" :enable-back-to-top="enableBackToTop" @@ -47,7 +48,9 @@ </view> </view> </view> + <!-- <page-pagination :total="pagep.totalp" layout="total,first,prev,page,next,last,limit,jumper"></page-pagination> --> </scroll-view> + <page-pagination style="position:absolute; zIndex: 9999 " :total="pagep.totalp" layout="total,first,prev,page,next,last,limit,jumper" @change="change" @sizeChange="sizeChange"></page-pagination> </view> </template> @@ -89,13 +92,21 @@ type: [Number, String], default: 1 }, + top: { + type: [Number, String], + default: 1 + }, + handovertype: { + type: [Number, String], + }, + page: { type: [Number, String], default: 1 }, size: { type: [Number, String], - default: 15 + default: 10 }, loading: { type: Boolean, @@ -127,6 +138,12 @@ }, data() { return { + lock:false, + pagep: { + totalp: 0, + pageSizep: 10, + currentPagep: 2 + }, place:'璇疯緭鍏ョ紪鍙�', keyword:'', topheight:55, @@ -160,6 +177,7 @@ }; }, computed: { + dataListStyle() { const { componentsHeight } = this; return { @@ -174,16 +192,110 @@ return style; } }, + watch: { + handovertype(newVal, oldVal) { + console.log(1111111111111); + // this.currentPage = 1; + // this.currentSize = 10; + console.log('Data changed:', newVal); + this.$emit('refresh', { page: 1, size: 10 }, res => { + console.log(res); + this.autoLoad = true; + this.pullingDown = false; + this.pullDownHeight = 0; + this.list = res.list; + this.total = res.total; + this.pagep.totalp = res.total; + this.currentPage++; + this.handleComputeData(); + this.computedHeight(); + this.$emit('refresherrestore'); + // uni.hideLoading(); + }); + } + }, mounted() { if (this.width=='90%') { this.place = '璇疯緭鍏ュ悕绉�' }else{ this.place = '璇疯緭鍏ョ紪鍙�' } - this.topheight=this.vuex_custom_bar_height+15 + if (this.top=='20') { + this.topheight=this.vuex_custom_bar_height+45 + }else{ + this.topheight=this.vuex_custom_bar_height+15 + } + this.handleInit(); }, methods: { + change(currentPage, type) { // 褰撳墠椤垫敼鍙� + this.pagep.currentPagep = currentPage; + this.lock=true + uni.showLoading({ + title: '鍔犺浇涓�' + }); + this.waiting = true; + this.currentPage = this.pagep.currentPagep; + this.currentSize = this.pagep.pageSizep; + this.$emit('refresh', { page: this.pagep.currentPagep, size: this.pagep.pageSizep}, res => { + setTimeout(function () { + uni.hideLoading(); + }, 1500); + this.autoLoad = true; + this.pullingDown = false; + this.pullDownHeight = 0; + this.list = res.list; + this.total = res.total; + this.pagep.totalp = res.total; + this.currentPage++; + this.handleComputeData(); + this.computedHeight(); + this.$emit('refresherrestore'); + }); + // this.$emit('load', { page: this.pagep.currentPagep, size: this.pagep.pageSizep,lock:true }, res => { + + // setTimeout(function () { + // uni.hideLoading(); + // }, 1500); + // this.waiting = false; + // this.loadingMask = false; + // this.list = res.list; + // this.total = res.total; + // this.pagep.totalp = res.total; + // this.currentPage++; + // this.handleComputeData(); + // this.computedHeight(); + // }); + }, + sizeChange(pageSize) { // 姣忛〉鏉℃暟鏀瑰彉 + this.pagep.pageSizep = pageSize; + }, + changeTotal() { // 鏇存敼鎬绘潯鏁� + this.pagep.totalp = 555 + }, + changeCurrentPage() { // 鏇存敼褰撳墠椤� + this.pagep.currentPagep = 3 + }, + + // 鏁版嵁鍔犺浇 + handoverData() { + console.log(111111); + this.waiting = true; + this.$emit('handover', { page: this.currentPage, size: this.currentSize }, res => { + console.log(22222222); + console.log(res); + this.waiting = false; + this.loadingMask = false; + this.list = res.list; + this.total = res.total; + this.pagep.totalp = res.total; + this.currentPage++; + this.handleComputeData(); + this.computedHeight(); + }); + }, + // 鏁版嵁鍔犺浇 loadData() { this.waiting = true; @@ -192,6 +304,7 @@ this.loadingMask = false; this.list = res.list; this.total = res.total; + this.pagep.totalp = res.total; this.currentPage++; this.handleComputeData(); this.computedHeight(); @@ -204,34 +317,6 @@ size: this.size, objectid:this.keyword, } - - // findwarning(params).then((res) => { - // console.log(res); - // this.list=[] - // if (res.code == 0) { - - // let list = []; - // setTimeout(() => { - // let list = []; - // for (var i = 0; i < res.data.records.length; i++) { - // this.list.push(res.data.records[i]); - // } - // // console.log(list); - // // this.list = [...this.list, ...list]; - // // callback({ list: this.list, total: res.data.total }); - // }, 1500); - // this.autoLoad = true; - // this.pullingDown = false; - // this.pullDownHeight = 0; - // // this.list = list - // this.total = res.data.total; - // this.currentPage++; - // console.log(this.list); - // this.handleComputeData(); - // this.computedHeight(); - // this.$emit('refresherrestore'); - // } - // }) this.currentPage = this.page; this.currentSize = this.size; this.$emit('refresh', { page: this.currentPage, size: this.currentSize, objectid:this.keyword}, res => { @@ -241,6 +326,7 @@ this.pullDownHeight = 0; this.list = res.list; this.total = res.total; + this.pagep.totalp = res.total; this.currentPage++; this.handleComputeData(); this.computedHeight(); @@ -249,14 +335,17 @@ }, // 鍒锋柊鏁版嵁 refreshData() { + this.lock=false this.currentPage = this.page; this.currentSize = this.size; this.$emit('refresh', { page: this.currentPage, size: this.currentSize }, res => { + console.log(res); this.autoLoad = true; this.pullingDown = false; this.pullDownHeight = 0; this.list = res.list; this.total = res.total; + this.pagep.totalp = res.total; this.currentPage++; this.handleComputeData(); this.computedHeight(); @@ -268,10 +357,15 @@ this.getRect('.data-list-components').then(res => { // #ifdef H5 - this.componentsHeight = `calc(100vh - ${res.top}px - var(--window-top))`; + this.componentsHeight = `calc(100vh - ${res.top-200}px - var(--window-top))`; // #endif // #ifndef H5 - this.componentsHeight = `${this.vuex_custom_index_height-100}px`; + if (this.top=='20') { + this.componentsHeight = `${this.vuex_custom_index_height-200}px`; + }else{ + this.componentsHeight = `${this.vuex_custom_index_height-180}px`; + } + // #endif this.autoLoad = true; this.$nextTick(() => { @@ -296,20 +390,29 @@ handleComputeData() { const len = this.list.length; const total = this.total; - if (len == 0 || total == 0) { - this.autoLoad = false; - this.showEmpty = true; - } else if (len >= this.total) { + if (this.lock==true) { this.autoLoad = false; this.showEmpty = false; this.loadStatus = 'nomore'; - } else if (len < this.total) { - this.showEmpty = false; - this.loadStatus = 'loading'; - } + }else{ + if (len == 0 || total == 0) { + this.autoLoad = false; + this.showEmpty = true; + } else if (len >= this.total) { + this.autoLoad = false; + this.showEmpty = false; + this.loadStatus = 'nomore'; + } else if (len < this.total) { + this.showEmpty = false; + this.loadStatus = 'loading'; + } + } + + }, // 涓婃媺瑙﹀簳浜嬩欢 handleScrolltolower(e) { + // this.lock=true this.$emit('scrolltolower', e); if (this.loadStatus == 'nomore' || this.waiting) return; this.loadData(); @@ -391,7 +494,7 @@ .scroll-view { height: 100%; .scroll-content { - width: 100%; + width: 96%; height: 100%; position: relative; .empty-view { -- Gitblit v1.9.3