2022-02-12 11:33:47 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view class="status-box statusHNH">
|
|
|
|
|
<!-- 网络、电量栏 start -->
|
2022-02-13 13:38:30 +00:00
|
|
|
|
<view :style="{height: statusBarHeight+'px',background: backgroudColor}"></view>
|
2022-02-12 11:33:47 +00:00
|
|
|
|
<!-- 网络、电量栏 end -->
|
2022-02-13 13:38:30 +00:00
|
|
|
|
|
2022-02-12 11:33:47 +00:00
|
|
|
|
<!-- 头部状态栏 start -->
|
2022-02-13 13:38:30 +00:00
|
|
|
|
<view class="status-nav"
|
2022-02-14 11:45:52 +00:00
|
|
|
|
:style="{background: backgroudColor,height: navBarHeight+'px'}">
|
2022-02-12 11:33:47 +00:00
|
|
|
|
<!-- 返回键 -->
|
2022-02-13 13:38:30 +00:00
|
|
|
|
<view class="return-box" @tap="backEv" v-if="ifReturn"
|
2022-02-14 11:45:52 +00:00
|
|
|
|
:style="{height: navBarHeight+'px'}">
|
2022-02-25 09:24:06 +00:00
|
|
|
|
<i class="icon icon-return" style="font-size: 40rpx;"
|
2022-02-13 13:38:30 +00:00
|
|
|
|
:style="{color: returnColor}"></i>
|
2022-02-12 11:33:47 +00:00
|
|
|
|
</view>
|
|
|
|
|
<!-- 标题 -->
|
2022-02-14 11:45:52 +00:00
|
|
|
|
<view class="tab-title" v-if="ifTitle"
|
2022-02-13 13:38:30 +00:00
|
|
|
|
:style="{
|
|
|
|
|
color: titleColor,
|
2022-02-14 11:45:52 +00:00
|
|
|
|
justifyContent: ifCenter ? 'center' : '',
|
|
|
|
|
padding: ifCenter ? '0px' : `${ifReturn ? '0 38' : '0 15'}px`}">
|
2022-02-24 03:21:51 +00:00
|
|
|
|
<view class="title-box" :class="['','clips1','clips2'][clipNumber]" :style="{maxWidth: ifCenter ? '360rpx' : '70%'}">{{navBarTitle}}</view>
|
2022-02-13 13:38:30 +00:00
|
|
|
|
</view>
|
2022-02-12 11:33:47 +00:00
|
|
|
|
</view>
|
|
|
|
|
<!-- 头部状态栏 end -->
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name:'status-nav',
|
|
|
|
|
props:{
|
2022-02-13 13:38:30 +00:00
|
|
|
|
//状态栏、导航栏背景颜色
|
|
|
|
|
backgroudColor:{
|
|
|
|
|
type:String,
|
|
|
|
|
default:'#FFFFFF'
|
|
|
|
|
},
|
|
|
|
|
// 默认导航栏高度
|
|
|
|
|
navBarHeight: {
|
|
|
|
|
type:Number,
|
2022-02-14 11:45:52 +00:00
|
|
|
|
default:50
|
2022-02-13 13:38:30 +00:00
|
|
|
|
},
|
|
|
|
|
//是否显示返回键
|
|
|
|
|
ifReturn:{
|
2022-02-12 11:33:47 +00:00
|
|
|
|
type:Boolean,
|
|
|
|
|
default:true
|
|
|
|
|
},
|
2022-02-13 13:38:30 +00:00
|
|
|
|
// 返回键颜色
|
|
|
|
|
returnColor: {
|
|
|
|
|
type:String,
|
|
|
|
|
default:'#000'
|
|
|
|
|
},
|
|
|
|
|
//是否显示标题
|
|
|
|
|
ifTitle:{
|
|
|
|
|
type:Boolean,
|
2022-02-14 11:45:52 +00:00
|
|
|
|
default:true
|
2022-02-13 13:38:30 +00:00
|
|
|
|
},
|
|
|
|
|
// 导航栏标题
|
|
|
|
|
navBarTitle: {
|
|
|
|
|
type:String,
|
|
|
|
|
default:'佩丽商城'
|
|
|
|
|
},
|
|
|
|
|
// 标题最多几行显示
|
|
|
|
|
clipNumber: {
|
|
|
|
|
type:Number,
|
|
|
|
|
default:1
|
|
|
|
|
},
|
|
|
|
|
//标题颜色
|
|
|
|
|
titleColor:{
|
2022-02-12 11:33:47 +00:00
|
|
|
|
type:String,
|
|
|
|
|
default:'#333333'
|
|
|
|
|
},
|
2022-02-13 13:38:30 +00:00
|
|
|
|
// 标题是否居中
|
|
|
|
|
ifCenter: {
|
|
|
|
|
type:Boolean,
|
2022-02-14 11:45:52 +00:00
|
|
|
|
default: true
|
2022-02-18 08:26:42 +00:00
|
|
|
|
},
|
|
|
|
|
// 来自哪里
|
|
|
|
|
fromWhere: {
|
|
|
|
|
type:Number,
|
|
|
|
|
default:0
|
2022-02-12 11:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-02-13 13:38:30 +00:00
|
|
|
|
data(){
|
|
|
|
|
return {
|
|
|
|
|
statusBarHeight: uni.getStorageSync('statusBar'),
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-02-12 11:33:47 +00:00
|
|
|
|
mounted() {
|
|
|
|
|
// 缓存状态栏+标题栏的高度
|
2022-02-18 08:26:42 +00:00
|
|
|
|
// const query = wx.createSelectorQuery().in(this)
|
|
|
|
|
// query.select('.statusHNH').boundingClientRect((rect) => {
|
|
|
|
|
// uni.setStorageSync('statusHNH',rect.height)
|
|
|
|
|
// }).exec();
|
2022-02-13 13:38:30 +00:00
|
|
|
|
|
|
|
|
|
// 获取当前页面路径
|
|
|
|
|
let pages = getCurrentPages();
|
|
|
|
|
let route = pages[pages.length - 1].route;
|
2022-02-25 09:24:06 +00:00
|
|
|
|
uni.setStorageSync('url',`/${route}?invite_code=${uni.getStorageSync('invite_code')}`);
|
2022-02-13 13:38:30 +00:00
|
|
|
|
this.log(route,'status-nav组件打印:当前页面路径')
|
2022-02-12 11:33:47 +00:00
|
|
|
|
},
|
|
|
|
|
methods:{
|
2022-02-13 13:38:30 +00:00
|
|
|
|
//返回事件
|
|
|
|
|
backEv(){
|
2022-02-25 09:35:07 +00:00
|
|
|
|
if(uni.getStorageSync('outside')*1==2){
|
|
|
|
|
this.fromWhere = uni.getStorageSync('outside')*1;
|
|
|
|
|
}
|
2022-02-18 08:26:42 +00:00
|
|
|
|
switch (this.fromWhere){
|
|
|
|
|
case 1:
|
2022-02-25 09:24:06 +00:00
|
|
|
|
case 2:
|
2022-02-18 08:26:42 +00:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:'/pages/tabbar/pagehome/pagehome'
|
|
|
|
|
})
|
2022-02-25 09:24:06 +00:00
|
|
|
|
uni.setStorageSync('outside',0)
|
2022-02-18 08:26:42 +00:00
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
delta:1
|
|
|
|
|
})
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-02-12 11:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2022-02-13 13:38:30 +00:00
|
|
|
|
.clips1{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|
|
|
|
|
.clips2{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|
|
|
|
|
|
|
|
|
|
.status-box{
|
|
|
|
|
position: fixed;top: 0;left: 0;right: 0;z-index: 10;
|
|
|
|
|
}
|
|
|
|
|
.status-nav{
|
|
|
|
|
width: 100%;
|
|
|
|
|
position: relative;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.return-box {
|
|
|
|
|
display: flex;justify-content: center;align-items: center;flex-shrink: 0;
|
|
|
|
|
position: absolute;
|
|
|
|
|
padding: 0rpx 10rpx;
|
|
|
|
|
}
|
|
|
|
|
.return-box i {font-size: 56rpx;}
|
|
|
|
|
.tab-title{
|
|
|
|
|
width: 100%;
|
2022-02-25 09:24:06 +00:00
|
|
|
|
font-size: 38rpx;
|
2022-02-14 11:45:52 +00:00
|
|
|
|
display: flex;
|
2022-02-13 13:38:30 +00:00
|
|
|
|
}
|
2022-02-24 03:21:51 +00:00
|
|
|
|
.tab-title .title-box{margin-top: -4rpx;}
|
2022-02-12 11:33:47 +00:00
|
|
|
|
</style>
|