瀏覽代碼

修改招聘就业模块下拉刷新问题

zaijin 2 年之前
父節點
當前提交
c597815ff1
共有 1 個文件被更改,包括 13 次插入9 次删除
  1. 13 9
      h5_web/pages/recruitment/recruitment.vue

+ 13 - 9
h5_web/pages/recruitment/recruitment.vue

@@ -111,7 +111,7 @@
           </view>
         </view>
       </view>
-      <u-loadmore :status="loadStatus" @loadmore="getList()" />
+      <u-loadmore :status="loadStatus" @loadmore="refreshList()" />
     </view>
     <u-empty v-else text="列表为空" mode="list"></u-empty>
   </view>
@@ -160,7 +160,9 @@ export default {
     this.getBannerList();
     this.getVeteDegrEduc();
   },
+  // 下拉刷新触发
   onPullDownRefresh() {
+    // 开始
     uni.startPullDownRefresh();
     this.recruitmentJobList = [];
     this.recommendList = [];
@@ -177,18 +179,20 @@ export default {
     this.getBannerList();
     this.getVeteDegrEduc();
     setTimeout(() => {
+      // 停止下拉
       uni.stopPullDownRefresh();
     }, 1500);
   },
+  /**
+   * @description: 往底部滑动触发
+   * @return {*}
+   */
   onReachBottom() {
-    this.loadStatus = 'loading';
-    setTimeout(() => {
-      this.queryParams.pageNum = ++this.queryParams.pageNum;
-      this.getRecruitmentJobList();
-    }, 1000);
+    if (this.queryParams.pageNum >= this.totalPage) return;
+    this.refreshList();
   },
   methods: {
-    getList() {
+    refreshList() {
       this.loadStatus = 'loading';
       setTimeout(() => {
         this.queryParams.pageNum = ++this.queryParams.pageNum;
@@ -286,7 +290,7 @@ export default {
         .getRecommendList()
         .then((res) => {
           if (res.code === 200) {
-            this.recommendList = res.data || [];
+            this.recommendList = res?.data ?? [];
           } else {
             uni.showToast({
               icon: 'none',
@@ -390,7 +394,7 @@ export default {
           }
         });
       } catch (e) {
-        label = e.label;
+        label = e?.label;
       }
       return label;
     }