|
@@ -10,7 +10,10 @@ Page({
|
|
|
data: {
|
|
|
navState: 0,//导航状态
|
|
|
id:"",
|
|
|
- aclist:[]
|
|
|
+ aclist:[],
|
|
|
+ page:1,
|
|
|
+ size:20,
|
|
|
+ isLoading:false
|
|
|
},
|
|
|
//监听滑块
|
|
|
bindchange(e) {
|
|
@@ -55,7 +58,7 @@ Page({
|
|
|
})
|
|
|
console.log(options);
|
|
|
this.setData({
|
|
|
- aclist:"",
|
|
|
+ aclist:[],
|
|
|
id:options.id
|
|
|
})
|
|
|
|
|
@@ -80,13 +83,25 @@ Page({
|
|
|
|
|
|
},
|
|
|
send(){
|
|
|
- send(1,20,20430).then(res=>{
|
|
|
+ this.setData({
|
|
|
+ isLoading:true
|
|
|
+ })
|
|
|
+ wx.showLoading({
|
|
|
+ title: '数据加载中...',
|
|
|
+ })
|
|
|
+ send(this.data.page,this.data.size,20430).then(res=>{
|
|
|
if(res.result){
|
|
|
+ let a = this.data.aclist
|
|
|
+ a.push(...res.data.DATA)
|
|
|
this.setData({
|
|
|
- aclist:res.data.DATA
|
|
|
+ aclist:a
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ wx.hideLoading() // 关闭loading
|
|
|
+ this.setData({
|
|
|
+ isLoading:false
|
|
|
+ })
|
|
|
},
|
|
|
send1(){
|
|
|
wx.request({
|
|
@@ -161,8 +176,19 @@ Page({
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
- onReachBottom() {
|
|
|
+ onReachBottom: function () {
|
|
|
+
|
|
|
+ if(this.data.isLoading) return //判断是否为true
|
|
|
+ let page = this.data.page+1;
|
|
|
+ this.setData({
|
|
|
+ page:page// 让页码值自增 +1
|
|
|
+ })
|
|
|
|
|
|
+ switch(this.data.id){
|
|
|
+ case "1":
|
|
|
+ this.send();
|
|
|
+ break
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|