From 9461caf2a459a7ed1eb16f8f439c02cfbcf1930b Mon Sep 17 00:00:00 2001
From: zhouwenxuan <1175765986@qq.com>
Date: Wed, 02 Aug 2023 15:06:08 +0800
Subject: [PATCH] 新增功能
---
pages/tabBar/examine/examine.vue | 71 ++++++++++++++++++++++++++++-------
1 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/pages/tabBar/examine/examine.vue b/pages/tabBar/examine/examine.vue
index 90c1acd..93a632d 100644
--- a/pages/tabBar/examine/examine.vue
+++ b/pages/tabBar/examine/examine.vue
@@ -12,6 +12,9 @@
</view>
</view>
</view>
+ <div v-if="loading" style='display: flex;justify-content: center;position: absolute;width:100%;top: 40%;left: 0'>
+ <u-loading-icon></u-loading-icon>
+ </div>
<!-- 页面内容 -->
<view class="controlBar">
<view class="buttonGroup">
@@ -46,7 +49,9 @@
</view>
<view style="display: flex;flex-direction: column;margin-bottom: 55px;">
<view class="examineList">
- <view class="listContent" v-if="examineList.length > 0">
+ <scroll-view :scroll-top="scrollTop" scroll-y="true" class="listContent" @scrolltoupper="upper" v-if="examineList.length > 0"
+ @scrolltolower="lower" @scroll="scroll" lower-threshold="50">
+ <!-- <view class="listContent" v-if="examineList.length > 0"> -->
<view v-for="(item, index) in examineList" :key="index" class="itemContent">
<view class="content" @click="toDetail(item)">
<text>[{{item.colorContent}}]</text>
@@ -63,9 +68,9 @@
</u-button>
</view>
</view>
-
</view>
- </view>
+ </scroll-view>
+ <!-- </view> -->
<view v-else>
<u-empty margin-top="40%" text="数据为空" mode="data"></u-empty>
</view>
@@ -84,9 +89,11 @@
},
data() {
return {
+ loading:false,
+ scrollTop: 0,
data: {
pageIndex: 1,
- pageSize: 999999999,
+ pageSize: 10,
searchParams: {
emergType: null,//1-紧急;2-常规
warningLevel: null,//1-红色预警;2-橙色预警;3-黄色预警;4-蓝色预警
@@ -125,6 +132,7 @@
uni.hideTabBar();
},
onShow() {
+ this.data.pageIndex = 1
this.getExanineList();
},
methods: {
@@ -133,18 +141,28 @@
uni.switchTab({
url:'/pages/tabBar/firstPage/firstPage'
});
+ this.selectedSaleAnalysis = 'all';
+ this.checked = false;
+ this.isReadOnly = false;
},
getExanineList() {
+ this.loading = true
this.data.searchParams.reviewStatus = this.isReadOnly ? 1 : null;
this.data.searchParams.emergType = this.checked ? 1 : null;
this.data.searchParams.warningLevel = this.selectedSaleAnalysis == 'all' ? null : this.selectedSaleAnalysis =='red' ? 1 : this.selectedSaleAnalysis =='orange' ? 2: this.selectedSaleAnalysis =='yellow'? 3 : 4;
getExamine(this.data).then(res => {
if(res.code == 100) {
- this.examineList = res.data ? res.data : [];
- console.log("res111111",res);
+ let list = res.data?res.data: [];
+ if (res.pageIndex != 1) {
+ this.examineList = this.examineList.concat(list)
+ } else {
+ this.examineList = list;
+ }
+ this.total = res.total
+ // this.examineList = res.data ? res.data : [];
+ console.log("res111111",this.examineList);
this.examineCopy = this.examineList;
if(this.examineList.length > 0) {
-
this.examineList.forEach((item, index) => {
this.examineList[index].colorContent = item.warningLevel == 1 ? '红色预警': item.warningLevel == 2 ? '橙色预警': item.warningLevel == 3 ? '黄色预警':'蓝色预警';
this.examineList[index].buttonContent = item.reviewStatus == 1 ? '待审核': item.reviewStatus == 2 ? '已审核通过' : '已驳回';
@@ -152,14 +170,19 @@
this.examineList[index].warningLevel = item.warningLevel;
});
}
+ }else{
+ uni.$u.toast(res.msg)
}
+ this.loading = false
})
},
handleButtonClick(button) {
+ this.data.pageIndex = 1
this.selectedSaleAnalysis = button.label;
this.getExanineList();
},
chooseRead(e) {
+ this.data.pageIndex = 1
this.isReadOnly = e;
this.getExanineList();
},
@@ -179,7 +202,25 @@
},
clickSwitch(e) {
this.getExanineList();
- }
+ this.data.pageIndex = 1
+ },
+ upper: function(e) {
+ // console.log(e)
+ },
+ lower: function(e) {
+ console.log("111")
+ if (this.data.pageIndex * this.data.pageSize >= this.total){
+ uni.$u.toast('已加载全部数据')
+ return
+ }
+ //并且让页码+1,调用获取数据的方法获取第二页数据
+ this.data.pageIndex++
+ //此处调用自己获取数据列表的方法
+ this.getExanineList()
+ },
+ scroll: function(e) {
+ // console.log(e)
+ },
}
}
@@ -326,12 +367,14 @@
// height: 35px;
// }
.listContent{
- display: flex;
- flex-direction: column;
- margin: 0 12px;
- background: #fff;
- border-radius: 5px;
- box-shadow: 0 3px 12px rgba(0,0,0,0.05);
+ display: flex;
+ flex-direction: column;
+ width: calc(100% - 24px);
+ margin: 0 12px;
+ background: #fff;
+ border-radius: 5px;
+ box-shadow: 0 3px 12px rgba(0,0,0,0.05);
+ height: 100%;
}
.itemContent{
font-size: 16px;
--
Gitblit v1.9.2