zhengkaixin 1 rok pred
rodič
commit
db0864cefd
1 zmenil súbory, kde vykonal 60 pridanie a 4 odobranie
  1. 60 4
      pages/index/index.vue

+ 60 - 4
pages/index/index.vue

@@ -1,9 +1,23 @@
 <template>
 	<view>
 		<ujp-navbar title="折扣卡购买" :show="false"></ujp-navbar>
-
+		
+	
+		
 		<!-- 头部图片 -->
-		<view class="background">
+		<view class="background">
+			<!-- 新闻 -->
+			
+			<view class=" options-item" v-show="flag&&newsList.length > 0" >
+				
+			
+						<ujp-notice-bar mode="horizontal"
+						 color="#FF3D00" bg-color="#fff"
+						 :list="newsList"></ujp-notice-bar>
+			
+			</view>
+			<view  class="u-navbar-placeholder" style="width: 100%; height: 88rpx;"></view>
+			
 			<view class="banner">
 				<u-swiper bg-color="#fff" :img-mode="'scaleToFill'"   :list="bannerList"
 					@click="clickBanner" :name="'picUrl'">
@@ -631,7 +645,7 @@
 		</view>
 
 		<!-- 新闻 -->
-		<view class="news-title" v-if="newsList.length > 0" >
+		<view  id="options-item"  class="news-title" v-if="newsList.length > 0" >
 			<!-- <view class="news-title-left oldTextjp" oldstyle="font-size:20px;">
 				<view class="line" style="margin-top:4px;"></view>活动公告
 			</view>
@@ -786,6 +800,8 @@
 				pageIndex2: 1,
 				recordsTotal2: 0,
 				defaultStation:[],
+				flag:true,
+				windowHeight:300,
 				shopList:[
 					{
 					iszy:1,
@@ -885,8 +901,34 @@
 			this.getPointTimeOut();
 			this.getNewsList();
 			this.getActivityInfoList();
-			this.getChargingStationDetail()
+			this.getChargingStationDetail()
+			var _this=this
+			uni.getSystemInfo({
+				success: function (res) {
+					console.log(res.windowHeight)
+					_this.windowHeight=res.windowHeight
+				}
+			});
 
+		},
+		onPageScroll(e) {
+			
+			
+			
+			const query = uni.createSelectorQuery().in(this);
+			query.select('#options-item').boundingClientRect(data => {
+				 // console.log("节点离页面顶部的距离为" + data.top);
+				//console.log(this.windowHeight,e.scrollTop ,data.top)
+			  if (this.windowHeight>= data.top+80) {
+			  	this.flag =false;
+			  } else {
+			  	this.flag = true;
+			  }
+			  
+			}).exec();
+			
+			
+			
 		},
 		methods: {
 			
@@ -2913,5 +2955,19 @@
 			}
 			
 		}
+	}
+	
+	.options-item{
+		    width: 100%;
+		    display: flex;
+		    justify-content: center;
+		    background: rgb(255, 255, 255);
+			position: relative;
+			    position: fixed;
+				  
+				    left: 0;
+				    right: 0;
+				    top: 0;
+				    z-index: 991;
 	}
 </style>