<template>
	<view class="flex-container"   :style="'height:'+h+'px'"  >
		<view class="es-fix-top" :style="(bg?'background: inherit;':'')+'background:'+top_color" >
			<es-top></es-top>
			<es-nav-title-base :title="title" :left="left" :right="right"></es-nav-title-base>
		</view>
	</view>
</template>

<script>
	export default {
		name:"es-nav-bg-black",
		data() {
			return {
				top_color: '#FFFFFF',
				h:44,
			};
		},
		props: [
			'title', 'bg', 'left', 'mode','right','rightCon'
		],
		created: function() {
		     let data = getApp().globalData;
		     if(data.__czy_h)
		     {
		     	this.h = data.__czy_h;
		     }else{
		     	uni.getSystemInfo({
		     		success: (res) => {
		     			let top = res.safeArea.top;
		     			data.__czy_h = this.h = top+44;
		     		}
		     	});
		     }
		},
		methods: {
			close: function() {
				const pages = getCurrentPages();
				const currentPageIndex = pages.length - 1; // 当前页面的索引
				const targetPageIndex = 1; // 假设要返回到首页（页面 A）
				// 计算需要返回的层数
				const delta = currentPageIndex - targetPageIndex;
				uni.navigateBack({
					delta: delta,
					animationType: 'pop-out',
					animationDuration: 200
				});
			},
			// scrollBody:function(e){
			// 	let top = e.scrollTop / this.h;
			// 	this.top_color = 'rgba(255,92,3, ' + top + ')';
			// }
		}
			
	}
</script>



<style>
	.flex-container {
	   display: flex;
	   flex-direction: column;
	   min-height: 88rpx;
	}
	.es-fix-top {
		background-size: 100% auto;
		background-repeat: no-repeat;
	}

	.es-h-88 {
		height: 44px;
	}

	.es-fix-top {
		font-weight: 620;
		font-family: PingFang SC;
		color: white;
	}

	.top-img {
		width: 100%;
		height: 500rpx;
		position: absolute;
	}

	.top-close {
		left: 30rpx;
		position: absolute;
		bottom: 0rpx;
		width: 100rpx;
		height: 80rpx;
	}
	
	.navTitle{
		left: calc(50% - 80rpx);
		top:10rpx;
		position: absolute;
		width: 80rpx;
		height: 70rpx;
		line-height: 70rpx;
		color: #fff;
		font-size: 30rpx;
		font-weight: 500;
	}
</style>