<template>
  <div class="app-container">
    <div class="layout-content">
      <keep-alive v-if="$route.meta.keepAlive">
        <router-view></router-view>
      </keep-alive>
      <router-view v-else></router-view>
    </div>
    <div class="layout-footer" v-if="true">
      <TabBar :data="tabbars" @change="handleChange" />
    </div>
  </div>
</template>

<script>
import TabBar from '@/components/TabBar'
import { mapGetters } from 'vuex'
export default {
  name: 'AppLayout',
  data() {
    return {
      tabbars: [
        {
          title: '学习中心',
          to: {
            path: '/home'
          },
          icon: 'home-o'
        }
      ],
			orgArray:["45facc0a-1211-11ec-80ad-005056b86db5","414f2361-ad04-11ed-b13d-005056b86db5"]
    }
  },
  components: {
    TabBar
  },
  computed: {
    ...mapGetters(['userinfo'])
  },
  methods: {
    handleChange(v) {
      console.log('tab value:', v)
    }
  },
  mounted() {
    if (this.userinfo.type == 1) {
      this.tabbars.push(
        {
          title: '学生评价',
          to: {
            path: '/eva'
          },
          activeIcon: require('../../assets/images/course/commmt-active1.png'),
          normalIcon: require('../../assets/images/course/comment1.png')
        },
        {
          title: '教师中心',
          to: {
            path: '/test'
          },
          activeIcon: require('../../assets/images/course/commmt-active1.png'),
          normalIcon: require('../../assets/images/course/comment1.png')
        },

      )
			// if(this.orgArray.includes(this.$store.state.user.userinfo.organizeid)){
			// 	this.tabbars.push(        {
      //     title: '课堂观察',
      //     to: {
      //       path: '/classObserve'
      //     },
      //     activeIcon: require('../../assets/images/course/commmt-active1.png'),
      //     normalIcon: require('../../assets/images/course/comment1.png')
      //   })
			// }
    }
  }
}
</script>
<style lang="scss" scoped>
.app-container {
  height: 100vh;
  .layout-content {
    height: calc(100% - 50px);
    // height: calc(100%);
  }
  .layout-footer {
    display: block;
    height: 50px;
  }
}
</style>
