2021-08-19 06:40:59 +00:00
|
|
|
<template>
|
|
|
|
<view class="status-box statusHNH">
|
|
|
|
<view :style="{height:statusBarHeight+'px',background:backgroudColor}"></view>
|
|
|
|
<view class="status-nav" :style="{background:backgroudColor}">
|
|
|
|
<!-- 返回键 -->
|
2022-03-09 10:06:05 +00:00
|
|
|
<view @tap="backEvent" v-if="statusBack" style="height: 33rpx;width: 120rpx;flex-shrink: 0;position: absolute;">
|
2021-10-22 03:07:32 +00:00
|
|
|
<image v-if="backColor==0" class="tab-back" src="/static/public/backBlackm.png"></image>
|
|
|
|
<image v-if="backColor==1" class="tab-back" src="/static/public/videoBack.png"></image>
|
2021-08-22 08:53:12 +00:00
|
|
|
</view>
|
2021-08-19 06:40:59 +00:00
|
|
|
<!-- 标题 -->
|
|
|
|
<!-- <view v-if="statusTitle" :class="statusBack ? 'tcenter' : 'tleft'" class="tab-title" :style="{color:tabcolor}">{{titleVal}}</view> -->
|
|
|
|
<view v-if="statusTitle" class="tab-title tcenter" :style="{color:tabcolor}">{{titleVal}}</view>
|
|
|
|
<view v-else class="tab-title tcenter" :style="{color:tabcolor}"> </view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name:'status-nav',
|
|
|
|
props:{
|
|
|
|
statusTitle:{//是否显示标题
|
|
|
|
type:Boolean,
|
|
|
|
default:false
|
|
|
|
},
|
|
|
|
statusBack:{//是否显示返回键
|
|
|
|
type:Boolean,
|
|
|
|
default:true
|
|
|
|
},
|
|
|
|
backgroudColor:{//标题栏背景颜色
|
|
|
|
type:String,
|
|
|
|
default:'#FFFFFF'
|
|
|
|
},
|
|
|
|
tabcolor:{//标题颜色
|
|
|
|
type:String,
|
|
|
|
default:'#333333'
|
|
|
|
},
|
|
|
|
titleVal:{//标题内容
|
|
|
|
type:String,
|
2022-03-27 08:18:43 +00:00
|
|
|
default:''
|
2021-08-19 06:40:59 +00:00
|
|
|
},
|
|
|
|
whereCome:{//来自哪个页面
|
|
|
|
type:Number,
|
|
|
|
default:0
|
2021-10-22 03:07:32 +00:00
|
|
|
},
|
|
|
|
backColor:{//返回键颜色
|
|
|
|
type:Number,
|
|
|
|
default:0
|
2021-08-19 06:40:59 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
// 缓存状态栏+标题栏的高度
|
|
|
|
const query = wx.createSelectorQuery().in(this)
|
|
|
|
query.select('.statusHNH').boundingClientRect((rect) => {
|
|
|
|
// console.log('状态栏+标题栏:',rect.height);
|
2022-04-11 02:12:11 +00:00
|
|
|
uni.setStorageSync('statusHNH',rect.height);
|
|
|
|
this.$store.commit('updateHeightEv',rect.height)
|
2021-08-19 06:40:59 +00:00
|
|
|
}).exec()
|
2022-03-04 08:48:40 +00:00
|
|
|
|
|
|
|
// 转发进入:获取页面路径
|
|
|
|
let pages = getCurrentPages(); //获取加载的页面
|
|
|
|
let currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
|
|
|
// console.log(currentPage.route,'获取当前页面路径');
|
2022-03-07 08:40:15 +00:00
|
|
|
// console.log(currentPage.$page.fullPath,'获取当前页面完整路径带参数');
|
|
|
|
uni.setStorageSync('url',`/${currentPage.route}`);
|
|
|
|
uni.setStorageSync('paramsUrl',currentPage.$page.fullPath);
|
2022-04-11 02:12:11 +00:00
|
|
|
// console.log(uni.getStorageSync('paramsUrl'),66);
|
2022-03-07 08:40:15 +00:00
|
|
|
// console.log(uni.getStorageSync('url'),64);
|
2021-08-19 06:40:59 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,//获取手机状态栏高度
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
backEvent(){//返回事件
|
2022-03-09 10:06:05 +00:00
|
|
|
if(getApp().globalData.outside){
|
|
|
|
this.whereCome = 6;
|
2022-03-04 08:48:40 +00:00
|
|
|
}
|
|
|
|
switch (this.whereCome){
|
|
|
|
case 0:
|
|
|
|
uni.navigateBack({delta:1})
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 6:
|
|
|
|
uni.removeStorageSync('outside');
|
2021-08-26 01:50:19 +00:00
|
|
|
uni.reLaunch({
|
2021-08-19 06:40:59 +00:00
|
|
|
url:'/pages/tabbar/pagehome/pagehome'
|
|
|
|
})
|
2022-03-04 08:48:40 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-08-26 01:50:19 +00:00
|
|
|
uni.reLaunch({
|
2021-08-19 09:27:37 +00:00
|
|
|
url:'/pages/tabbar/my/my'
|
|
|
|
})
|
2022-03-04 08:48:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2021-08-19 06:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.status-box{position: fixed;top: 0;left: 0;right: 0;z-index: 10;}
|
|
|
|
.status-nav{width: 100%;position: relative;padding: 30rpx 0;display: flex;align-items: center;}
|
|
|
|
.tab-back{width: 33rpx;height: 33rpx;flex-shrink: 0;position: absolute;left: 20rpx;}
|
|
|
|
.tab-title{font-size: 36rpx;font-weight: bold;color: #333333;width: 100%;}
|
|
|
|
.tcenter{text-align: center;}
|
|
|
|
.tleft{margin-left: 40rpx;}
|
|
|
|
</style>
|