|
@@ -13,29 +13,49 @@ Page({
|
|
*/
|
|
*/
|
|
loadingData: false,
|
|
loadingData: false,
|
|
enterpriseList: [],
|
|
enterpriseList: [],
|
|
|
|
+ isRefresh: true,
|
|
|
|
+ total: 0,
|
|
pageNum: 1 // 页码
|
|
pageNum: 1 // 页码
|
|
},
|
|
},
|
|
onLoad: function () {
|
|
onLoad: function () {
|
|
// wx.showLoading({
|
|
// wx.showLoading({
|
|
// title: '加载中'
|
|
// title: '加载中'
|
|
// })
|
|
// })
|
|
- this.loadData(this.data.pageNum)
|
|
|
|
|
|
+ this.loadData()
|
|
},
|
|
},
|
|
//加载数据
|
|
//加载数据
|
|
- loadData: function (num) {
|
|
|
|
- http.send_post("/system/AppEnterpriseController/getInitEnterpriseList", null, this.getQiyeEnterpriseListSuccess)
|
|
|
|
|
|
+ loadData: function () {
|
|
|
|
+ let obj = new Object()
|
|
|
|
+ obj.pageNum = this.data.pageNum
|
|
|
|
+ obj.pageSize = 10
|
|
|
|
+ obj.reasonable= false
|
|
|
|
+ http.send_get("/system/AppNoticeController/getNotice", obj, this.getQiyeEnterpriseListSuccess)
|
|
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
getQiyeEnterpriseListSuccess(res) {
|
|
getQiyeEnterpriseListSuccess(res) {
|
|
|
|
|
|
- console.log("####" + this.pageNum)
|
|
|
|
- this.setData({
|
|
|
|
- enterpriseList: res.rows,
|
|
|
|
|
|
+console.log("@@@@",res)
|
|
|
|
+ // 显示加载图标
|
|
|
|
+ wx.showLoading({
|
|
|
|
+ title: '玩命加载中',
|
|
})
|
|
})
|
|
var that = this
|
|
var that = this
|
|
- if (this.data.pageNum == 1) {
|
|
|
|
|
|
+
|
|
|
|
+ if(res.data.rows.length==0){
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '暂无更多数据',
|
|
|
|
+ icon:"none"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (this.data.isRefresh) {
|
|
|
|
+ this.setData({
|
|
|
|
+ enterpriseList: res.data.rows,
|
|
|
|
+ total: res.data.total
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
// 隐藏导航栏加载框
|
|
// 隐藏导航栏加载框
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
that.setData({
|
|
that.setData({
|
|
@@ -44,10 +64,14 @@ Page({
|
|
wx.hideNavigationBarLoading();
|
|
wx.hideNavigationBarLoading();
|
|
// 停止下拉动作
|
|
// 停止下拉动作
|
|
wx.stopPullDownRefresh();
|
|
wx.stopPullDownRefresh();
|
|
|
|
+ wx.hideLoading()
|
|
|
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
+ this.setData({
|
|
|
|
+ enterpriseList: this.data.enterpriseList.concat(res.data.rows)
|
|
|
|
+ })
|
|
// 隐藏加载框
|
|
// 隐藏加载框
|
|
|
|
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
@@ -59,9 +83,8 @@ Page({
|
|
wx.hideLoading();
|
|
wx.hideLoading();
|
|
}, 1000)
|
|
}, 1000)
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
},
|
|
},
|
|
onPullDownRefresh: function () {
|
|
onPullDownRefresh: function () {
|
|
// 显示顶部刷新图标
|
|
// 显示顶部刷新图标
|
|
@@ -72,37 +95,61 @@ Page({
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
that.setData({
|
|
that.setData({
|
|
- pageNum: 1
|
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ isRefresh: true
|
|
})
|
|
})
|
|
- this.loadData(this.data.pageNum)
|
|
|
|
|
|
+ this.loadData()
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
*/
|
|
onReachBottom: function () {
|
|
onReachBottom: function () {
|
|
- var loadingData = this.data.loadingData
|
|
|
|
- // 显示加载图标
|
|
|
|
- wx.showLoading({
|
|
|
|
- title: '玩命加载中',
|
|
|
|
- })
|
|
|
|
- var hidden = this.data.hidden
|
|
|
|
|
|
+ let that = this
|
|
|
|
+ var loadingData = that.data.loadingData
|
|
|
|
+
|
|
|
|
+ var hidden = that.data.hidden
|
|
// 页数+1
|
|
// 页数+1
|
|
- this.setData({
|
|
|
|
- pageNum: this.data.pageNum + 1
|
|
|
|
|
|
+ that.setData({
|
|
|
|
+ pageNum: that.data.pageNum + 1,
|
|
|
|
+ isRefresh: false
|
|
})
|
|
})
|
|
if (hidden) {
|
|
if (hidden) {
|
|
- this.setData({
|
|
|
|
|
|
+ that.setData({
|
|
hidden: false
|
|
hidden: false
|
|
});
|
|
});
|
|
- console.info(this.data.hidden);
|
|
|
|
|
|
+ console.info(that.data.hidden);
|
|
}
|
|
}
|
|
|
|
|
|
if (loadingData) {
|
|
if (loadingData) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.setData({
|
|
|
|
|
|
+ that.setData({
|
|
loadingData: true
|
|
loadingData: true
|
|
});
|
|
});
|
|
- this.loadData(this.data.pageNum);
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //console.log("@@@@"+Math.ceil(this.data.total/10))
|
|
|
|
+ // if(Math.ceil(that.data.total/10)>=that.data.pageNum){
|
|
|
|
+ that.loadData();
|
|
|
|
+
|
|
|
|
+ // }else{
|
|
|
|
+
|
|
|
|
+ // setTimeout(function () {
|
|
|
|
+ // that.setData({
|
|
|
|
+ // hidden: true,
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // }, 2000)
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bindViewDetails() {
|
|
|
|
+
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../notice/notice_details?busEnterpriseId=' +"d"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
})
|
|
})
|