<template>
  <div class='m-container'>
    <h2> 内容管理 </h2>
    <div class="m-core">
      <el-tabs v-model="activeName"
               type="card"
               @tab-click="handleClick">
        <el-tab-pane label="BANNER管理"
                     name="0">
          <banner v-if="activeStatus[0]" />
        </el-tab-pane>
        <el-tab-pane label="精彩活动"
                     name="1">
          <activity v-if="activeStatus[1]" />
        </el-tab-pane>
        <el-tab-pane label="热门咨询"
                     name="2">
          <information v-if="activeStatus[2]" />
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>
<script>
import banner from './components/banner'
import activity from './components/activity'
import information from './components/information'
export default {
  components: { banner, activity, information },
  name: 'teacherDetail',
  data () {
    return {
      activeName: "0",
      activeStatus: [true, false, false]
    }
  },
  created() {
    let type = this.$route.query.type
    if(type != null) {
      console.log(type)
      this.activeName = type.toString()
      this.activeStatus[type] = true
    }
  },
  methods: {
    handleClick (val, event) {
      this.activeName = val.name
      this.activeStatus[val.name] = true
    }
  }
}
</script>
<style lang="scss">
</style>