|
@ -1,6 +1,11 @@ |
|
|
// subpages/integralCentre/pages/index/index.js
|
|
|
// subpages/integralCentre/pages/index/index.js
|
|
|
import { pointsRecordlist } from '../../../../utils/api' |
|
|
import { |
|
|
import { getTimestamp } from '../../../../utils/common' |
|
|
pointsRecordlist, |
|
|
|
|
|
pointsRankinglist |
|
|
|
|
|
} from '../../../../utils/api' |
|
|
|
|
|
import { |
|
|
|
|
|
getTimestamp |
|
|
|
|
|
} from '../../../../utils/common' |
|
|
Page({ |
|
|
Page({ |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -9,7 +14,9 @@ Page({ |
|
|
data: { |
|
|
data: { |
|
|
pageIndex: 1, |
|
|
pageIndex: 1, |
|
|
pageSize: 10, |
|
|
pageSize: 10, |
|
|
pointsRecordlist:[],//积分记录列表
|
|
|
pointsRecordlist: [], //积分记录列表
|
|
|
|
|
|
pointsRankinglist: [], //积分排行
|
|
|
|
|
|
rankingType: 0, //排名方式
|
|
|
selectTab: 'tab1', |
|
|
selectTab: 'tab1', |
|
|
typeList: [{ //排名方式:0-周,1-月
|
|
|
typeList: [{ //排名方式:0-周,1-月
|
|
|
type: '0', |
|
|
type: '0', |
|
@ -26,21 +33,31 @@ Page({ |
|
|
loadMoreType: 'none', |
|
|
loadMoreType: 'none', |
|
|
loadMoreVisible: false, |
|
|
loadMoreVisible: false, |
|
|
}, |
|
|
}, |
|
|
|
|
|
/** |
|
|
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
|
|
*/ |
|
|
|
|
|
onLoad: function(options) { |
|
|
|
|
|
this.pointsRecordlist(); //初始化加载积分记录列表
|
|
|
|
|
|
}, |
|
|
// tab 切换
|
|
|
// tab 切换
|
|
|
onTabChange(e) { |
|
|
onTabChange(e) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
|
|
|
pageIndex: 1, |
|
|
|
|
|
pageSize: 10, |
|
|
loadMoreType: 'none', |
|
|
loadMoreType: 'none', |
|
|
loadMoreVisible: false, |
|
|
loadMoreVisible: false, |
|
|
pointsRecordlist:[], |
|
|
pointsRecordlist: [], |
|
|
|
|
|
pointsRankinglist: [], |
|
|
selectTab: e.currentTarget.dataset.tab, |
|
|
selectTab: e.currentTarget.dataset.tab, |
|
|
}) |
|
|
}) |
|
|
if (this.data.selectTab == 'tab1'){ |
|
|
if (this.data.selectTab == 'tab1') { |
|
|
this.pointsRecordlist();//初始化加载积分记录列表
|
|
|
this.pointsRecordlist(); //初始化加载积分记录列表
|
|
|
}else{ |
|
|
} else { |
|
|
console.log('积分排行') |
|
|
this.pointsRankinglist(); //积分排行
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onButtonChange: function (e) { |
|
|
// 排行切换
|
|
|
|
|
|
onButtonChange: function(e) { |
|
|
const list = this.data.typeList |
|
|
const list = this.data.typeList |
|
|
let that = this; |
|
|
let that = this; |
|
|
list.forEach(item => { |
|
|
list.forEach(item => { |
|
@ -52,14 +69,18 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
typeList: list, |
|
|
typeList: list, |
|
|
|
|
|
rankingType: e.currentTarget.dataset.type, |
|
|
|
|
|
pageIndex: 1, |
|
|
|
|
|
pageSize: 10, |
|
|
|
|
|
timestamp: this.data.timestamp, |
|
|
|
|
|
loadMoreType: 'none', |
|
|
|
|
|
loadMoreVisible: false, |
|
|
|
|
|
pointsRankinglist: [], |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
that.pointsRankinglist() |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
|
|
*/ |
|
|
|
|
|
onLoad: function(options) { |
|
|
|
|
|
this.pointsRecordlist();//初始化加载积分记录列表
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取事件详情
|
|
|
// 获取事件详情
|
|
|
pointsRecordlist() { |
|
|
pointsRecordlist() { |
|
@ -67,10 +88,9 @@ Page({ |
|
|
const para = { |
|
|
const para = { |
|
|
pageIndex: this.data.pageIndex, |
|
|
pageIndex: this.data.pageIndex, |
|
|
pageSize: this.data.pageSize, |
|
|
pageSize: this.data.pageSize, |
|
|
timestamp: this.data.timestamp |
|
|
timestamp: this.data.timestamp, |
|
|
} |
|
|
} |
|
|
pointsRecordlist(para).then(res => { |
|
|
pointsRecordlist(para).then(res => { |
|
|
console.log('积分记录列表', res) |
|
|
|
|
|
that.setData({ |
|
|
that.setData({ |
|
|
pointsRecordlist: that.data.pointsRecordlist.concat(res.data), |
|
|
pointsRecordlist: that.data.pointsRecordlist.concat(res.data), |
|
|
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', |
|
|
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', |
|
@ -84,6 +104,31 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 积分记录-积分排行接口
|
|
|
|
|
|
pointsRankinglist() { |
|
|
|
|
|
let that = this |
|
|
|
|
|
const para = { |
|
|
|
|
|
pageIndex: this.data.pageIndex, |
|
|
|
|
|
pageSize: this.data.pageSize, |
|
|
|
|
|
timestamp: this.data.timestamp, |
|
|
|
|
|
rankingType: this.data.rankingType, //排名方式:0-周,1-月
|
|
|
|
|
|
} |
|
|
|
|
|
pointsRankinglist(para).then(res => { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
pointsRankinglist: that.data.pointsRankinglist.concat(res.data), |
|
|
|
|
|
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
loadMoreType: 'none', |
|
|
|
|
|
pointsRankinglist: [] |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
*/ |
|
|
*/ |
|
|