diff --git a/pages/czdetail/czdetail.js b/pages/czdetail/czdetail.js
index 2807596..78efb33 100644
--- a/pages/czdetail/czdetail.js
+++ b/pages/czdetail/czdetail.js
@@ -9,6 +9,10 @@ Page({
*/
data: {
score: 10,
+ pageNum:1,
+ list:[],
+ showcontent:false,
+ loading:""
},
/**
@@ -22,24 +26,52 @@ Page({
url: '/pages/grade/grade',
})
},
- record: function() {
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ let that = this;
+ that.getScore();
+ let pageNum = that.data.pageNum;
+ let pageSize = that.data.pageSize;
+ that.record(pageNum, pageSize);
+ },
+ record: function (pageNum) {
let that = this;
Http.get({
url: config.api.scoreHistory,
data: {
- pageNum: 1,
- pageSize: 100
+ pageNum: pageNum,
+ pageSize: 15
}
})
.then(res => {
console.log(res)
- if (res.data.list.length > 0) {
- res.data.list.map(file=>{
+ if (res.data.list.length > 0 && res.data.pageNum >= pageNum) {
+ var tmpArr = that.data.list.concat(res.data.list);
+
+ tmpArr.map(file => {
file.createDate = util.formatTime(file.createDate, "yyyy-MM-dd hh:mm:ss")
});
that.setData({
- list:res.data.list
+ list:tmpArr
})
+ setTimeout(function(){
+ wx.hideLoading()
+ },1200)
+ }
+ else if (res.data.list.length == 0){
+ that.setData({
+ loading:"暂无数据"
+ })
+ setTimeout(function () {
+ wx.hideLoading()
+ }, 1200)
+ }
+ else{
+ setTimeout(function () {
+ wx.hideLoading()
+ }, 1200)
}
})
.catch(err => {
@@ -64,54 +96,16 @@ Page({
})
})
},
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- let that = this;
- that.getScore();
- that.record();
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
-
+ onReachBottom: function () {
+ var that = this;
+ wx.showLoading({
+ title: '',
+ mask:true
+ })
+ that.data.pageNum++;
+ that.setData({
+ pageNum: that.data.pageNum
+ });
+ that.record(that.data.pageNum);
}
})
\ No newline at end of file
diff --git a/pages/czdetail/czdetail.wxml b/pages/czdetail/czdetail.wxml
index 4cb3dae..15ecbc1 100644
--- a/pages/czdetail/czdetail.wxml
+++ b/pages/czdetail/czdetail.wxml
@@ -24,4 +24,7 @@
{{item.scoreAmount}}分
+
+
+ {{loading}}
\ No newline at end of file
diff --git a/pages/czdetail/czdetail.wxss b/pages/czdetail/czdetail.wxss
index 8ecec23..7fb7573 100644
--- a/pages/czdetail/czdetail.wxss
+++ b/pages/czdetail/czdetail.wxss
@@ -99,4 +99,11 @@
}
.fr text{
color: #FF3535;
+}
+.loading{
+ text-align: center;
+ height: 80rpx;
+ line-height: 80rpx;
+ color: #999;
+ font-size: 26rpx;
}
\ No newline at end of file