ming 3 년 전
부모
커밋
bc4bda5931
4개의 변경된 파일75개의 추가작업 그리고 16개의 파일을 삭제
  1. 2 1
      pages.json
  2. 63 8
      pages/eleControl/controlReport/controlReport.vue
  3. 4 1
      pages/eleControl/powerCut/powerCut.vue
  4. 6 6
      pages/index/index.vue

+ 2 - 1
pages.json

@@ -389,7 +389,8 @@
             "style" :                                                                                    
             {
                 "navigationBarTitleText": "监察上报",
-                "enablePullDownRefresh": false
+                "enablePullDownRefresh": false,
+				"onReachBottomDistance":50 //距离底部多远时触发 单位px
             }
             
         }

+ 63 - 8
pages/eleControl/controlReport/controlReport.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="site-wrapper">
 		
-		<view style="height: calc(100vh - 200rpx);overflow:scroll">
+		<view style="height: calc(100vh - 200rpx)">
 			<view class="cu-list menu-avatar">
 				<view class="cu-item"  :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in controlReport"
 				 :key="index" :data-target="'move-box-' + index"  @tap="goDetail(item.id)" >
@@ -22,12 +22,26 @@
 					</view>
 				</view>
 			</view>
+			
+			<view v-if="!controlReport.length&&siteListRes==1" class="text-center margin-top"> 暂无数据</view>
+			<view v-show="isLoadMore&&this.currentPage>1" style="padding-bottom:60px">
+				<uni-load-more :status="loadStatus"></uni-load-more>
+			</view>
+			
+			
 		</view>
 		
 		<!-- 新增按钮start -->
-		<view class="plus">
-			<image src="../../../static/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage()"></image>
-		</view>
+		<view <view style="width: 100%;
+    position: fixed;
+    bottom: 0px;
+    right: 0px;
+    height: 64px;
+    background: #fff">
+	<view class="plus">
+		<image src="../../../static/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage()"></image>
+	</view></view>
+		
 		<!-- 新增按钮end -->
 	</view>
 
@@ -40,11 +54,26 @@
 			return {
 				controlReport: [],
 				modalName: null,
+				siteListRes: 0,
+				
+				currentPage: 1,
+				size: 11,
+				loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
+				isLoadMore: false, //是否加载中
 			};
 		},
 		
+		onReachBottom() { //上拉触底函数
+		
+			if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
+				this.isLoadMore = true
+				this.currentPage += 1;
+				this.loadData()
+			}
+		},
+		
 		onLoad:function(option){
-			this.getDataList()
+			this.loadData()
 			
 		},
 	
@@ -62,6 +91,15 @@
 					url: '/pages/eleControl/controlReport/controlReportDetail/controlReportDetail?id='+id,
 				});
 			},
+			
+			loadData(){
+				this.getDataList({
+					currentPage: this.currentPage,
+					size: this.size,
+				})
+				
+			},
+			
 			//数据请求
 			async getDataList(params = {}) {
 				const res = await this.$myRequest({
@@ -69,9 +107,26 @@
 					showLoading: true,
 					data: params
 				})
-				console.log('res.data.data')
-				console.log(res.data.data)
-				this.controlReport = res.data.data
+				this.siteListRes = 1;
+				
+				if (res.data.total) {
+					
+					// this.controlReport = res.data.data
+					this.controlReport = this.controlReport.concat(res.data.data)
+					if (res.data.data.length < this.size) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
+						this.isLoadMore = true
+						this.loadStatus = 'nomore'
+					} else {
+						this.isLoadMore = false
+					}
+					console.log('this.controlReport')
+					console.log(this.controlReport)
+				} else {
+					
+					this.isLoadMore = true
+					this.loadStatus = 'nomore'
+				}
+				
 			}
 		}
 

+ 4 - 1
pages/eleControl/powerCut/powerCut.vue

@@ -53,6 +53,9 @@
 						</view>
 					</view>
 					<view class=" text-center margin-top" v-if="planListData.length === 0">暂无数据...</view>
+					<view v-show="isLoadMore&&planListData.length!= 0&&currentPage>1">
+						<uni-load-more :status="loadStatus"></uni-load-more>
+					</view>
 				</view>
 			</view>
 		</block>
@@ -81,7 +84,7 @@
 						</view>
 					</view>
 					<view class="text-center margin-top" v-if="planListData.length === 0">暂无数据...</view>
-					<view v-show="isLoadMore&&planListData.length!= 0">
+					<view v-show="isLoadMore&&planListData.length!= 0&&currentPage>1">
 						<uni-load-more :status="loadStatus"></uni-load-more>
 					</view>
 				</view>

+ 6 - 6
pages/index/index.vue

@@ -193,15 +193,15 @@
 
 		onLoad: function(option) {
 		
-			// if (option.op) {
-			// 	this.getData();
+			if (option.op) {
+				this.getData();
 			
-			// } else {
-			// 	this.init()
-			// }
+			} else {
+				this.init()
+			}
 			
 			
-			this.getData();
+			// this.getData();
 
 			this.hackReset = false;
 			this.$nextTick(() => {