yuanyiming 1 year ago
parent
commit
7e43ae06a1

+ 3 - 2
App.vue

@@ -98,10 +98,11 @@
 
 <style>
 	/*每个页面公共css */
-	body {
+	body,html {
 		background-color: #f0f2f5;
 		/* font-family: PingFang SC; */
-
+		height: 100vh;
+		width: 750rpx;
 	}
 
 	view {

+ 33 - 37
pages.json

@@ -7,7 +7,7 @@
 		}
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
-		
+
 		{
 			"path": "pages/index/index",
 			"style": {
@@ -16,13 +16,12 @@
 			}
 		},
 		{
-		    "path" : "pages/login_Wechat/login_Wechat",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "",
-		        "enablePullDownRefresh": false
-		    }
-		    
+			"path": "pages/login_Wechat/login_Wechat",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
 		},
 		{
 			"path": "pages/publish/publish",
@@ -30,7 +29,7 @@
 				"navigationBarTitleText": "",
 				"enablePullDownRefresh": false
 			}
-		
+
 		},
 		{
 			"path": "pages/login/login",
@@ -205,34 +204,31 @@
 
 		}
 
-	    ,{
-            "path" : "pages/liveActivityList/liveActivityList",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/Sign/Sign",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/mineRelease/mineRelease",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-    ],
+		, {
+			"path": "pages/liveActivityList/liveActivityList",
+			"style": {
+				"navigationBarTitleText": ""
+				// "enablePullDownRefresh": false,
+				// "enablePullDownRefresh": true
+				// "onReachBottomDistance": 50
+			}
+
+		}, {
+			"path": "pages/Sign/Sign",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mineRelease/mineRelease",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}
+	],
 	"tabBar": {
 		// "custom": true,
 		"backgroundColor": "#ffffff",

+ 56 - 13
pages/activityList/activityList.vue

@@ -2,10 +2,19 @@
 	<view class="activeList">
 		<statusBar :item="navbarData"></statusBar>
 		<!-- <teaching-case :item="teaData"></teaching-case> -->
-		<view class="" style="padding-bottom: 50rpx;">
+		<!-- 		<view class="" style="padding-bottom: 50rpx;">
 			<teaching-case :activeList="activeList" :indexId="index"></teaching-case>
-		</view>
+		</view> -->
+		<scroll-view class="list" scroll-y="true">
+			<view>
+				<teaching-case :activeList="activeList" :indexId="index"></teaching-case>
+			</view>
 
+		</scroll-view>
+		<view class="loading">
+			<view v-if="newsLoading==1">数据加载中...</view>
+			<view v-if="newsLoading==2">没有更多了~~</view>
+		</view>
 
 	</view>
 </template>
@@ -22,27 +31,61 @@
 					btn: 1
 				},
 				activeList: [],
+				// 触底加载动画提示
+				newsLoading: 1, //0默认值  1加载中 2没有更多了
+				currentPage: 1,
+
 			};
 		},
