zhengkaixin пре 3 година
родитељ
комит
c32d33e04b
2 измењених фајлова са 80 додато и 6 уклоњено
  1. 33 5
      pages/index/index.vue
  2. 47 1
      pages/user/index.vue

+ 33 - 5
pages/index/index.vue

@@ -3,10 +3,14 @@
 
 		<!-- 头部图片 -->
 		<view class="banner">
-			<u-swiper  bg-color="#fff" :list="bannerList" @click="clickBanner" height="600" :img-mode="'aspectFit'" :name="'picUrl'" >
-			</u-swiper>
+			 <u-swiper  bg-color="#fff" 
+			 :img-mode="'scaleToFill'" height="600" 
+			 :list="bannerList" @click="clickBanner"  :name="'picUrl'" >
+			</u-swiper> 
+			
+<!-- 			<img :src="indexLogo?indexLogo:'static/img/banner1.jpg'" alt="">
+ -->			
 		</view>
-			<!-- <img :src="indexLogo?indexLogo:'static/img/banner1.jpg'" alt=""> -->
 
 		<!-- 选项列表 -->
 		<view class="option-list">
@@ -51,7 +55,7 @@
 		</view>
 
 		<!-- 模式选择 -->
-		<u-mask :show="show">
+		<u-mask :show="false">
 			<view class="wrap">
 
 
@@ -332,6 +336,28 @@
 			this.getActivityInfoList();
 		},
 		methods: {
+			clickBanner(index){
+				var mod= this.bannerList[index]
+				
+				if(mod.linkUrl.indexOf('http')==0){
+				    window.location=mod.linkUrl;
+				}
+				else if(mod.linkUrl.indexOf('#/')==0){
+					if(mod.linkUrl.indexOf("?")==-1){
+						mod.linkUrl+='?';
+					}
+				    window.location=mod.linkUrl;
+				}
+				else if(mod.linkUrl=='#'||mod.linkUrl==''){
+				
+				}
+				else{
+					uni.navigateTo({
+						url:mod.linkUrl
+					})
+				}
+				
+			},
 			getBannerInfo(code){
 				uni.showLoading({
 					title: "加载中",
@@ -340,7 +366,8 @@
 				newsApi.getBannerInfo(code).then((res) => {
 					this.bannerList =res.data;
 					
-					}).catch(error => {
+					 document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 300px;"
+				 }).catch(error => {
 						uni.showToast({
 						
 							title: error,icon: "none"
@@ -562,6 +589,7 @@
 </script>
 
 <style lang="scss" scoped>
+	 
 	// 头部图片
 	img {
 		width: 100%;

+ 47 - 1
pages/user/index.vue

@@ -22,7 +22,12 @@
 			</view>
 		</view>
 		<view class="userBanner">
-			<u-image width="100%" height="80px" src="../../static/img/banner.jpg" border-radius="16"></u-image>
+<!-- 			<u-image width="100%" height="80px" src="../../static/img/banner.jpg" border-radius="16"></u-image>
+ -->			<u-swiper  bg-color="#fff"
+			 :img-mode="'scaleToFill'" height="160" 
+			 :list="bannerList" @click="clickBanner"  :name="'picUrl'" >
+			</u-swiper> 
+		
 		</view>
 		<view class="userIcon">
 			<view class="userIcon-tit">
@@ -114,6 +119,7 @@
 	import * as loginApi from '@/apis/login.js'
 	import * as WxJsApi from '@/utils/wxJsApi.js'
 	import Tabbar from '@/components/Tabbar.vue'
+	import * as newsApi from '@/apis/news.js'
 	
 	export default {
 		components: {
@@ -132,6 +138,7 @@
 				title: '联系客服',
 				content: '400-8899-619',
 				confirmText: '拨打电话',
+				bannerList:[],
 				background:{
 					background: 'none'
 				},
@@ -163,8 +170,47 @@
 			if(consumerPhone){
 				this.content=consumerPhone
  			}
+			this.getBannerInfo("userinfo")
 		},
 		methods: {
+			clickBanner(index){
+				var mod= this.bannerList[index]
+				
+				if(mod.linkUrl.indexOf('http')==0){
+				    window.location=mod.linkUrl;
+				}
+				else if(mod.linkUrl.indexOf('#/')==0){
+					if(mod.linkUrl.indexOf("?")==-1){
+						mod.linkUrl+='?';
+					}
+				    window.location=mod.linkUrl;
+				}
+				else if(mod.linkUrl=='#'||mod.linkUrl==''){
+				
+				}
+				else{
+					uni.navigateTo({
+						url:mod.linkUrl
+					})
+				}
+				
+			},
+			getBannerInfo(code){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				newsApi.getBannerInfo(code).then((res) => {
+					this.bannerList =res.data;
+					
+					// document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 300px;"
+				 }).catch(error => {
+						uni.showToast({
+						
+							title: error,icon: "none"
+						})
+				})
+			},
 			getCouponList() {
 				uni.showLoading({
 					title: "加载中",