|
@@ -0,0 +1,165 @@
|
|
|
|
+import http from '../../base/httputil'
|
|
|
|
+const app = getApp()
|
|
|
|
+
|
|
|
|
+Page({
|
|
|
|
+ data: {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 控制上拉到底部时是否出现 "数据加载中..."
|
|
|
|
+ */
|
|
|
|
+ hidden: true,
|
|
|
|
+ /**
|
|
|
|
+ * 数据是否正在加载中,避免数据多次加载
|
|
|
|
+ */
|
|
|
|
+ loadingData: false,
|
|
|
|
+ enterpriseList: [],
|
|
|
|
+ isRefresh: true,
|
|
|
|
+ total: 0,
|
|
|
|
+ pageNum: 1 // 页码
|
|
|
|
+ },
|
|
|
|
+ onLoad: function () {
|
|
|
|
+ // wx.showLoading({
|
|
|
|
+ // title: '加载中'
|
|
|
|
+ // })
|
|
|
|
+ this.loadData()
|
|
|
|
+ },
|
|
|
|
+ //加载数据
|
|
|
|
+ loadData: function () {
|
|
|
|
+ let obj = new Object()
|
|
|
|
+ obj.pageNum = this.data.pageNum
|
|
|
|
+ obj.pageSize = 10
|
|
|
|
+ obj.reasonable= false
|
|
|
|
+ http.send_get("/system/AppTeamController/getTeamList", obj, this.getQiyeEnterpriseListSuccess)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ getQiyeEnterpriseListSuccess(res) {
|
|
|
|
+
|
|
|
|
+console.log("@@@@",res)
|
|
|
|
+if(res.code==200){
|
|
|
|
+ // 显示加载图标
|
|
|
|
+ wx.showLoading({
|
|
|
|
+ title: '玩命加载中',
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ var that = this
|
|
|
|
+
|
|
|
|
+ if(res.data.rows.length==0){
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '暂无更多数据',
|
|
|
|
+ icon:"none"
|
|
|
|
+ })
|
|
|
|
+ wx.hideLoading()
|
|
|
|
+ }
|
|
|
|
+ if (this.data.isRefresh) {
|
|
|
|
+ this.setData({
|
|
|
|
+ enterpriseList: res.data.rows,
|
|
|
|
+ total: res.data.total
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 隐藏导航栏加载框
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ that.setData({
|
|
|
|
+ loadingData: false
|
|
|
|
+ });
|
|
|
|
+ wx.hideNavigationBarLoading();
|
|
|
|
+ // 停止下拉动作
|
|
|
|
+ wx.stopPullDownRefresh();
|
|
|
|
+ wx.hideLoading()
|
|
|
|
+
|
|
|
|
+ }, 1000)
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ this.setData({
|
|
|
|
+ enterpriseList: this.data.enterpriseList.concat(res.data.rows)
|
|
|
|
+ })
|
|
|
|
+ // 隐藏加载框
|
|
|
|
+
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ that.setData({
|
|
|
|
+ hidden: true,
|
|
|
|
+ loadingData: false
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ wx.hideLoading();
|
|
|
|
+ }, 1000)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ console.log("@@!","请求失败")
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onPullDownRefresh: function () {
|
|
|
|
+ // 显示顶部刷新图标
|
|
|
|
+ wx.showNavigationBarLoading();
|
|
|
|
+ var that = this;
|
|
|
|
+ var loadingData = this.data.loadingData
|
|
|
|
+ if (loadingData) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ that.setData({
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ isRefresh: true
|
|
|
|
+ })
|
|
|
|
+ this.loadData()
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
|
+ */
|
|
|
|
+ onReachBottom: function () {
|
|
|
|
+ let that = this
|
|
|
|
+ var loadingData = that.data.loadingData
|
|
|
|
+
|
|
|
|
+ var hidden = that.data.hidden
|
|
|
|
+ // 页数+1
|
|
|
|
+ that.setData({
|
|
|
|
+ pageNum: that.data.pageNum + 1,
|
|
|
|
+ isRefresh: false
|
|
|
|
+ })
|
|
|
|
+ if (hidden) {
|
|
|
|
+ that.setData({
|
|
|
|
+ hidden: false
|
|
|
|
+ });
|
|
|
|
+ console.info(that.data.hidden);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (loadingData) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ that.setData({
|
|
|
|
+ loadingData: true
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //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(e) {
|
|
|
|
+ let teamlist_details = e.currentTarget.dataset.index
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../teamlist/team_details?details='+JSON.stringify(teamlist_details)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+})
|