zhengkaixin il y a 3 ans
Parent
commit
314375ccea
1 fichiers modifiés avec 21 ajouts et 2 suppressions
  1. 21 2
      pages/index/index.vue

+ 21 - 2
pages/index/index.vue

@@ -3,9 +3,10 @@
 
 		<!-- 头部图片 -->
 		<view class="banner">
-			<img :src="indexLogo?indexLogo:'static/img/banner1.jpg'" alt="">
+			<u-swiper  bg-color="#fff" :list="bannerList" @click="clickBanner" height="600" :img-mode="'aspectFit'" :name="'picUrl'" >
+			</u-swiper>
 		</view>
-
+			<!-- <img :src="indexLogo?indexLogo:'static/img/banner1.jpg'" alt=""> -->
 
 		<!-- 选项列表 -->
 		<view class="option-list">
@@ -235,6 +236,7 @@
 		},
 		data() {
 			return {
+				bannerList:[],
 				distance: 0,
 				timeOut: false,
 				pointTimeOut: true,
@@ -278,6 +280,8 @@
 					})
 				}
 			}
+			this.getBannerInfo("homepage")
+			
 		},
 		onUnload() {
 			this.timeOut = false;
@@ -328,6 +332,21 @@
 			this.getActivityInfoList();
 		},
 		methods: {
+			getBannerInfo(code){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				newsApi.getBannerInfo(code).then((res) => {
+					this.bannerList =res.data;
+					
+					}).catch(error => {
+						uni.showToast({
+						
+							title: error,icon: "none"
+						})
+				})
+			},
 			elderClick() {
 				if(this.value == "长辈模式") {
 					this.elderStatus = true;