Z1hgq 7 lat temu
rodzic
commit
ffba087f67
2 zmienionych plików z 33 dodań i 22 usunięć
  1. 31 21
      Gkzs/index/result/result.js
  2. 2 1
      Gkzs/index/result/result.wxml

+ 31 - 21
Gkzs/index/result/result.js

xqd
@@ -90,28 +90,38 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    wx.showLoading({
-      title: 'loading',
-    })
     var that = this
-    wx.request({
-      url: that.data.next_page_url,
-      data:{
-        userid: that.data.userid,
-        username: that.data.username,
-        batch: that.data.batch,
-        province: that.data.province,
-        class: that.data.class
-      },
-      method:'POST',
-      success:function(res){
-        that.setData({
-          paidInfo: [...that.data.paidInfo.concat(res.data.data.major.data)],
-          next_page_url: res.data.data.major.next_page_url
-        })
-        wx.hideLoading()
-      }
-    })
+    if (that.data.next_page_url){
+      wx.showLoading({
+        title: 'loading',
+      })
+      
+      wx.request({
+        url: that.data.next_page_url,
+        data: {
+          userid: that.data.userid,
+          username: that.data.username,
+          batch: that.data.batch,
+          province: that.data.province,
+          class: that.data.class
+        },
+        method: 'POST',
+        success: function (res) {
+          that.setData({
+            paidInfo: [...that.data.paidInfo.concat(res.data.data.major.data)],
+            next_page_url: res.data.data.major.next_page_url
+          })
+          wx.hideLoading()
+        }
+      })
+    }else{
+      wx.showToast({
+        title: '已经没有更多了',
+        icon:'none',
+        duration:1000
+      })
+    }
+    
   },
 
   /**

+ 2 - 1
Gkzs/index/result/result.wxml

xqd
@@ -39,7 +39,8 @@
           <image style='width:15px;height:15px;' src='../../images/IP.png' mode='aspectFit'></image>{{item.province}}</view>
       </view>
       <view class='weui-flex'>
-        <view class='weui-flex__item'>专业:{{item.major}} {{item.type}}</view>
+        <view class='weui-flex__item'>专业:{{item.major}}</view>
+        <view class='weui-flex__item'>{{item.type}}</view>
       </view>
       <view class='weui-flex'>
         <view class='weui-flex__item'>{{item.year}}年</view>