| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <template>
- <view class="top-nav-bg" :style="{'background-image':`url(${bgList[genre].bg_path})`}">
- <view class="header" style="z-index: 3;" :style="[{color},{height},{paddingTop},{justifyContent:justify}]">
- <view class="left" :style="[{color},{paddingTop}]" v-if="back" @click="onBack">
- <image class="back"
- src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/nav-back.png"></image>
- </view>
- <view class="title row center" :style="[{marginLeft:justify == 'left'?'30rpx':0},{fontSize}]">
- <!-- <image class="wh-36 m-r20"
- src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/statistics/stat-calendar.png"
- mode="aspectFill" v-if="is_icons">
- </image> -->
- <image class="wh-36 m-r20" src="/static/img/statistics/stat-calendar.png" mode="aspectFill"
- v-if="is_icons"></image>
- <text>{{title}}</text>
- </view>
- </view>
- <view :style="[{height:is_fixed? `${60+bgHeight}px`:`${60+fixedHeight}px`}]">
- <!-- {{fixedHeight}}{{bgHeight}} -->
- </view>
- <!-- 带背景插槽 start-->
- <slot></slot>
- <!-- 带背景插槽 end-->
- <view class="sys-list-background-color header" style="z-index: 2;"
- :style="[{height:is_fixed?`${navsHeight}px` :`${fixedHeight}px`},{opacity:is_fixed?navOpacity:1}]">
- <image class="" style="width: 100%;height: 100%;" :src="bgList[genre].nav_path" mode="">
- </image>
- </view>
- </view>
- </template>
- <script>
- // 获取系统状态栏的高度
- import tools from "@/service/tools";
- let systemInfo = uni.getSystemInfoSync();
- let menuButtonInfo = {};
- // // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
- // menuButtonInfo = uni.getMenuButtonBoundingClientRect();
- // // #endif
- export default {
- data() {
- return {
- height: 40,
- paddingTop: 0,
- navOpacity: 0,
- navHeight: 0,
- bgList: [{
- bg_path: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/index-bg.png?imageMogr2/quality/20',
- nav_path: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/top-nav.png'
- }, {
- bg_path: '',
- nav_path: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-nav-bg.png'
- }, {
- bg_path: '',
- nav_path: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-nav-bg.png'
- }, {
- bg_path: '',
- nav_path: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/statistics/statistics-bg2.png'
- }, {
- bg_path: '',
- nav_path: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/jb-bj.jpg'
- }],
- }
- },
- props: {
- genre: {
- type: Number,
- default: 0
- },
- type: {
- type: Number,
- default: 0
- },
- fontSize: {
- type: String,
- default: '32rpx'
- },
- title: {
- type: String,
- default: ''
- },
- justify: {
- type: String,
- default: 'center'
- },
- color: {
- type: String,
- default: '#333'
- },
- opacity: {
- type: Number,
- default: 0
- },
- back: {
- type: Boolean,
- default: true
- },
- toBack: {
- type: Boolean,
- default: true
- },
- is_fixed: {
- type: Boolean,
- default: false
- },
- is_filter: {
- type: Boolean,
- default: false
- },
- is_icons: {
- type: Boolean,
- default: false
- },
- fixedHeight: {
- type: Number,
- default: 0
- },
- bgHeight: {
- type: Number,
- default: 0
- },
- navsHeight: {
- type: Number,
- default: 0
- },
- },
- created() {
- // const navTop = uni.getMenuButtonBoundingClientRect()
- // this.height = navTop.height + 'px'
- // this.paddingTop = navTop.top + 'px'
- // this.navHeight = `${navTop.height+navTop.top}px`
- },
- watch: {
- opacity(newValue, oldValue) {
- this.navOpacity = newValue;
- }
- },
- methods: {
- // 左侧返回按钮调用
- onBack() {
- console.log('toBack:', this.toBack)
- if (this.toBack) {
- tools.leftClick()
- }
- this.$emit('onBack')
- },
- getTopBg(type) {
- switch (type) {
- case 0:
- return 'nav-bg1'
- case 0:
- return 'nav-bg1'
- case 0:
- return 'nav-bg1'
- default:
- break;
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .header {
- position: fixed;
- width: 100%;
- display: flex;
- align-items: center;
- font-size: 26rpx;
- z-index: 1;
- // padding-top: 15rpx;
- top: 0;
- .left {
- float: left;
- position: absolute;
- width: 100rpx;
- height: 42rpx;
- top: 60rpx;
- bottom: 0;
- left: 30rpx;
- color: #fff;
- margin: auto;
- .back {
- width: 25rpx;
- height: 32rpx;
- }
- }
- .title {
- font-size: 32rpx;
- font-weight: bold;
- font-family: Source Han Sans CN;
- padding-top: 60rpx;
- }
- }
- .top-nav-bg {
- background-repeat: no-repeat;
- background-size: 100% auto;
- z-index: 999999;
- }
- .nav-bg2 {
- background-image: url("https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/index-bg.png?imageMogr2/quality/20");
- }
- </style>
|