From 5f2ee03958a1a16dc27195c76ea7cffb422c95d1 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 19 十二月 2025 22:40:34 +0800
Subject: [PATCH] feat: 任务修改接口,删除一些不要的字段同步

---
 app/pages/index.vue |  111 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 97 insertions(+), 14 deletions(-)

diff --git a/app/pages/index.vue b/app/pages/index.vue
index 556f5aa..6579435 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -89,15 +89,20 @@
     </view>
 
     <!-- 姝e湪杩愯鐨勪换鍔″垪琛� -->
-    <scroll-view class="running-tasks-section" scroll-y="true">
+    <scroll-view 
+      class="running-tasks-section" 
+      scroll-y="true"
+      @scrolltolower="onScrollToLower"
+    >
       <view class="task-list">
         <view class="task-item" v-for="task in runningTasks" :key="task.id">
           <view class="task-main" @click="viewTaskDetail(task)">
             <!-- 浠诲姟澶撮儴锛氭爣棰樺拰鐘舵�佹爣绛� -->
             <view class="task-header">
-              <view class="task-title"
-                >{{ getTaskTypeText(task.type) }} - {{ task.vehicle }}</view
-              >
+              <view class="task-title">
+                {{ getTaskTypeText(task.type) }} - {{ task.vehicle }}
+                <text v-if="task.isHeadPush === '1'" class="head-push-tag">鎬�</text>
+              </view>
               <view
                 class="task-status"
                 :class="
@@ -124,7 +129,7 @@
 
             <!-- 浠诲姟缂栧彿鍗曠嫭涓�琛� -->
             <view class="task-code-row">
-              <text class="task-code">{{ task.taskNo }}</text>
+              <text class="task-code">{{ task.showTaskCode }}</text>
             </view>
 
             <!-- 浠诲姟璇︾粏淇℃伅 -->
@@ -214,6 +219,15 @@
           <uni-icons type="info" size="40" color="#ccc"></uni-icons>
           <text>鏆傛棤姝e湪杩愯鐨勪换鍔�</text>
         </view>
+        
+        <!-- 鍔犺浇鏇村鎻愮ず -->
+        <view class="load-more" v-if="runningTasks.length > 0 && hasMore && loading">
+          <uni-icons type="spinner-cycle" size="20" color="#999"></uni-icons>
+          <text>姝e湪鍔犺浇鏇村鏁版嵁...</text>
+        </view>
+        <view class="load-more no-more" v-else-if="runningTasks.length > 0 && !hasMore">
+          <text>娌℃湁鏇村鏁版嵁浜�</text>
+        </view>
       </view>
     </scroll-view>
   </view>
@@ -240,11 +254,17 @@
       unreadMessageCount: 0,
 
       // 姝e湪杩愯鐨勪换鍔″垪琛�
-      taskList: [],
+      allTaskList: [], // 瀛樺偍鎵�鏈変换鍔℃暟鎹�
+      displayedTaskList: [], // 瀛樺偍褰撳墠鏄剧ず鐨勪换鍔℃暟鎹�
       loading: false,
 
       // 璁㈤槄鐘舵��
       hasSubscribed: false,
