tanyanfei vor 4 Jahren
Ursprung
Commit
925ffe83c9
4 geänderte Dateien mit 189 neuen und 93 gelöschten Zeilen
  1. 104 25
      pages/learning/learning.js
  2. 15 3
      pages/learning/learning.wxml
  3. 5 0
      pages/learning/learning.wxss
  4. 65 65
      project.config.json

+ 104 - 25
pages/learning/learning.js

@@ -18,7 +18,13 @@ Page({
     array: ['时间正序', '时间倒序'],
     val: ['ctime', '-ctime'],
     index: 0,
-    show_tj:0
+    show_tj:0,
+    page_0:1,
+    page_1:1,
+    page_2:1,
+    total_0:0,
+    total_1: 0,
+    total_2: 0,
   },
 
   /**
@@ -44,50 +50,123 @@ Page({
       }
     })
     //学术会议
+    this.getcon()
+    //活动预告
+    this.getpre()
+    //活动回顾
+    this.getover()
+  },
+
+  //学术会议
+  next_0: function () {
+    if (this.data.conference.length < this.data.total_0) {
+      const page = this.data.page_0 + 1
+      this.setData({
+        page_0: page
+      })
+      this.getcon()
+    }
+  },
+  getcon: function () {
+    const conference = this.data.conference;
+    const order_by = this.data.val[this.data.index]
     wx.request({
       url: host + '/api/conference/list',
-      data:{
+      method: 'GET',
+      data: {
         order_by: order_by,
-        keyword: this.data.keyword
+        keyword: this.data.keyword,
+        page: this.data.page_0
       },
-      success: function (res) {
-        that.setData({
-          conference: res.data.data.list
-        })
+      success: res => {
+        wx.hideNavigationBarLoading()
+        if (res.data.code == 0) {
+          const list = res.data.data.list;
+          for (let i = 0; i < list.length; i++) {
+            conference.push(list[i])
+          }
+          this.setData({
+            conference: conference,
+            total_0: res.data.data.total
+          })
+        }
+
       }
     })
-    //活动预告
+  },
+  //活动预告
+  next_1: function () {
+    if (this.data.pre.length < this.data.total_1) {
+      const page = this.data.page_1 + 1
+      this.setData({
+        page_1: page
+      })
+      this.getpre()
+    }
+  },
+  getpre: function () {
+    const pre = this.data.pre;
+    const order_by = this.data.val[this.data.index]
     wx.request({
       url: host + '/api/activity/list',
-      data:{
-        type:'pre',
+      method: 'GET',
+      data: {
+        type: 'pre',
         order_by: order_by,
-        keyword: this.data.keyword
+        keyword: this.data.keyword,
+        page: this.data.page_1
       },
-      success: function (res) {
-        if(!res.data){
-          return
+      success: res => {
+        wx.hideNavigationBarLoading()
+        if (res.data.code == 0) {
+          const list = res.data.data.list;
+          for (let i = 0; i < list.length; i++) {
+            pre.push(list[i])
+          }
+          this.setData({
+            pre: pre,
+            total_1: res.data.data.total
+          })
         }
-        that.setData({
-          pre: res.data.data.list
-        })
+
       }
     })
-    //活动回顾
+  },
+  //活动预告
+  next_2: function () {
+    if (this.data.over.length < this.data.total_2) {
+      const page = this.data.page_2 + 1
+      this.setData({
+        page_2: page
+      })
+      this.getover()
+    }
+  },
+  getover: function () {
+    const over = this.data.over;
+    const order_by = this.data.val[this.data.index]
     wx.request({
       url: host + '/api/activity/list',
+      method: 'GET',
       data: {
         type: 'over',
         order_by: order_by,
-        keyword: this.data.keyword
+        keyword: this.data.keyword,
+        page: this.data.page_2
       },
-      success: function (res) {
-        if (!res.data) {
-          return
+      success: res => {
+        wx.hideNavigationBarLoading()
+        if (res.data.code == 0) {
+          const list = res.data.data.list;
+          for (let i = 0; i < list.length; i++) {
+            over.push(list[i])
+          }
+          this.setData({
+            over: over,
+            total_2: res.data.data.total
+          })
         }
-        that.setData({
-          over: res.data.data.list
-        })
+
       }
     })
   },

+ 15 - 3
pages/learning/learning.wxml

@@ -114,7 +114,7 @@
   </swiper-item>
   <!-- 学术会议 -->
   <swiper-item>
-      <scroll-view class="content" scroll-y="true">
+      <scroll-view class="content" scroll-y="true" bindscrolltolower='next_0'>
                 <navigator class="list" wx:for='{{conference}}' wx:key="conference{{index}}" url="../eventDetail/eventDetail?id={{item.id}}">
                       <image  src="{{item.img}}"></image>
                       <view>
@@ -123,11 +123,15 @@
                           <text>{{item.desc}}</text>
                       </view>
                   </navigator> 
+                  <block wx:if='{{total_0 >= 20}}'>
+                  <view class='more' wx:if='{{conference.length < total_0}}'>上拉加载更多...</view>
+                  <view class='more' wx:else>已加载全部数据!</view>
+                  </block>
       </scroll-view>
   </swiper-item>
   <!-- 活动预告 -->
   <swiper-item>
-      <scroll-view class="content" scroll-y="true">
+      <scroll-view class="content" scroll-y="true" bindscrolltolower='next_1'>
                 <navigator class="list" wx:for='{{pre}}' wx:key="pre{{index}}" url="../conference/conference?id={{item.id}}" >
                       <image  mode="widthFix" src="{{item.img}}"></image>
                       <view>
@@ -142,11 +146,15 @@
                           <text>{{item.desc}}</text>
                       </view>
                   </navigator> 
+                  <block wx:if='{{total_1 >= 20}}'>
+                  <view class='more' wx:if='{{pre.length < total_1}}'>上拉加载更多...</view>
+                  <view class='more' wx:else>已加载全部数据!</view>
+                  </block>
       </scroll-view>
   </swiper-item>
   <!-- 活动回顾 -->
   <swiper-item>
-      <scroll-view class="content" scroll-y="true">
+      <scroll-view class="content" scroll-y="true" bindscrolltolower='next_2'>
                 <navigator class="list" wx:for='{{over}}' wx:key="over{{index}}" url="../conference/conference?id={{item.id}}" >
                       <image  mode="widthFix" src="{{item.img}}"></image>
                       <view>
@@ -162,6 +170,10 @@
                           <text>{{item.desc}}</text>
                       </view>
                   </navigator> 
+                  <block wx:if='{{total_2 >= 20}}'>
+                  <view class='more' wx:if='{{over.length < total_2}}'>上拉加载更多...</view>
+                  <view class='more' wx:else>已加载全部数据!</view>
+                  </block>
       </scroll-view>
   </swiper-item>
 </swiper>

+ 5 - 0
pages/learning/learning.wxss

@@ -182,4 +182,9 @@ scroll-view{
 }
 .myswiper{
   height: calc(100vh - 206rpx);
+}
+.more{
+  text-align:center;
+  color:#999;
+  padding:10rpx 0;
 }

+ 65 - 65
project.config.json

@@ -1,67 +1,67 @@
 {
-  "description": "项目配置文件",
-  "packOptions": {
-    "ignore": []
-  },
-  "setting": {
-    "urlCheck": true,
-    "es6": true,
-    "enhance": false,
-    "postcss": true,
-    "preloadBackgroundData": false,
-    "minified": true,
-    "newFeature": true,
-    "coverView": true,
-    "nodeModules": false,
-    "autoAudits": false,
-    "showShadowRootInWxmlPanel": true,
-    "scopeDataCheck": false,
-    "uglifyFileName": false,
-    "checkInvalidKey": true,
-    "checkSiteMap": true,
-    "uploadWithSourceMap": true,
-    "compileHotReLoad": false,
-    "useMultiFrameRuntime": true,
-    "useApiHook": true,
-    "useApiHostProcess": true,
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
-    },
-    "enableEngineNative": false,
-    "bundle": false,
-    "useIsolateContext": true,
-    "useCompilerModule": false,
-    "userConfirmedUseCompilerModuleSwitch": false,
-    "userConfirmedBundleSwitch": false,
-    "packNpmManually": false,
-    "packNpmRelationList": [],
-    "minifyWXSS": true
-  },
-  "compileType": "miniprogram",
-  "libVersion": "2.15.0",
-  "appid": "wx2938132b773c7b5a",
-  "projectname": "zkyxcx",
-  "debugOptions": {
-    "hidedInDevtools": []
-  },
-  "isGameTourist": false,
-  "simulatorType": "wechat",
-  "simulatorPluginLibVersion": {},
-  "condition": {
-    "search": {
-      "list": []
-    },
-    "conversation": {
-      "list": []
-    },
-    "game": {
-      "currentL": -1,
-      "list": []
-    },
-    "miniprogram": {
-      "list": []
-    }
-  }
+	"description": "项目配置文件",
+	"packOptions": {
+		"ignore": []
+	},
+	"setting": {
+		"urlCheck": true,
+		"es6": true,
+		"enhance": false,
+		"postcss": true,
+		"preloadBackgroundData": false,
+		"minified": true,
+		"newFeature": true,
+		"coverView": true,
+		"nodeModules": false,
+		"autoAudits": false,
+		"showShadowRootInWxmlPanel": true,
+		"scopeDataCheck": false,
+		"uglifyFileName": false,
+		"checkInvalidKey": true,
+		"checkSiteMap": true,
+		"uploadWithSourceMap": true,
+		"compileHotReLoad": false,
+		"useMultiFrameRuntime": true,
+		"useApiHook": true,
+		"useApiHostProcess": true,
+		"babelSetting": {
+			"ignore": [],
+			"disablePlugins": [],
+			"outputPath": ""
+		},
+		"enableEngineNative": false,
+		"bundle": false,
+		"useIsolateContext": true,
+		"useCompilerModule": false,
+		"userConfirmedUseCompilerModuleSwitch": false,
+		"userConfirmedBundleSwitch": false,
+		"packNpmManually": false,
+		"packNpmRelationList": [],
+		"minifyWXSS": true
+	},
+	"compileType": "miniprogram",
+	"libVersion": "2.15.0",
+	"appid": "wx2938132b773c7b5a",
+	"projectname": "zkyxcx",
+	"debugOptions": {
+		"hidedInDevtools": []
+	},
+	"isGameTourist": false,
+	"simulatorType": "wechat",
+	"simulatorPluginLibVersion": {},
+	"condition": {
+		"search": {
+			"list": []
+		},
+		"conversation": {
+			"list": []
+		},
+		"game": {
+			"currentL": -1,
+			"list": []
+		},
+		"miniprogram": {
+			"list": []
+		}
+	}
 }