zhengkaixin %!s(int64=2) %!d(string=hai) anos
pai
achega
7238dff0e6
Modificáronse 2 ficheiros con 49 adicións e 8 borrados
  1. 47 7
      components/u-navbar/u-navbar.vue
  2. 2 1
      pages/index/index.vue

+ 47 - 7
components/u-navbar/u-navbar.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="">
-		<view class="u-navbar" :style="[navbarStyle]" :class="{ 'u-navbar-fixed': isFixed, 'u-border-bottom': borderBottom }">
+		<view class="u-navbar" v-if="show" :style="[navbarStyle]" :class="{ 'u-navbar-fixed': isFixed, 'u-border-bottom': borderBottom }">
 			<view class="u-status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
 			<view class="u-navbar-inner" :style="[navbarInnerStyle]">
 				<view class="u-back-wrap" v-if="isBack" @tap="goBack">
@@ -29,9 +29,14 @@
 			</view>
 		</view>
 		<!-- 解决fixed定位后导航栏塌陷的问题 -->
-		<view class="u-navbar-placeholder" v-if="isFixed && !immersive" :style="{ width: '100%', height: Number(navbarHeight) + statusBarHeight + 'px' }"></view>
+		<view    class="u-navbar-placeholder" v-if="show&&isFixed && !immersive" :style="{ width: '100%', height: Number(navbarHeight) + statusBarHeight + 'px' }"></view>
 		
-		<u-alert-tips type="warning" v-if="descriptionShow"  :show-icon="true"  :description="description"></u-alert-tips>
+		<u-alert-tips type="warning" v-if="descriptionModel=='top'&&descriptionShow"  :show-icon="true"  :description="description"></u-alert-tips>
+		<u-modal  v-if="descriptionModel=='modal'&&descriptionShow"  v-model="descriptionShow"
+		 confirm-text="知道了"
+		 :title="descriptionTitle" >
+			<view v-html="description" style="padding: 10px;font-size: 14px;"></view>
+		</u-modal>
 
 	
 	</view>
@@ -71,7 +76,10 @@
 	export default {
 		name: "u-navbar",
 		props: {
-			
+			show:{
+				type: Boolean,
+				default:true
+			},
 			// 导航栏高度,单位px,非rpx
 			height: {
 				type: [String, Number],
@@ -173,6 +181,8 @@
 			return {
 				description:'',
 				descriptionShow:false,
+				descriptionTitle:"",
+				descriptionModel:"top",
 				menuButtonInfo: menuButtonInfo,
 				statusBarHeight: systemInfo.statusBarHeight
 			};
@@ -231,20 +241,50 @@
 		},
 		created() {
 			console.log('aaaa')
+			let url=window.location.href.split("#/")[1];
 			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
 			let curRoute = routes[routes.length - 1].route
-			console.log(curRoute);
+			var nowtime=new Date().getTime();
+			
 			var message =this.carhelp.getConfig().message
 			if(message){
 				var list=JSON.parse(message);
 				for(var i in list){
-					if(list[i].name=='*'){
+					// if(list[i].name=='*'){
+					// 	this.descriptionShow=true;
+					// 	this.description=list[i].value;
+					// }
+					if(list[i].name==curRoute){
 						this.descriptionShow=true;
 						this.description=list[i].value;
 					}
-					if(list[i].name==curRoute){
+					if(list[i].name==url||url.indexOf(list[i].name)==0){
 						this.descriptionShow=true;
 						this.description=list[i].value;
+						
+						if(list[i].startTime){
+							var startTime=new Date(list[i].startTime).getTime()
+							if(startTime>nowtime){
+								this.descriptionShow=false;
+								continue;
+							}
+						}
+							
+						if(list[i].endTime){
+							var endTime=new Date(list[i].endTime).getTime()
+							if(endTime<nowtime){
+								this.descriptionShow=false;
+								continue;
+							}
+						}
+						if(this.descriptionShow&&list[i].model){
+							this.descriptionModel=list[i].model;
+							this.descriptionTitle=list[i].title;
+						}
+						
+						if(this.descriptionShow){
+							break;
+						}
 					}
 				}
 			}

+ 2 - 1
pages/index/index.vue

@@ -1,6 +1,7 @@
 <template>
 	<view>
-
+		<ujp-navbar title="包月卡购买" :show="false" ></ujp-navbar>
+		
 		<!-- 头部图片 -->
 		<view class="banner">
 			 <u-swiper  bg-color="#fff"