Ver Fonte

基础分页加载done

ming há 3 anos atrás
pai
commit
12fd727bf6

+ 1 - 1
manifest.json

@@ -133,7 +133,7 @@
             "mode" : "hash"
         },
         "devServer" : {
-            "https" : true
+            "https" : false
         },
         "template" : "",
         "sdkConfigs" : {

+ 7 - 0
package-lock.json

@@ -3,6 +3,13 @@
   "version": "1.0.0",
   "lockfileVersion": 1,
   "requires": true,
+  
+  "sockjs":{
+  "dev": false
+  },
+  "sockjs-client" :{
+  "dev": false
+  },
   "dependencies": {
     "@babel/runtime": {
       "version": "7.16.7",

+ 3 - 1
pages/authManage/authManage.vue

@@ -35,7 +35,7 @@
 				</view>
 			</view>
 			<view v-if="!authList.length&&authListRes==1" class="text-center margin-top"> 暂无数据</view>
-			<view v-show="isLoadMore&&this.currentPage>1">
+			<view v-show="isLoadMore&&this.currentPage>1" style="padding-bottom:60px">
 				<uni-load-more :status="loadStatus"></uni-load-more>
 			</view>
 		</view>
@@ -102,7 +102,9 @@
 		methods: {
 			
 			searchAuthList() {
+				this.authList=[];
 				this.currentPage = 1;
+				this.authListRes=[]
 				this.loadData()
 				
 			},

+ 10 - 4
pages/siteArchive/siteArchive.vue

@@ -46,7 +46,7 @@
 				</view>
 			</view>
 			<view v-if="!siteArchiveData.length&&siteListRes==1" class="text-center margin-top"> 暂无数据</view>
-			<view v-show="isLoadMore&&this.currentPage>1">
+			<view v-show="isLoadMore&&this.currentPage>1" style="padding-bottom:60px">
 				<uni-load-more :status="loadStatus"></uni-load-more>
 			</view>
 		</view>
@@ -57,7 +57,7 @@
     bottom: 0px;
     right: 0px;
     height: 64px;
-    background: #fff;">
+    background: #fff">
 			<view class="plus">
 				<image src="../../static/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage()"></image>
 			</view>
@@ -102,6 +102,8 @@
 
 			searchData() {
 				this.currentPage=1,
+				this.siteArchiveData=[],
+				this.siteListRes = 0;
 				this.loadData()
 				
 			},
@@ -134,8 +136,7 @@
 					showLoading: true,
 					data: params
 				})
-				console.log('res.data.data')
-				console.log(res.data.data)
+			
 				this.siteListRes = 1;
 
 				if (res.data.total) {
@@ -146,10 +147,15 @@
 					} else {
 						this.isLoadMore = false
 					}
+					console.log('this.siteArchiveData')
+					console.log(this.siteArchiveData)
 				} else {
+					
 					this.isLoadMore = true
 					this.loadStatus = 'nomore'
 				}
+				
+				
 			},
 
 			// 页面跳转

+ 6 - 3
pages/siteList/siteList.vue

@@ -182,6 +182,8 @@
 
 
 			searchData() {
+				this.siteListData=[]
+				this.siteListRes=0
 				this.currentPage=1,
 				this.loadData()
 				
@@ -202,7 +204,7 @@
 					showLoading: true,
 					data: ming
 				})
-				this.siteListRes = 1;
+				
 				// this.siteListData = res.data.data
 
 				if (res.data.total) {
@@ -217,8 +219,9 @@
 					this.isLoadMore = true
 					this.loadStatus = 'nomore'
 				}
-
-
+				if(!res.data.data.length){
+					this.siteListRes = 1;
+				}
 			},
 
 

+ 129 - 6
pages/siteListAlarming/siteListAlarming.vue

@@ -1,7 +1,69 @@
 <template>
-	<list-test :bindData="siteListData" :bindUrl="linkUrl" :bindIcon="linkIcon" :bindNum="num" :bindType="type"
+	<!-- <list-test :bindData="siteListData" :bindUrl="linkUrl" :bindIcon="linkIcon" :bindNum="num" :bindType="type"
 	 :bindSiteName="siteName" :bindDetailUrl="detailUrl" :bindSiteListRes="siteListRes">
