<template>
  <div>
    <div class="modul1">
      <ul class="tap-btn">
        <li :class="showIndex === 1 ? 'active' : ''" @click="tap(1)">证书查询</li>
        <li :class="showIndex === 2 ? 'active' : ''" @click="tap(2)">名片查询</li>
        <li :class="showIndex === 3 ? 'active' : ''" @click="tap(3)">入学通知书</li>
      </ul>
    </div>
    <div class="tap-item-box" style="padding:40px 0">
      <app-cert v-if="showIndex === 1"></app-cert>
      <app-id-card v-if="showIndex === 2"></app-id-card>
      <app-admission-notice v-if="showIndex === 3"></app-admission-notice>
    </div>
  </div>
</template>

<script>
import AppCert from '@/pages/cert/index.vue'
import AppIdCard from '@/pages/card/index.vue'
import AppAdmissionNotice from './admissionNotice.vue'
export default {
  components: { AppCert, AppIdCard, AppAdmissionNotice },
  data() {
    return {
      showIndex: 1
    }
  },
  watch: {
    '$route.query': {
      immediate: true,
      handler(query) {
        if (query.index) {
          this.showIndex = parseInt(query.index) || 1
        }
      }
    }
  },
  methods: {
    tap(n) {
      this.showIndex = n
    }
  }
}
</script>
<style lang="scss" scoped>
.con970 {
  width: 970px;
  margin: 0 auto;
}
.modul1 {
  position: relative;
  width: 100%;
  height: 190px;
  background: url(https://zws-imgs-pub.ezijing.com/static/public/e5edeacd362ce7876f52c799f7e1a98d.png) center;
  background-size: cover;
  .tap-btn {
    width: 970px;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    li {
      width: 128px;
      height: 36px;
      background: rgba(76, 129, 196, 1);
      margin-right: 2px;
      font-size: 16px;
      line-height: 36px;
      text-align: center;
      color: #fff;
      cursor: pointer;
      &.active {
        color: rgba(76, 129, 196, 1);
        background: #fff;
      }
    }
  }
}
</style>
