<template>
  <component ref="stage" :is="activeName" />
</template>

<script>
import Edit from './components/edit'
import Info from './components/info'
import Mine from './components/mine'
export default {
  components: { Edit, Info, Mine },
  data() {
    return {
      activeName: 'Mine',
      STAGEEXAMPAPER_ID: '',
      STAGESTUDENTRELATION_ID: ''
    }
  },
  beforeRouteLeave(to, from, next) {
    if (this.activeName == 'Edit') {
      if (!this.$refs.stage.isDisabled) {
        this.$confirm('阶段考试已开始，确定要退出考试么？', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          next()
        }).catch(() => {
        })
      } else {
        next()
      }
    } else {
      next()
    }
  }
}
</script>

<style scoped>

</style>