-	</list-test>
+	</list-test> -->
+	
+	<view  class="site-wrapper" ref="contentWrapper">
+		
+			<view style="height:100rpx"></view>
+		<!-- 筛选框start -->
+		<view class="ding">
+			<view class="cu-bar search bg-gray filter-section">
+				<view class="search-form round bg-white">
+					<text class="cuIcon-search"></text>
+					<input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
+					  v-model="siteName"></input>
+				</view>
+				<view class="action">
+					<button class="cu-btn bg-blue round" @click="searchData">查询</button>
+				</view>
+			</view>
+		</view>
+		<!-- 筛选框end -->
+		
+		<!-- 站点列表start -->
+		<view class="site-items" style="margin-top:0;">
+			<view class="cu-list menu-avatar">
+				<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in siteListData"
+				 :key="index" :data-target="'move-box-' + index">
+					<view class="cu-avatar round lg"  v-bind:style="{ 'background-image': 'url(' + linkIcon+ ')' }"></view>
+					
+					
+					<view class="content" v-if="type==1"  @tap="goNowUrl(item)" >
+						<view class="text-grey site-tit ">
+							<text style="width:93%" class="inTwoLine">{{item.siteName}}( 共{{item.siteAlarmCount}}个未处理告警 )</text>
+						</view>
+					</view>
+					
+					<view class="content" v-else  @tap="goNowUrl" @longpress="showDetail(item)">
+						<view class="text-grey site-tit">
+							{{item.siteName}}
+							<text>(共3个设备)</text>
+						</view>
+						<view class="showDetail" v-if="item.isShow" @tap.stop="goNowDetailUrl" >查看详情</view>
+					</view>
+					
+					
+					
+					
+					<view class="nav-right num">
+						<view class="text-grey">
+							<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
+						</view>
+					</view>
+				</view>
+			</view>
+			<view v-if="!siteListData.length&&siteListRes==1" class="text-center margin-top"> 暂无数据</view>
+			<view v-show="isLoadMore&&this.currentPage>1">
+				<uni-load-more :status="loadStatus"></uni-load-more>
+			</view>
+			
+		</view>
+		<!-- 站点列表end -->
+	
+		
+	</view>
+	
 
 </template>
 
@@ -12,6 +74,7 @@
 
 		data() {
 			return {
+				modalName: null,
 				siteListRes: 0,
 				type: 1,
 				linkUrl: '/pages/alarmingList/alarmingList',
@@ -19,7 +82,12 @@
 				siteListData: [],
 				num: ' 共3个未处理告警',
 				detailUrl: '/pages/siteDetail/siteDetail',
-				siteName: ''
+				siteName: '',
+				
+				currentPage: 1,
+				size: 12,
+				loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
+				isLoadMore: false, //是否加载中
 			};
 		},
 
@@ -37,21 +105,76 @@
 		mounted() {
 
 		},
+		onReachBottom() { //上拉触底函数
+			if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
+				this.isLoadMore = true
+				this.currentPage += 1;
+				this.loadData()
+			}
+		},
 
 		onLoad() {
-			this.getDataList({})
+			this.loadData()
 		},
 
 		methods: {
+			searchData(){
+				this.currentPage=1,
+				this.siteListData=[]
+				this.siteListRes=0
+				
+				this.loadData()
+				
+			},
+			loadData(){
+				this.getDataList({
+					"siteName":this.siteName,
+					currentPage: this.currentPage,
+					size: this.size,
+				})
+				
+			},
+			// 页面跳转
+			goNowUrl(item) {
+				uni.navigateTo({
+					url: this.linkUrl+'?companyCode='+item.companyCode,
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+				// if(item.siteAlarmCount){
+					
+				// }
+				
+			},
+			
+			InputFocus(e) {
+				this.InputBottom = e.detail.height
+			},
+			InputBlur(e) {
+				this.InputBottom = 0
+			},
 			async getDataList(params = {}) {
 				const res = await this.$myRequest({
 					url: 'IntegratedAlarm/getSiteList',
 					showLoading: true,
 					data: params
 				})
-				console.log(res.data.data)
-				this.siteListData = res.data.data
+				// console.log(res.data.data)
+				// this.siteListData = res.data.data
 				this.siteListRes = 1;
+				if (res.data.total) {
+					this.siteListData = this.siteListData.concat(res.data.data)
+					if (res.data.data.length < this.size) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
+						this.isLoadMore = true
+						this.loadStatus = 'nomore'
+					} else {
+						this.isLoadMore = false
+					}
+				} else {
+					this.isLoadMore = true
+					this.loadStatus = 'nomore'
+				}
 			}
 		}
 

+ 3 - 1
pages/siteManage/siteManage.vue

@@ -54,7 +54,7 @@
 				</view>
 			</view>
 			<view v-if="!siteList.length&&siteListRes==1" class="text-center margin-top"> 暂无数据</view>
-			<view v-show="isLoadMore&&this.currentPage>1">
+			<view v-show="isLoadMore&&this.currentPage>1" style="padding-bottom:60px">
 				<uni-load-more :status="loadStatus"></uni-load-more>
 			</view>
 		</view>
@@ -135,7 +135,9 @@
 			
 			//筛选
 			searchSiteList() {
+				this.siteList=[];
 				this.currentPage = 1;
+				this.siteListRes = 0;
 				this.loadData()
 			},
 			loadData(){