|
@@ -1,16 +1,14 @@
|
|
<template name="headerNavbar">
|
|
<template name="headerNavbar">
|
|
- <!-- 二级楼层导航栏 -->
|
|
|
|
|
|
+ <!-- 自定义导航栏 -->
|
|
<view class='navbar-wrap' :style="{height:navbarHeight+'px',paddingTop:statusBarHeight+'px'}">
|
|
<view class='navbar-wrap' :style="{height:navbarHeight+'px',paddingTop:statusBarHeight+'px'}">
|
|
- <view class="navbar-icon" v-if="navbarData.showCapsule ? navbarData.showCapsule : true"
|
|
|
|
- :style="{top:navbarBtn.top + statusBarHeight+'px;',lineHeight:navbarBtn.height+'px;',left:navbarBtn.right+'px;',width:navbarBtn.height+'px;',height:navbarBtn.height+'px;'}">
|
|
|
|
- <text v-if='haveBack' @click="_goBack" class="iconfont icon-fanhui"></text>
|
|
|
|
- <text v-else @click="_goHome" class="iconfont icon-shouye"></text>
|
|
|
|
|
|
+ <view class="navbar-text" :style="{lineHeight:(navbarHeight - statusBarHeight)+'px;',fontSize:fontSizeSetting+'px;'}">
|
|
|
|
+ {{navbarData.title ? navbarData.title : " "}}
|
|
</view>
|
|
</view>
|
|
- <view class="navbar-text" :style="{top:navbarBtn.top + statusBarHeight+'px;',height:navbarBtn.height+'px;',fontSize:fontSizeSetting+'px;'}">
|
|
|
|
- <view class="gosearch-btn" :style="{paddingLeft:navbarBtn.height+'px;',right:(navbarBtn.width+20)+'px;',borderRadius:(navbarBtn.height/2)+'px;',width:(375-navbarBtn.width*2)+'px;',lineHeight:navbarBtn.height+'px;'}">
|
|
|
|
- <text class="iconfont icon-sousuo" :style="{width:navbarBtn.height+'px;',height:navbarBtn.height+'px;',lineHeight:navbarBtn.height+'px;'}"></text>
|
|
|
|
- <view class="input" @click="this.$api.navigateTo(clickPath)">搜索商品/供应商/项目仪器</view>
|
|
|
|
- </view>
|
|
|
|
|
|
+ <view class="navbar-icon" v-if="navbarData.showCapsule ? navbarData.showCapsule : true"
|
|
|
|
+ :style="{width:headerBtnPosi.width+'px;',lineHeight:(navbarBtn.height)+'px',top:navbarBtn.top + statusBarHeight+'px;',left:navbarBtn.right+'px;',height:(navbarBtn.height)+'px;'}">
|
|
|
|
+ <text v-if='navbarData.haveBack' @click="_goBack" class="iconfont icon-daohangfanhui" :style="{width:headerBtnPosi.width/2+'px',height:navbarBtn.height+'px'}"></text>
|
|
|
|
+ <text v-if='navbarData.haveBack' class="iconfont icon-vertical_line" :style="{borderColor:navbarData.borderColor ? navbarData.borderColor : 'rgba(0,0,0,0.4)'}"></text>
|
|
|
|
+ <text @click="_goHome" class="iconfont icon-fanhuishouye" :style="{width:headerBtnPosi.width/2+'px',height:navbarBtn.height+'px'}"></text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -29,24 +27,22 @@
|
|
headerBtnPosi:{
|
|
headerBtnPosi:{
|
|
type:Object
|
|
type:Object
|
|
},
|
|
},
|
|
- page:{
|
|
|
|
- type:Number,
|
|
|
|
- default:1
|
|
|
|
|
|
+ isBackType:{
|
|
|
|
+ type:Boolean,
|
|
|
|
+ default:false
|
|
},
|
|
},
|
|
- headerTitle:{
|
|
|
|
- type:String
|
|
|
|
|
|
+ page:{
|
|
|
|
+ type:Number
|
|
},
|
|
},
|
|
- type:{
|
|
|
|
|
|
+ path:{
|
|
type:String
|
|
type:String
|
|
- },
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return{
|
|
return{
|
|
- headerType:'',
|
|
|
|
- clickPath:'/search/pages/search/search',
|
|
|
|
- haveBack: true, // 是否有返回按钮,true 有 false 没有 若从分享页进入则为 false
|
|
|
|
|
|
+ // haveBack: true, // 是否有返回按钮,true 有 false 没有 若从分享页进入则为 false
|
|
statusBarHeight: 0, // 状态栏高度
|
|
statusBarHeight: 0, // 状态栏高度
|
|
- navbarHeight: 0, // 顶部导航栏高度,
|
|
|
|
|
|
+ navbarHeight: 0, // 顶部导航栏高度
|
|
navbarBtn: { // 胶囊位置信息
|
|
navbarBtn: { // 胶囊位置信息
|
|
height: 0,
|
|
height: 0,
|
|
width: 0,
|
|
width: 0,
|
|
@@ -55,11 +51,11 @@
|
|
right: 0
|
|
right: 0
|
|
},
|
|
},
|
|
platform:'',
|
|
platform:'',
|
|
- fontSizeSetting:0
|
|
|
|
|
|
+ fontSizeSetting:0,
|
|
|
|
+ screenWidth:0
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.headerType = this.type
|
|
|
|
this.fontSizeSetting = this.systeminfo.fontSizeSetting
|
|
this.fontSizeSetting = this.systeminfo.fontSizeSetting
|
|
let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
|
|
let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
|
|
let headerPosi = this.headerBtnPosi // 胶囊位置信息
|
|
let headerPosi = this.headerBtnPosi // 胶囊位置信息
|
|
@@ -82,7 +78,6 @@
|
|
// 屏幕宽度 - 胶囊right
|
|
// 屏幕宽度 - 胶囊right
|
|
right: this.systeminfo.screenWidth - headerPosi.right
|
|
right: this.systeminfo.screenWidth - headerPosi.right
|
|
}
|
|
}
|
|
- console.log(btnPosi)
|
|
|
|
let haveBack;
|
|
let haveBack;
|
|
if (getCurrentPages().length === 1) { // 当只有一个页面时
|
|
if (getCurrentPages().length === 1) { // 当只有一个页面时
|
|
haveBack = false;
|
|
haveBack = false;
|
|
@@ -92,9 +87,6 @@
|
|
this.haveBack=haveBack, // 获取是否是通过分享进入的小程序
|
|
this.haveBack=haveBack, // 获取是否是通过分享进入的小程序
|
|
this.statusBarHeight=statusBarHeight,
|
|
this.statusBarHeight=statusBarHeight,
|
|
this.navbarHeight= headerPosi.bottom + btnPosi.bottom, // 原胶囊bottom + 现胶囊bottom
|
|
this.navbarHeight= headerPosi.bottom + btnPosi.bottom, // 原胶囊bottom + 现胶囊bottom
|
|
- this.$parent.navbarHeight = this.navbarHeight
|
|
|
|
- this.$parent.statusBarHeight = this.statusBarHeight
|
|
|
|
- // console.log(this.navbarHeight);
|
|
|
|
this.navbarBtn=btnPosi
|
|
this.navbarBtn=btnPosi
|
|
},
|
|
},
|
|
onLoad(){
|
|
onLoad(){
|
|
@@ -102,13 +94,21 @@
|
|
},
|
|
},
|
|
methods:{
|
|
methods:{
|
|
_goBack: function () {
|
|
_goBack: function () {
|
|
- uni.navigateBack({
|
|
|
|
- delta: this.page
|
|
|
|
- });
|
|
|
|
|
|
+ let self = this;
|
|
|
|
+ if(this.isBackType){
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: self.path
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: this.page
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
_goHome: function () {
|
|
_goHome: function () {
|
|
- uni.switchTab({
|
|
|
|
- url: '/pages/tabBar/home/index'
|
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/index/index'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -123,80 +123,38 @@
|
|
position: fixed;
|
|
position: fixed;
|
|
width: 100%;
|
|
width: 100%;
|
|
top: 0;
|
|
top: 0;
|
|
- z-index: 100000;
|
|
|
|
- background-color: #FFFFFF;
|
|
|
|
|
|
+ z-index: 9999;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
|
+ background: #FFFFFF;
|
|
}
|
|
}
|
|
.navbar-text {
|
|
.navbar-text {
|
|
- width: 100%;
|
|
|
|
|
|
+ text-align: center;
|
|
color: #000000;
|
|
color: #000000;
|
|
font-weight: 500;
|
|
font-weight: 500;
|
|
- position: fixed;
|
|
|
|
- }
|
|
|
|
- .gosearch-btn{
|
|
|
|
- height: 100%;
|
|
|
|
- background: rgba(255, 255, 255, 0.6);
|
|
|
|
- font-size: 28rpx;
|
|
|
|
- color: #999999;
|
|
|
|
- position: relative;
|
|
|
|
- box-sizing: border-box;
|
|
|
|
- position:absolute ;
|
|
|
|
- top: 0;
|
|
|
|
- border: 0.5px solid rgba(0, 0, 0, 0.1);
|
|
|
|
- .icon-sousuo{
|
|
|
|
- height: 100%;
|
|
|
|
- text-align: center;
|
|
|
|
- display: block;
|
|
|
|
- position: absolute;
|
|
|
|
- left: 0;
|
|
|
|
- top: 0;
|
|
|
|
- font-size: 34rpx;
|
|
|
|
- color: #999999;
|
|
|
|
- z-index: 10;
|
|
|
|
- }
|
|
|
|
- .input{
|
|
|
|
- height: 100%;
|
|
|
|
- float: left;
|
|
|
|
- font-size: $font-size-24;
|
|
|
|
- text-align: left;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
.navbar-icon {
|
|
.navbar-icon {
|
|
position: fixed;
|
|
position: fixed;
|
|
display: flex;
|
|
display: flex;
|
|
- border-radius: 50%;
|
|
|
|
- text-align: center;
|
|
|
|
- background: rgba(255,255,255,0.6);
|
|
|
|
|
|
+ border-radius: 64rpx;
|
|
|
|
+ border: 0.5px solid rgba(0,0,0, 0.2);
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
- z-index: 9999;
|
|
|
|
}
|
|
}
|
|
.navbar-icon .iconfont {
|
|
.navbar-icon .iconfont {
|
|
- height: 100%;
|
|
|
|
- width: 100%;
|
|
|
|
- font-size: 38rpx;
|
|
|
|
- font-weight: bold;
|
|
|
|
|
|
+ text-align: center;
|
|
display: inline-block;
|
|
display: inline-block;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
|
+ margin-bottom: 1px;
|
|
|
|
+ &.icon-fanhuishouye {
|
|
|
|
+ font-size: 38rpx;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- .navbar-icon view {
|
|
|
|
- height: 18px;
|
|
|
|
- border-left: 0.5px solid rgba(0,0,0, 0.3);
|
|
|
|
- margin-top: 6px;
|
|
|
|
|
|
+ .navbar-icon .icon-vertical_line {
|
|
|
|
+ color: #999999;
|
|
}
|
|
}
|
|
.navbar-loading {
|
|
.navbar-loading {
|
|
background: #fff;
|
|
background: #fff;
|
|
text-align: center;
|
|
text-align: center;
|
|
}
|
|
}
|
|
- @keyframes showColor {
|
|
|
|
- 0% {background: rgba(255,255,255,0);}
|
|
|
|
- 50% {background: rgba(255,255,255,0.5);}
|
|
|
|
- 100% {background: rgba(255,255,255,1);}
|
|
|
|
- }
|
|
|
|
- @keyframes hideColor {
|
|
|
|
- 0% {background: rgba(255,255,255,1);}
|
|
|
|
- 50% {background: rgba(255,255,255,0.5);}
|
|
|
|
- 100% {background: rgba(255,255,255,0);}
|
|
|
|
- }
|
|
|
|
</style>
|
|
</style>
|
|
|
|
|
|
|
|
|