<template>
  <div class='m-container'>
    <h2>
      <!-- <div class='squrt'></div> -->
      <el-page-header @back="onCancel"
                      :content="name"></el-page-header>
      <!-- <div class="term">第一学期</div>
      <div class="term active">第二学期</div> -->
    </h2>
    <div class="m-core">
      <!-- <div class='newBand abs'
           @click='resetTeam'>乐团修改</div> -->

      <p class='msg'
         :class="status=='PROGRESS'? 'ing' : '' "> <img :src="status=='PROGRESS'?stepImgs.PROGRESS:stepImgs.PAUSE"
             alt="">
        {{ status=='PROGRESS'?'进行中':'已结束' }}</p>
      <!-- navMenu -->
      <el-tabs v-model.trim="activeIndex"
               type="card"
               @tab-click="handleClick">
        <el-tab-pane label="基本信息"
                     v-if="permission('/teamDetails/baseInfo')"
                     name="1">
          <baseinfo v-if="activeIndex == '1'"
                    :teamid='teamid' />
        </el-tab-pane>
        <el-tab-pane label="老师列表"
                     v-if="permission('/teamDetails/teacherList')"
                     name="2">
          <teacherList v-if="activeIndex == '2'"
                       :teamid='teamid' />
        </el-tab-pane>
        <el-tab-pane label="学员列表"
                     v-if="permission('/teamDetails/studentList')"
                     name="3">
          <studentList v-if="activeIndex == '3'"
                       :teamid='teamid' />
        </el-tab-pane>
        <el-tab-pane label="班级详情"
                     v-if="permission('/teamDetails/classList')"
                     name="4">
          <classList v-if="activeIndex == '4'"
                     :teamid='teamid' />
        </el-tab-pane>
        <el-tab-pane label="课表详情"
                     v-if="permission('/teamDetails/courseList')"
                     name="5">
          <courseList v-if="activeIndex == '5'"
                      :teamid='teamid' />
        </el-tab-pane>
        <!-- <el-tab-pane label="课程课酬"
                     name="6">
          <salaryList v-if="activeIndex == 6" />
        </el-tab-pane> -->
        <!-- <el-tab-pane label="课酬调整"
                     v-if="permission('/teamDetails/salaryList')"
                     name="7">
          <salaryList v-if="activeIndex == '7'"
                      :teamid='teamid' />
        </el-tab-pane> -->
      </el-tabs>

    </div>
  </div>
</template>
<script>
import studentList from '@/views/teamDetail/components/studentList'
import teacherList from '@/views/teamDetail/components/teacherList'
import courseList from '@/views/teamDetail/components/courseList'
import classList from '@/views/teamDetail/components/classList'
import salaryList from '@/views/teamDetail/components/salaryList'
import baseinfo from '@/views/teamDetail/components/baseInfo'
import { permission } from '@/utils/directivePage'
export default {
  name: 'teamDetail',
  data () {
    return {
      activeIndex: this.$route.query.checkIndex ? this.$route.query.checkIndex : '1',
      teamid: '',
      name: '',
      stepImgs: {
        PROGRESS: require('@/assets/images/base/ing.png'),
        PAUSE: require('@/assets/images/base/end.png')
      },
      status: '',
    }
  },
  mounted () {
    this.activeIndex = '1';
    this.init()
  },
  activated () {
    this.activeIndex = '1';
    this.init()

  },

  methods: {
    permission (str) {
      return permission(str)
    },
    init () {
      // let teamInfo = this.$route.query;
      this.status = this.$route.query.status;
      this.teamid = this.$route.query.id;
      this.name = this.$route.query.name;
      // 判断是否带缓存参数
    },
    handleClick (val) {
      this.activeIndex = val.name;

    },
    onCancel () {
      this.$router.push({ path: '/business/teamDetail'})
    },
    // getname (name) {
    //   this.name = name;
    //   localStorage.setItem('teamName', name);
    // },
    resetTeam () {
      // id  type
      this.$router.push({ path: '/business/teamBuild', query: { type: 'resetTeam', id: this.teamid } })
    }
  },
  components: {
    studentList,
    teacherList,
    courseList,
    classList,
    salaryList,
    baseinfo
  }
}
</script>
<style lang="scss" scoped>
.m-container {
  .m-core {
    .msg.ing {
      color: #14928a;
    }
    .msg {
      text-align: right;
      color: #777;
      font-size: 32px;
      font-weight: bold;
      position: absolute;
      right: 40px;
      top: -33px;
      img {
        width: 36px;
        height: 36px;
        position: relative;
        top: 5px;
        margin-right: 8px;
      }
    }
    .abs {
      position: absolute;
      right: 240px;
      top: -28px;
    }
  }
  .term {
    height: 32px;
    line-height: 32px;
    border-radius: 24px;
    width: 100px;
    color: #14928a;
    border: 1px solid rgba(20, 146, 138, 1);
    font-size: 14px;
    text-align: center;
    margin-right: 12px;
    &:nth-child(1) {
      margin-left: 47px;
    }
  }
  .term.active {
    color: #fff;
    background-color: #14928a;
  }
}
</style>
<style lang='scss'>
</style>
