|
@@ -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)
|
|
|
})
|
|
|
}
|