lx 5 éve
szülő
commit
83693274c5

+ 25 - 13
pages/attention/attention.js

@@ -60,35 +60,32 @@ Page({
       onInit: initChart
     },
     array:[],
-    currentPage:1
-
+    currentPage:1,
+    uerId:wx.getStorageSync('openid')
   },
   onLoad: function() {
     var that = this;
     // 获取关注的信息
-    console.log(this.data.currentPage)
-    var userId={
-      userId:wx.getStorageSync('openid'),
+    var data={
+      userId:this.data.uerId,
       currPage:this.data.currentPage
     };
     var that = this;
-    wx.showLoading({title: '加载中…'})
-    wxRequest.followList(userId).then((res)=>{     
+    wx.showLoading({title: '加载中…'});
+
+    wxRequest.followList(data).then((res)=>{     
       console.log(res);
-      // console.log(res.data.data); 
       wx.hideLoading()    
       if(res.statusCode==200){
         that.setData({
-         array:res.data.data
+         array:res.data.data.incInfos
         })
-        //  console.log(that.data.array);
        }else{
         wx.showToast({
           title: '125',
           icon: 'none'
         })
       }
-    
     })
     // 获取系统信息 
     wx.getSystemInfo({
@@ -99,9 +96,24 @@ Page({
         });
       }
     });
-    
-
   },
+  scrolltolower:function() { 
+    var that = this;
+    var tempCurrentPage = that.data.currentPage;
+    tempCurrentPage = tempCurrentPage + 1;
+    if(that.data.currentPage==that.data.totalpages){
+      wx.showLoading({title: '已经到底啦'})
+      setTimeout(function(){
+        wx.hideLoading()
+      },600);
+      return
+    }
+    that.setData({
+      currentPage: tempCurrentPage,
+    })
+  },
+
+   
   getFollow:function(userId){
    
     

+ 1 - 1
pages/attention/attention.wxml

@@ -1,7 +1,7 @@
 <view>
     <swiper current="{{currentTab}}" class="swiper-box" duration="300"  style="height:{{winHeight - 48}}px" bindchange="bindChange">
       <swiper-item>
-        <scroll-view scroll-y style="height: 100%;">
+        <scroll-view scroll-y style="height: 100%;" bindscrolltolower="scrolltolower" >
           <view wx:for="{{array}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row="{{item}}">
             <view class="swiper-box-left">
               <view>{{item.industryName}}</view>

+ 30 - 12
pages/index/index.js

@@ -416,7 +416,6 @@ Page({
      */
     onPullDownRefresh: function () {
       //下拉刷新,重新初始化,isMerge = false
-      console.log("1312432");
       getNewsList(this);
   },
   /**
@@ -426,6 +425,25 @@ Page({
     console.log("触发")
       setPage(this);
   },
+  scrolltolower:function() { 
+    console.log("dgff");
+    // var that = this;
+    // var tempCurrentPage = that.data.currentPage;
+    // tempCurrentPage = tempCurrentPage + 1;
+    // if(that.data.currentPage==that.data.totalpages){
+    //   wx.showLoading({title: '已经到底啦'})
+    //   setTimeout(function(){
+    //     wx.hideLoading()
+    //   },600);
+    //   return
+    // }
+    // that.setData({
+    //   currentPage: tempCurrentPage,
+    // })
+    // getNewsList(this);
+    setPage(this);
+
+},
   computeScrollViewHeight() {
     var that = this
     let query = wx.createSelectorQuery().in(that)
@@ -674,16 +692,16 @@ function setPage(that) {
       pages,
       total
   } = that.data;
-  const totalPages = getTotalPages(total,pages);
+  // const totalPages = getTotalPages(total,pages);
 
-  if (currPage >= totalPages || that.isLoading) {
+  if (currPage >= pages || that.isLoading) {
       //控制触底是否加载需要两个条件,满足一下两个条件,都不能调用请求函数
       // 1.当前页是最后一页,
       // 2. 正在加载中
       return
   }
   //分页加载需要传递isMerge=true参数,表示需要合并到原来的数组上
-  getList(that,true)
+  getNewsList(that,true)
 }
 /**
  * method:得到总页数
@@ -700,10 +718,10 @@ function getTotalPages(total,pages){
 }
  //获取新闻列表
  function getNewsList(that,isMerge){
-   that.isLoading = true
-   wx.showLoading({
-    title: '加载中',
-})
+//    that.isLoading = true
+//    wx.showLoading({
+//     title: '加载中',
+// })
 const data = {};
 data.currPage = Number(that.data.currPage) + 1;
 if(!isMerge){
@@ -724,10 +742,10 @@ if(!isMerge){
         total: res.data.data.total
       })    
     }
-    that.isLoading = false
+    // that.isLoading = false
     wx.stopPullDownRefresh();
-    setTimeout(function(){
-        wx.hideLoading()
-    },500)
+    // setTimeout(function(){
+    //     wx.hideLoading()
+    // },500)
   })
 }

+ 1 - 1
pages/index/index.wxml

@@ -71,7 +71,7 @@
       </view>
     </swiper> -->
     <!-- <scroll-view scroll-y style='height:500rpx' class="tab"> -->
-    <scroll-view scroll-y="true"  style='height: {{scrollHeight}}rpx' class="tab">
+    <scroll-view scroll-y="true" bindscrolltolower="scrolltolower" style='height: {{scrollHeight}}rpx' class="tab">
             <block wx:for-index="idx" wx:for='{{aa}}' wx:key="key" >
             <view class='content-item' bindtap="onFold" data-id="{{item.newsId}}" >
               <text class='from' >{{item.newsFrom}}</text>