<template>
	<view class="content">
		<!-- <hCustom bgColor="#ccc" :isBack="true" is_status_bar="1">-->
		<!--            <view slot="backText">backText</view>-->
		<!--            <view slot="content">1</view>-->
		<!--        </hCustom>--> 
		<view class="home"  v-if="curr_tab_index == 0">
			<home></home>
			<view style="height: 192rpx;"></view>
		</view>
		<view class="mine" v-else-if="curr_tab_index == 2" style="width: 100%;">
			<mine ></mine>
			<view style="height: 192rpx;"></view>
		</view>
		
		<div class="bom  shadow-sm posi-fixed posi-fixed-bottom  w-100 " style="height: 192rpx;">
			<hBomTab :tab_list="tab_list" :curr_tab_index="curr_tab_index" @tabChange="tabChange"></hBomTab>
		</div>
	</view>
</template>

<script>
	import home from '../home/home.vue'
	import mine from '../mine/mine.vue'
	import hBomTab from '../../_components/hBomTab.vue'
	import hCustom from '../../_components/hCustom.vue'
	export default {
		components:{hBomTab,home,mine,hCustom},
		data() {
			return {
				curr_tab_index: 0,
				tab_list: [
					{icon: ['tab_hp_normal.png','tab_sy.png'],name: '首页', value: '1' },
					{icon: ['tab_add.png','tab_add.png'], value: '2'},
					{icon: ['tab_mine.png','tab_mine_selected.png'],name: '我的', value: '3'}
				],
				// tab_titles :[ //tab对应的标题配置
				// 	{front_color:'#fff',background_color:'#009FE8',title:'首页',},
				// 	{front_color:'#000000',background_color:'#ffffff',title:''},
				// 	{front_color:'#ffffff',background_color:'#1A7BFE',title:''}
				// ]
			}
		},
		onLoad() {
		},
		onShow() {
			// console.log(this.curr_tab_index)
		},
		methods: {
			checkLogin() {
				var token = uni.getStorageSync('token')
				// var token = "df057579-73c8-4bdd-8312-f64db8efd699"
				if (token == undefined || token == '') {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return false
				}
				return true
			},
			tabChange (val) {
				let index = val.index;
				
				// this.navGo(index)
				if(index== 2) {
					if (!this.checkLogin()) {
						return
					}
					uni.setNavigationBarTitle({
						title: "我的"
					})
					this.curr_tab_index = index;
				}else if(index== 0) {
					uni.setNavigationBarTitle({
						title: "首页"
					})
					this.curr_tab_index = index;
				}else{
					if (!this.checkLogin()) {
						return
					}
					uni.navigateTo({
						url:'/add/pages/addvacfrom/addpeople'
					})
				}
			},
		}
	}
</script>
<style  lang="scss">
	page {
		background:  #f2f2f2;
	}
</style>
<style scoped lang="scss">
	
	.content {
		display: flex;
		justify-content: center;
		.home{
			width: 100%;
			
		}
		.bom{
		       z-index: 1000;
		   }	
	}
	
	

</style>
