<template>
  <div class='m-container'>
    <h2>
      <div class="squrt"></div> 内容管理
    </h2>
    <div class="m-core">
      <tab-router v-model.trim="activeName"
               type="card"
               @tab-click="handleClick">
        <el-tab-pane label="精彩活动"
                     v-if="permissionList.activity"
                     lazy
                     name="0">
          <activity v-if="activeName == 0" />
        </el-tab-pane>
        <el-tab-pane label="热门资讯"
                     v-if="permissionList.information"
                     lazy
                     name="1">
          <information v-if="activeName == 1" />
        </el-tab-pane>
        <!-- <el-tab-pane label="专项训练"
                     v-if="permissionList.training"
                     lazy
                     name="2">
          <training v-if="activeName == 2" />
        </el-tab-pane> -->
        <el-tab-pane label="闪页管理"
                     v-if="permissionList.flashPage"
                     lazy
                     name="3">
          <flashPage v-if="activeName == 3" />
        </el-tab-pane>
        <el-tab-pane label="BANNER管理"
                     v-if="permissionList.banner"
                     lazy
                     name="4">
          <banner  v-if="activeName == 4" />
        </el-tab-pane>
        <!-- <el-tab-pane label="APP按钮管理"
                     v-if="permissionList.appPage"
                     lazy
                     name="5">
          <appPage v-if="activeName == 5" />
        </el-tab-pane>
         -->
         <el-tab-pane label="知识库管理"
                     v-if="permissionList.knowledge"
                     lazy
                     name="6">
          <knowledge  v-if="activeName == 6" />
        </el-tab-pane>
        <el-tab-pane label="广告管理"
                     v-if="permissionList.advert"
                     lazy
                     name="7">
          <advert v-if="activeName == 7" />
        </el-tab-pane>
        <el-tab-pane label="系统通知"
                     v-if="permissionList.systemNotify"
                     lazy
                     name="8">
          <systemNotify v-if="activeName == 8" />
        </el-tab-pane>
      </tab-router>
    </div>
  </div>
</template>
<script>
import banner from './components/banner'
import activity from './components/activity'
import information from './components/information'
import training from './components/training'
import flashPage from './components/flashPage'
import appPage from './components/appPage'
import knowledge from './components/knowledge'
import advert from './components/advert'
import systemNotify from './components/systemNotify'
import { permission } from '@/utils/directivePage'
// 精彩活动 1 0
// 热门资讯 2 1
// 专项训练 4 2
// 闪页管理 5  3
// BANNER管理 3 4
// APP按钮管理 6 5
// 知识库管理 7 6
// 广告管理 8 7
// 系统通知 19 8
export default {
  components: { banner, activity, information, training, flashPage, appPage, knowledge, advert, systemNotify },
  name: 'contentManager',
  data () {
    return {
      activeName: "0",
      permissionList: {
        banner: permission('/contentManager/banner'),
        activity: permission('/contentManager/activity'),
        information: permission('/contentManager/information'),
        training: permission('/contentManager/training'),
        flashPage: permission('/contentManager/flashPage'),
        appPage: permission('/contentManager/appPage'),
        knowledge: permission('/contentManager/knowledge'),
        advert: permission('/contentManager/advert'),
        systemNotify: permission('/contentManager/systemNotify'),
      }
    }
  },
  methods: {
    handleClick (val, event) {
      this.activeName = val.name
    }
  }
}
</script>
<style lang="scss">
</style>