+      
+      // 鍓嶇鍒嗛〉鐩稿叧
+      currentPage: 1,
+      pageSize: 10,
+      hasMore: true,
     };
   },
   computed: {
@@ -255,7 +275,7 @@
 
     // 姝e湪杩愯鐨勪换鍔★紙寰呭鐞嗗拰鍚勭澶勭悊涓殑浠诲姟锛�
     runningTasks() {
-      return this.taskList.filter((task) => {
+      return this.displayedTaskList.filter((task) => {
         // 鍖呭惈寰呭鐞嗐�佸嚭鍙戜腑銆佸凡鍒拌揪銆佽繑绋嬩腑绛夋墍鏈夋湭瀹屾垚鐨勭姸鎬�
         return [
           "PENDING",
@@ -276,10 +296,10 @@
     }
 
     // 妫�鏌ヨ闃呯姸鎬侊紙鍏堟鏌ユ湰鍦帮紝鍚庨潰浼氭鏌ュ井淇″畼鏂圭姸鎬侊級
-    this.hasSubscribed = subscribeManager.checkLocalSubscribeStatus();
+    this.hasSubscribed = true;//subscribeManager.checkLocalSubscribeStatus();
 
     // 鑷姩璁㈤槄锛堝鏋滄湭璁㈤槄鍒欐樉绀虹‘璁ゅ脊绐楋級
-    this.autoSubscribeOnLaunch();
+    // this.autoSubscribeOnLaunch();
 
     // 鍔犺浇鐢ㄦ埛缁戝畾杞﹁締淇℃伅
     this.loadUserVehicle();
@@ -298,10 +318,16 @@
 
     // 姣忔鏄剧ず椤甸潰鏃跺埛鏂颁换鍔″垪琛ㄣ�佺粦瀹氳溅杈嗗拰娑堟伅鏁伴噺
     this.loadUserVehicle();
+    // 閲嶆柊鍔犺浇浠诲姟鍒楄〃鏃堕噸缃垎椤�
+    this.currentPage = 1;
+    this.hasMore = true;
     this.loadRunningTasks();
     this.loadUnreadMessageCount();
   },
   onPullDownRefresh() {
+    // 涓嬫媺鍒锋柊鏃堕噸缃垎椤靛弬鏁�
+    this.currentPage = 1;
+    this.hasMore = true;
     // 涓嬫媺鍒锋柊
     this.loadRunningTasks();
     setTimeout(() => {
@@ -309,6 +335,13 @@
     }, 1000);
   },
   methods: {
+    // 婊氬姩鍒板簳閮ㄦ椂鍔犺浇鏇村
+    onScrollToLower() {
+      if (this.hasMore && !this.loading) {
+        this.loadMoreTasks();
+      }
+    },
+    
     // 鑷姩璁㈤槄锛堝皬绋嬪簭鍚姩鏃惰皟鐢級
     autoSubscribeOnLaunch() {
       subscribeManager.autoSubscribe()
@@ -437,9 +470,16 @@
           this.loading = false;
           // 鏍规嵁鍚庣杩斿洖鐨勬暟鎹粨鏋勮繘琛岃В鏋�
           const data = response.data || response.rows || response || [];
-          // 杩囨护鍑烘湭瀹屾垚鐨勪换鍔�
-          const allTasks = Array.isArray(data) ? data : [];
-          this.taskList = allTasks
+          
+          // 濡傛灉鏄涓�椤碉紝鐩存帴鏇挎崲鏁版嵁锛涘惁鍒欒拷鍔犳暟鎹�
+          if (this.currentPage === 1) {
+            this.allTaskList = data;
+          } else {
+            this.allTaskList = [...this.allTaskList, ...data];
+          }
+          
+          // 鏍煎紡鍖栦换鍔℃暟鎹�
+          this.allTaskList = this.allTaskList
             .filter((task) => {
               // 鍙樉绀烘湭瀹屾垚鍜屾湭鍙栨秷鐨勪换鍔�
               return (
@@ -479,11 +519,30 @@
                 status: this.convertStatus(task.taskStatus), // 杞崲鐘舵�佹牸寮忎互鍏煎鏃I
               };
             });
+
+          // 鏇存柊鏄剧ず鐨勪换鍔″垪琛�
+          this.updateDisplayedTaskList();
         })
         .catch((error) => {
           this.loading = false;
           console.error("鍔犺浇浠诲姟鍒楄〃澶辫触:", error);
         });
+    },
+    
+    // 鏇存柊鏄剧ず鐨勪换鍔″垪琛紙鍓嶇鍒嗛〉锛�
+    updateDisplayedTaskList() {
+      const start = 0;
+      const end = this.currentPage * this.pageSize;
+      this.displayedTaskList = this.allTaskList.slice(start, end);
+      this.hasMore = end < this.allTaskList.length;
+    },
+    
+    // 鍔犺浇鏇村浠诲姟锛堝墠绔垎椤碉級
+    loadMoreTasks() {
+      if (!this.hasMore || this.loading) return;
+      
+      this.currentPage++;
+      this.updateDisplayedTaskList();
     },
 
     // 鏍煎紡鍖栧湴鍧� - 鍙樉绀�-鍓嶉潰鐨勯儴鍒�
@@ -755,16 +814,27 @@
     height: 0 !important;
     background: transparent;
   }
-
+  
   // Firefox婊氬姩鏉¢殣钘�
   * {
     scrollbar-width: none; /* Firefox */
   }
-
+  
   // IE/Edge婊氬姩鏉¢殣钘�
   * {
     -ms-overflow-style: none; /* IE 10+ */
   }
+}
+
+// 鎬婚儴鎺ㄩ�佹爣璁版牱寮�
+.head-push-tag {
+  color: #ff0000;
+  font-size: 24rpx;
+  font-weight: bold;
+  margin-left: 10rpx;
+  padding: 2rpx 8rpx;
+  border: 1rpx solid #ff0000;
+  border-radius: 4rpx;
 }
 
 // 鐢ㄦ埛淇℃伅鍖哄煙
@@ -1137,6 +1207,19 @@
         margin-top: 20rpx;
       }
     }
+    
+    .load-more {
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      padding: 20rpx 0;
+      color: #999;
+      font-size: 28rpx;
+      
+      &.no-more {
+        color: #666;
+      }
+    }
   }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.9.1