瀏覽代碼

build: 版本号更新至1.15.17

feat(cbd): 新增图片列表分页加载功能
- 在设备照片页面新增分页参数
- 在详情页图片模块添加滚动加载支持,实现滚动到底部加载更多图片
allen 1 周之前
父節點
當前提交
ea7076ad53
共有 3 個文件被更改,包括 37 次插入12 次删除
  1. 2 2
      manifest.json
  2. 33 10
      pages/cbd/detail.vue
  3. 2 0
      pages/cbd/devicePhoto.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "云飞智控",
     "appid" : "__UNI__DBA6730",
     "description" : "",
-    "versionName" : "1.15.16",
-    "versionCode" : 11516,
+    "versionName" : "1.15.17",
+    "versionCode" : 11517,
     "transformPx" : false,
     "sassImplementationName" : "node-sass",
     /* 5+App特有相关 */

+ 33 - 10
pages/cbd/detail.vue

@@ -94,14 +94,16 @@
         </view>
       </view>
       <view v-show="activeTab === 'viewImage'">
-        <photoImage
-          :images="imageList"
-          :pestList="pestList"
-          :disableShow="disableShow"
-          @changeTab="changeTab"
-          :currentYear="currentYear"
-          :deviceInfo="deviceInfo"
-        />
+        <scroll-view class="scroll-view" scroll-y style="height: 60vh;" @scrolltolower="handleReachBottom">
+          <photoImage
+            :images="imageList"
+            :pestList="pestList"
+            :disableShow="disableShow"
+            @changeTab="changeTab"
+            :currentYear="currentYear"
+            :deviceInfo="deviceInfo"
+          />
+        </scroll-view>
       </view>
       <view v-show="activeTab === 'deviceData'">
         <DeviceData
@@ -171,6 +173,7 @@ export default {
       deviceType: '',
       location: '',
       total: 0,
+      imgTotal: 0,
       day: [],
       pest: [],
       page:1,
@@ -214,6 +217,14 @@ export default {
     }
   },
   methods: {
+    handleReachBottom(){
+      if (this.activeTab === 'viewImage') {
+        if(this.imageList.length >= this.imgTotal){
+          return
+        }
+        this.initImageList(true);
+      }
+    },
     handleSimClick(){
       // this.showSim = true;
       //`/pages/deviceDetails/weatherStation/${type}?deviceInfo=${encodeURIComponent(JSON.stringify(this.deviceInfo))}`
@@ -377,7 +388,13 @@ export default {
       });
       this.deviceStatic = res;
     },
-    async initImageList(){
+    async initImageList(isLoadMore){
+      if(isLoadMore){
+        this.page++;
+      }
+      uni.showLoading({
+        title: '加载中',
+      })
       const res = await this.$myRequest({
         url: '/api/api_gateway?method=forecast.new_cbd.photo_list',
         method: 'POST',
@@ -393,7 +410,13 @@ export default {
         },
       });
       const data = res?.data || [];
-      this.imageList = data
+      uni.hideLoading();
+      this.imgTotal = res?.num || 0;
+      if (isLoadMore) {
+        this.imageList = [...this.imageList, ...data];
+      } else {
+        this.imageList = data;
+      }
     },
     async initPest(){
       const res = await this.$myRequest({

+ 2 - 0
pages/cbd/devicePhoto.vue

@@ -283,6 +283,8 @@ export default {
         data: {
           identify_model:'B',
           cmd:'cbd',
+          page:1,
+          page_size:500,
           time_begin: this.time_begin + ' 00:00:00',
           time_end: this.time_end + ' 23:59:59',
           identify_model:'B',