wkyy před 3 roky
rodič
revize
3404266dcb
2 změnil soubory, kde provedl 55 přidání a 7 odebrání
  1. 19 2
      pages/article/newsNotice.vue
  2. 36 5
      pages/index/index.vue

+ 19 - 2
pages/article/newsNotice.vue

@@ -81,7 +81,7 @@
 				</view>
 			</view>
 		</view>
-		<u-divider>已经到底了</u-divider>
+		<u-divider v-if="newsList.length ==recordsTotal">已经到底了</u-divider>
 	</view>
 </template>
 
@@ -89,6 +89,9 @@
 	export default {
 		data() {
 			return {
+				newsList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
 				list: [{
 						image: '/static/img/快乐周末游1x (1).png',
 					}
@@ -96,8 +99,22 @@
 				],
 			}
 		},
+		onReachBottom() {
+			if (this.newsList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
+		onReady() {
+			this.getNewsList();
+		},
 		methods: {
-
+			getNewsList() {
+				
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getNewsList()
+			},
 		}
 	}
 		

+ 36 - 5
pages/index/index.vue

@@ -10,7 +10,7 @@
 		<!-- 选项列表 -->
 		<view class="option-list">
 
-			<view class="list-item">
+			<view class="list-item" @click="scanCode">
 				<view class="icon iconfont" style="background-color:#59d96e;">
 					&#xe61a;
 				</view>
@@ -124,7 +124,7 @@
 						<view class="line" style="margin-top:4px;"></view>新闻公告
 					</view>
 
-					<view class="more">更多<view class="more-icon iconfont"> &#xe600;</view>
+					<view class="more" @click="toNewsNotice">更多<view class="more-icon iconfont"> &#xe600;</view>
 					</view>
 
 
@@ -160,7 +160,7 @@
 						</view>
 					</view>
 				</view>
-				<view class="bottom">
+				<view class="bottom" v-if="newsList.length ==recordsTotal">
 					<view class="bot">
 						<view class="bot-line"></view>
 						<view class="bot-text">已经到底了</view>
@@ -195,6 +195,9 @@
 	export default {
 		data() {
 			return {
+				newsList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
 				longitude: '',
 				latitude: '',
 				message: '',
@@ -226,14 +229,35 @@
 				current: 0
 			}
 		},
+		onReachBottom() {
+			if (this.newsList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
 		onReady() {
-			WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
+			WxJsApi.getWxConfig(['getLocation','addEventListener','scanQRCode']).then((res)=>{
 				// console.log(res)
 			}).catch(error => {
 					console.log(res)
-			})	
+			})
+			
+			this.getPoint();
+			this.getNewsList();
 		},
 		methods: {
+			toNewsNotice() {
+				uni.navigateTo({
+					url: '/pages/article/newsNotice'
+				})
+			},
+			//微信扫二维码
+			scanCode() {
+				WxJsApi.scanQRCode(1).then(res => {
+					
+				}).catch(error => {
+					
+				})
+			},
 			getPoint() {
 				WxJsApi.getLocation().then((res) => {
 					this.latitude = parseFloat(res.latitude);
@@ -251,6 +275,13 @@
 					})					
 				})
 			},
+			getNewsList() {
+				
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getNewsList()
+			},
 		}
 	}
 </script>