<template>
	<view>
		<home v-show="current==0"></home>
		<my v-show="current==1"></my>
		
		<u-tabbar v-model="current" :list="list" active-color="#2F4379" :before-switch="beforeSwitch" ></u-tabbar>
	</view>
</template>

<script>
	import home from "@/components/home.vue"
	import my from "@/components/my.vue"
	import {mapState,mapMutations} from 'vuex';
	export default {
		components: {
			home,my
		},
		data() {
			return {
				list: [{
						iconPath: "/static/nav1.png",
						selectedIconPath: "/static/nav1_on.png",
						text: '学习中心',
						customIcon: false,
					},
					{
						iconPath: "/static/nav4.png",
						selectedIconPath: "/static/nav4_on.png",
						text: '我的',
						customIcon: false,
					},
					
				],
				current:0

			}
		},
		onLoad(option) {
			
		},
		onShow(){
			
		},
		methods: {
			beforeSwitch(index) {
				let that = this
				if(index==this.current){
					return false
				}
				if(!this.$method.isLogin()){
					this.$navTo.togo('/pages/login/login');
					return false
				}else{
					return true
				}
				
			},
			
		},
		onReachBottom() {
			
		},
		onPullDownRefresh() {
		       
		},
		computed: {...mapState(['login'])}

	}
</script>

<style scoped>
	
</style>
