| | |
| | | @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" |
| | |
| | | type: [Number, String], |
| | | default: 1 |
| | | }, |
| | | top: { |
| | | type: [Number, String], |
| | | default: 1 |
| | | }, |
| | | handovertype: { |
| | | type: [Number, String], |
| | | }, |
| | | |
| | | page: { |
| | | type: [Number, String], |
| | | default: 1 |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | lock:false, |
| | | pagep: { |
| | | totalp: 0, |
| | | pageSizep: 10, |
| | |
| | | }; |
| | | }, |
| | | computed: { |
| | | |
| | | dataListStyle() { |
| | | const { componentsHeight } = this; |
| | | return { |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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 => { |
| | |
| | | }, |
| | | // 刷新数据 |
| | | 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.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(() => { |
| | |
| | | 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(); |
| | |
| | | .scroll-view { |
| | | height: 100%; |
| | | .scroll-content { |
| | | width: 100%; |
| | | width: 96%; |
| | | height: 100%; |
| | | position: relative; |
| | | .empty-view { |