zhanghongrui před 2 roky
rodič
revize
29687c990b

+ 3 - 1
app.json

@@ -25,7 +25,9 @@
     "pages/notice/notice",
     "pages/notice/notice_details",
     "pages/material/material",
-    "pages/denglu/denglu"
+    "pages/denglu/denglu",
+    "pages/material/material_details"
+ 
   
   ],
   "requiredPrivateInfos": [

+ 8 - 0
pages/index/index.js

@@ -86,6 +86,12 @@ Page({
       url: '../notice/notice'
     })
   },
+  //物资跳转
+  bindViewWuZi(){
+    wx.navigateTo({
+      url: '../material/material',
+    })
+  },
   // 新手指南跳转
   bindViewNewComer() {
     wx.navigateTo({
@@ -183,6 +189,8 @@ Page({
       this.bindViewXunjianimg()
     }else if(name=="bindViewGengDuo"){
       this.bindViewGengDuo()
+    }else if(name=="bindViewWuZi"){
+      this.bindViewWuZi()
     }
   },
 

+ 1 - 1
pages/index/index.wxml

@@ -101,7 +101,7 @@
       </view>
         <text>会议</text>
       </view>
-      <view class="icon_vi">
+      <view class="icon_vi" bindtap="bindViewWuZi">
         <view class="icon_bg icon_wz">
         <i class="iconfont icon-wuzichubei"></i>
       </view>

+ 144 - 47
pages/material/material.js

@@ -1,66 +1,163 @@
-// pages/material/material.js
-Page({
+import http from '../../base/httputil'
+const app = getApp()
 
-  /**
-   * 页面的初始数据
-   */
+Page({
   data: {
-    dataList:[],
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
 
+    /**
+     * 控制上拉到底部时是否出现 "数据加载中..."
+     */
+    hidden: true,
+    /**
+     * 数据是否正在加载中,避免数据多次加载
+     */
+    loadingData: false,
+    enterpriseList: [],
+    isRefresh: true,
+    total: 0,
+    pageNum: 1 // 页码
   },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
+  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/AppMaterialController/geMaterialList", obj, this.getQiyeEnterpriseListSuccess)
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-    getDataList();
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
 
   },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
+  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"
+      })
+    }
+    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() {
-
+  onPullDownRefresh: function () {
+    // 显示顶部刷新图标
+    wx.showNavigationBarLoading();
+    var that = this;
+    var loadingData = this.data.loadingData
+    if (loadingData) {
+      return;
+    }
+    that.setData({
+      pageNum: 1,
+      isRefresh: true
+    })
+    this.loadData()
   },
-
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom() {
-
+  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)
+    // }
+
+   
   },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
 
+  bindViewDetails(e) {
+    let material_details = e.currentTarget.dataset.index
+   
+ 
+
+ 
+    wx.navigateTo({
+      url: '../material/material_details?details='+JSON.stringify(material_details)
+    })
   }
 })

+ 3 - 0
pages/material/material.json

@@ -6,6 +6,9 @@
 
   "navigationBarBackgroundColor": "#f94b0e",
   "navigationBarTextStyle": "white",
+  "enablePullDownRefresh": true,
+  "onPullDownRefresh": true,
+  "onReachBottom": true,
   "navigationBarTitleText": "物资"
 
 }

+ 18 - 8
pages/material/material.wxml

@@ -11,14 +11,24 @@
     </button>
   </view>
   <!-- 列表 -->
-  <view class="list_vi">
-    <view class="list_li" bindtap="bindViewDetails" wx:for="{{enterpriseList}}" wx:key="index" data-enterpriseid="{{item.busEnterpriseId}}">
-      <i class="list_icon iconfont icon-queding" wx:if="{{item.riskCount == 0}}"></i>
-      <i class="list_icon iconfont icon-yingjipingtai" wx:if="{{item.riskCount > 0}}"></i>
-      <text>{{item.businessName}}</text>
+<view class="list_vi">
+    <view class="list_li" catchtap="bindViewDetails" wx:for="{{enterpriseList}}" wx:key="index" data-index="{{item}}">
+      <!-- <i class="list_icon iconfont icon-queding" wx:if="{{item.riskCount == 0}}"></i>
+      <i class="list_icon iconfont icon-yingjipingtai" wx:if="{{item.riskCount > 0}}"></i> -->
+      <text>{{item.materialName}}</text>
+      <text>{{item.connector}}</text>
       <i class="iconfont icon-xiangyou list_right"></i>
     </view>
-
-  </view>
-    
 </view>
+    <view class='data-loading' hidden='{{hidden}}'>
+    数据加载中...
+  </view>
+    </view>
+
+    
+
+
+
+
+
+

+ 13 - 1
pages/material/material.wxss

@@ -1,4 +1,4 @@
-/* pages/material/material.wxss */.qy_con {
+.qy_con {
   display: flex;
   flex-direction: row;
   justify-content: space-around;
@@ -33,3 +33,15 @@
 .qy_con view p {
   font-size: 35rpx;
 }
+
+.icon-jiahao {
+  font-size: 60rpx;
+}
+
+.data-loading {
+  height: 100rpx;
+  line-height: 100rpx;
+  background-color: #fff;
+  text-align: center;
+  font-size: 14px;
+}

+ 2 - 8
pages/notice/notice.js

@@ -147,16 +147,10 @@ console.log("@@@@",res)
 
 
   bindViewDetails(e) {
-    let title = e.currentTarget.dataset.title
-    let time = e.currentTarget.dataset.time
-    let by = e.currentTarget.dataset.by
-    let type = e.currentTarget.dataset.type
-    let content = e.currentTarget.dataset.content
- 
-
  
+    let details = e.currentTarget.dataset.index
     wx.navigateTo({
-      url: '../notice/notice_details?title='+title+"&time="+time+"&by="+by+"&type="+type+"&content="+content
+      url: '../notice/notice_details?details='+JSON.stringify(details)
     })
   }
 })

+ 1 - 1
pages/notice/notice.wxml

@@ -4,7 +4,7 @@
 
 <!-- 列表 -->
 <view class="list_vi">
-    <view class="list_li" bindtap="bindViewDetails" wx:for="{{enterpriseList}}" wx:key="index" data-title="{{item.noticeTitle}}" data-time="{{item.createTime}}" data-by="{{item.createBy}}"  data-type="{{item.noticeType}}" data-content="{{item.noticeContent}}">
+    <view class="list_li" catchtap="bindViewDetails" wx:for="{{enterpriseList}}" wx:key="index" data-index="{{item}}">
       <!-- <i class="list_icon iconfont icon-queding" wx:if="{{item.riskCount == 0}}"></i>
       <i class="list_icon iconfont icon-yingjipingtai" wx:if="{{item.riskCount > 0}}"></i> -->
       <text>{{item.noticeTitle}}</text>

+ 6 - 6
pages/notice/notice_details.js

@@ -17,14 +17,14 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+let details=JSON.parse(options.details)
 
     this.setData({
-      noticeTitle: options.title,
-      noticeType: options.type,
-      noticeBy: options.by,
-      noticeTime: options.time,
-      noticeContent: options.content
+      noticeTitle: details.noticeTitle,
+      noticeType: details.noticeType,
+       noticeBy: details.createBy,
+       noticeTime: details.createTime,
+       noticeContent: details.noticeContent
     })
   
   },