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 | 171 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 116 insertions(+), 55 deletions(-) diff --git a/components/data-list/data-list.vue b/components/data-list/data-list.vue index 4fb01f1..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" @@ -91,6 +92,14 @@ type: [Number, String], default: 1 }, + top: { + type: [Number, String], + default: 1 + }, + handovertype: { + type: [Number, String], + }, + page: { type: [Number, String], default: 1 @@ -129,6 +138,7 @@ }, data() { return { + lock:false, pagep: { totalp: 0, pageSizep: 10, @@ -167,6 +177,7 @@ }; }, computed: { + dataListStyle() { const { componentsHeight } = this; return { @@ -181,28 +192,99 @@ 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; - console.log("鐐瑰嚮浜�" + type + "锛屽綋鍓嶉〉锛�" + currentPage); + this.lock=true uni.showLoading({ title: '鍔犺浇涓�' }); this.waiting = true; - this.$emit('load', { page: this.pagep.currentPagep, size: this.pagep.pageSizep }, res => { - + 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); + 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; @@ -213,16 +295,7 @@ this.computedHeight(); }); }, - sizeChange(pageSize) { // 姣忛〉鏉℃暟鏀瑰彉 - this.pagep.pageSizep = pageSize; - console.log("姣忛〉", pageSize, "鏉�"); - }, - changeTotal() { // 鏇存敼鎬绘潯鏁� - this.pagep.totalp = 555 - }, - changeCurrentPage() { // 鏇存敼褰撳墠椤� - this.pagep.currentPagep = 3 - }, + // 鏁版嵁鍔犺浇 loadData() { this.waiting = true; @@ -244,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 => { @@ -290,9 +335,11 @@ }, // 鍒锋柊鏁版嵁 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; @@ -313,7 +360,12 @@ this.componentsHeight = `calc(100vh - ${res.top-200}px - var(--window-top))`; // #endif // #ifndef H5 - this.componentsHeight = `${this.vuex_custom_index_height-168}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(() => { @@ -338,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(); @@ -433,7 +494,7 @@ .scroll-view { height: 100%; .scroll-content { - width: 100%; + width: 96%; height: 100%; position: relative; .empty-view { -- Gitblit v1.9.3