<template>
  <div class="study-enter">
    <div class="content-list">
      <div class="search-box" v-show="!showDetail">
        <div class="search-item" :class="active === item.key ? 'active' : ''" v-for="(item, index) in tabList"
          :key="index" @click="changeTab(item)">
          {{ item.name }}
        </div>
      </div>

      <div class="content-box">
        <ytbd v-if="active === 'ytbd'" :study="study" @showDetail="showDetailCallback" />
        <tbbd v-if="active === 'tbbd'" :study="study" @showDetail="showDetailCallback"/>
        <sqbd v-if="active === 'sqbd'" :study="study" @showDetail="showDetailCallback"/>
        <syxx v-if="active === 'syxx'" :study="study" @showDetail="showDetailCallback"/>
        <syff v-if="active === 'syff'" :study="study" @showDetail="showDetailCallback"/>
      </div>
    </div>
  </div>
</template>

<script>
import ytbd from './ytbd.vue'
import tbbd from './tbbd.vue'
import sqbd from './sqbd.vue'
import syxx from './syxx.vue'
import syff from './syff.vue'
export default {
  name: 'StudyEnter',
  props: {},
  components: { ytbd, tbbd ,syxx,sqbd,syff},
  computed: {},
  filters: {},
  data() {
    return {
      showDetail: false,
      tabList: [
        { key: 'ytbd', name: this.$t('page.business.study.studyEnter.ytbdlb') },
        { key: 'tbbd', name: this.$t('page.business.study.studyEnter.tbbdlb') },
        { key: 'sqbd', name: this.$t('page.business.study.studyEnter.sqbdlb') },
        { key: 'syxx', name: this.$t('page.business.study.studyEnter.syxx') },
        { key: 'wzlb', name: this.$t('page.business.study.studyEnter.wzlb') },
        { key: 'syff', name: this.$t('page.business.study.studyEnter.syfflb') },
        { key: 'syj', name: this.$t('page.business.study.studyEnter.syjsygl') }
      ],
      active: 'ytbd',

      study: {},
    }
  },
  created() { },
  methods: {
    show(row) {
      this.study = row
    },
    showDetailCallback(val) {
      this.showDetail = val
    },
    changeTab(item) {
      if (this.active !== item.key) {
        this.active = item.key
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.study-enter {
  .search-box {
    background: #fff;
    padding: 0;
    border-radius: 3px;
    margin-bottom: 10px;

    display: flex;
    flex-direction: row;
    align-items: center;

    .search-item {
      padding: 10px 20px;
      font-size: 14px;
      cursor: pointer;

      &.active {
        background: #1890ff;
        color: #fff;
      }

      &:hover {
        background: #46a6ff;
        color: #fff;
      }

      &:first-child {
        border-top-left-radius: 3px;
        border-bottom-left-radius: 3px;
      }

      &:last-child {
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
      }
    }
  }

  .content-box {}
}
</style>