-		methods:{
+		methods: {
 			// 获取教研活动
-			getData(){
-				let data={
-					openid:uni.getStorageSync('oId'),ty:1
+			getData() {
+				let data = {
+					openid: uni.getStorageSync('oId'),
+					ty: 1,
+					page: 1, //下拉获取更多的备用字段
+					lim: 6 //一次获取多少数据
 				}
-					this.$request('/selectActivity',"POST",data).then(res=>{
-						console.log(res[0]);
-						// this.activeList=[...this.activeList,...res[0]]
-						this.activeList=res[0]
-					})
+				this.$request('/selectActivity', "POST", data).then(res => {
+					console.log(res[0]);
+					if (!res[0].length) {
+						this.newsLoading = 2
+					} else {
+						this.newsLoading = 0
+					}
+					this.activeList = [...this.activeList, ...res[0]]
+					// this.activeList = res[0]
+				})
 			},
+
 		},
-		onShow() {
+		// 触底加载更多
+		onReachBottom() {
+			console.log(111);
+			if (this.newsLoading == 2) {
+				return
+			}
+			this.newsLoading = 1
+			this.currentPage++
+			setTimeout(this.getData, 2000)
+
+		},
+		onLoad() {
 			this.getData()
 		}
 	}
 </script>
 
 <style lang="scss">
-	.activeList {}
+	.activeList {
+		.loading {
+			height: 50rpx;
+			text-align: center;
+			padding-top: 20rpx;
+			padding-bottom: 100rpx;
+			font-size: 26rpx;
+			color: #888;
+			line-height: 2em;
+		}
+	}
 </style>

+ 54 - 13
pages/activityList_2/activityList_2.vue

@@ -2,11 +2,20 @@
 	<view class="activeList">
 		<statusBar :item="navbarData"></statusBar>
 		<!-- <teaching-case :item="teaData"></teaching-case> -->
-		<view class="" style="padding-bottom: 50rpx;">
-			<teaching-case  :activeList="activeList" :indexId="index" :item="teaData"></teaching-case>
-		</view>
+		<!-- <view class="" style="padding-bottom: 50rpx;">
+			<teaching-case :activeList="activeList" :indexId="index" :item="teaData"></teaching-case>
+		</view> -->
 
+		<scroll-view class="list" scroll-y="true">
+			<view>
+				<teaching-case :activeList="activeList" :indexId="index" :item="teaData"></teaching-case>
+			</view>
+		</scroll-view>
 
+		<view class="loading">
+			<view v-if="newsLoading==1">数据加载中...</view>
+			<view v-if="newsLoading==2">没有更多了~~</view>
+		</view>
 	</view>
 </template>
 
@@ -23,26 +32,58 @@
 					btn_2: 1,
 				},
 				activeList: [],
+				// 触底加载动画提示
+				newsLoading: 1, //0默认值  1加载中 2没有更多了
+				currentPage: 1,
 			};
 		},
 		methods: {
-			getData(){
-				let data={
-					openid:uni.getStorageSync('oId'),ty:2
+			getData() {
+				let data = {
+					openid: uni.getStorageSync('oId'),
+					ty: 2,
+					page: 1, //下拉获取更多的备用字段
+					lim: 10 //一次获取多少数据
 				}
-					this.$request('/selectActivity',"POST",data).then(res=>{
-						console.log(res[0]);
-						// this.activeList=[...this.activeList,...res[0]]
-						this.activeList=res[0]
-					})
+				this.$request('/selectActivity', "POST", data).then(res => {
+					console.log(res[0]);
+					if (!res[0].length) {
+						this.newsLoading = 2
+					} else {
+						this.newsLoading = 0
+					}
+					this.activeList=[...this.activeList,...res[0]]
+					// this.activeList = res[0]
+				})
 			},
 		},
-		onShow() {
+		// 触底加载更多
+		onReachBottom() {
+			console.log(111);
+			if (this.newsLoading == 2) {
+				return
+			}
+			this.newsLoading = 1
+			this.currentPage++
+			setTimeout(this.getData,2000)
+			
+		},
+		onLoad() {
 			this.getData()
 		}
 	}
 </script>
 
 <style lang="scss">
-	.activeList {}
+	.activeList {
+		.loading{
+			height: 50rpx;
+			text-align: center;
+			padding-top: 20rpx;
+			padding-bottom: 100rpx;
+			font-size: 26rpx;
+			color:#888;
+			line-height: 2em;
+		}
+	}
 </style>

+ 8 - 2
pages/activityPage/activityPage.vue

@@ -83,7 +83,10 @@
 			// 获取教研活动
 			getData(){
 				let data={
-					openid:uni.getStorageSync('oId'),ty:1
+					openid:uni.getStorageSync('oId'),
+					ty:1,
+					page:1, //下拉获取更多的备用字段
+					lim:6   //一次获取多少数据
 				}
 					this.$request('/selectActivity',"POST",data).then(res=>{
 						console.log(res[0]);
@@ -94,7 +97,10 @@
 			// 获取直播活动
 			getData2(){
 				let data={
-					openid:uni.getStorageSync('oId'),ty:0
+					openid:uni.getStorageSync('oId'),
+					ty:0,
+					page:1, //下拉获取更多的备用字段
+					lim:2   //一次获取多少数据
 				}
 					this.$request('/selectActivity',"POST",data).then(res=>{
 						console.log(res[0]);

+ 3 - 1
pages/index/index.vue

@@ -121,7 +121,9 @@
 			getData() {
 				let data = {
 					openid: uni.getStorageSync('oId'),
-					ty: 2
+					ty: 2,
+					page:1, //下拉获取更多的备用字段
+					lim:6   //一次获取多少数据
 				}
 				this.$request('/selectActivity', "POST", data).then(res => {
 					console.log(res[0]);

+ 72 - 13
pages/liveActivityList/liveActivityList.vue

@@ -2,11 +2,23 @@
 	<view class="activityList">
 		<statusBar :item="navbarData"></statusBar>
 		<!-- <teaching-case :item="teaData"></teaching-case> -->
-		<view class="" style="padding-bottom: 50rpx;">
+		<!-- <view class="" style="padding-bottom: 50rpx;">
 			<teaching-case :activeList="activeList" :indexId="index" :item="teaData"></teaching-case>
-		</view>
+		</view> -->
+
+
+		<scroll-view class="list" scroll-y="true">
+			<view>
+				<teaching-case :activeList="activeList" :indexId="index" :item="teaData"></teaching-case>
+			</view>
 
+		</scroll-view>
 
+
+		<view class="loading">
+			<view v-if="newsLoading==1">数据加载中...</view>
+			<view v-if="newsLoading==2">没有更多了~~</view>
+		</view>
 	</view>
 </template>
 
@@ -22,28 +34,75 @@
 					btn: 1,
 					btn_2: 2
 				},
+				// 数据
 				activeList: [],
+				// 触底加载动画提示
+				newsLoading: 1, //0默认值  1加载中 2没有更多了
+				currentPage: 1,
+
 			};
 		},
-		methods:{
+		methods: {
 			// 获取教研活动
-			getData(){
-				let data={
-					openid:uni.getStorageSync('oId'),ty:0
+			getData() {
+				let data = {
+					openid: uni.getStorageSync('oId'),
+					ty: 0,
+					page: this.currentPage, //下拉获取更多的字段
+					lim: 10 //一次获取多少数据
 				}
-					this.$request('/selectActivity',"POST",data).then(res=>{
-						console.log(res[0]);
-						// this.activeList=[...this.activeList,...res[0]]
-						this.activeList=res[0]
-					})
+				this.$request('/selectActivity', "POST", data).then(res => {
+					console.log(res[0]);
+					if (!res[0].length) {
+						this.newsLoading = 2
+					} else {
+						this.newsLoading = 0
+					}
+					this.activeList = [...this.activeList, ...res[0]]
+					// this.activeList=res[0]
+				})
 			},
 		},
-		onShow() {
+		// 触底加载更多
+		onReachBottom() {
+			console.log(111);
+			if (this.newsLoading == 2) {
+				return
+			}
+			this.newsLoading = 1
+			this.currentPage++
+			setTimeout(this.getData,2000)
+			
+		},
+		// onShow() {
+		// 	this.getData()
+		// }
+		onLoad() {
 			this.getData()
 		}
 	}
 </script>
 
 <style lang="scss">
-	.activityList {}
+	.activityList {
+		.list {
+			// height: 100vh;
+			// background-color: rebeccapurple;
+		}
+
+		.bottom {
+			margin: 30rpx auto;
+			text-align: center;
+		}
+		
+		.loading{
+			height: 50rpx;
+			text-align: center;
+			padding-top: 20rpx;
+			padding-bottom: 100rpx;
+			font-size: 26rpx;
+			color:#888;
+			line-height: 2em;
+		}
+	}
 </style>