Преглед изворни кода

[成长值分页显示]

tags/广东版3.2.1
meo пре 6 година
родитељ
комит
664f7b2957
3 измењених фајлова са 59 додато и 55 уклоњено
  1. +49
    -55
      pages/czdetail/czdetail.js
  2. +3
    -0
      pages/czdetail/czdetail.wxml
  3. +7
    -0
      pages/czdetail/czdetail.wxss

+ 49
- 55
pages/czdetail/czdetail.js Прегледај датотеку

@@ -9,6 +9,10 @@ Page({
*/ */
data: { data: {
score: 10, score: 10,
pageNum:1,
list:[],
showcontent:false,
loading:""
}, },


/** /**
@@ -22,24 +26,52 @@ Page({
url: '/pages/grade/grade', 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; let that = this;
Http.get({ Http.get({
url: config.api.scoreHistory, url: config.api.scoreHistory,
data: { data: {
pageNum: 1,
pageSize: 100
pageNum: pageNum,
pageSize: 15
} }
}) })
.then(res => { .then(res => {
console.log(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") file.createDate = util.formatTime(file.createDate, "yyyy-MM-dd hh:mm:ss")
}); });
that.setData({ 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 => { .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);
} }
}) })

+ 3
- 0
pages/czdetail/czdetail.wxml Прегледај датотеку

@@ -24,4 +24,7 @@
<text wx:if="{{0>=item.scoreAmount}}">{{item.scoreAmount}}分</text> <text wx:if="{{0>=item.scoreAmount}}">{{item.scoreAmount}}分</text>
</view> </view>
</view> </view>
</view>
<view class='loading'>
{{loading}}
</view> </view>

+ 7
- 0
pages/czdetail/czdetail.wxss Прегледај датотеку

@@ -99,4 +99,11 @@
} }
.fr text{ .fr text{
color: #FF3535; color: #FF3535;
}
.loading{
text-align: center;
height: 80rpx;
line-height: 80rpx;
color: #999;
font-size: 26rpx;
} }

Loading…
Откажи
Сачувај