<template>
  <div ref="main" class="page-container">
    <back-box>
      <template slot="title">
        <span>{{ type == 1 ? '单卷测练报表' : type == 2 ? subjectName + "汇总报表" : type == 3 ? "多科汇总报表" :
          `多班_${subjectName}_${title}_测练成绩对比分析` }}</span>
      </template>
    </back-box>
    <Test v-if="type == 1" :role="role" :id="id" :classId="classId" :subjectName="subjectName" :title="title" />
    <MultipleTest v-else-if="type == 2" :role="role" :ids="ids" :classId="classId" :subjectName="subjectName" />
    <MultipleSubTest v-else-if="type == 3" :role="role" :ids="ids" :classId="classId" :subjectName="subjectName" />
    <Contrast v-else-if="type == 4" :role="role" :ids="ids" :subjectName="subjectName" :title="title" />
  </div>
</template>

<script>
import Test from "./components/test.vue"
import MultipleTest from "./components/multipleTest.vue"
import MultipleSubTest from "./components/multipleSubTest.vue"
import Contrast from "./components/contrast.vue"
export default {
  components: {
    Test,
    MultipleTest,
    MultipleSubTest,
    Contrast
  },
  data() {
    return {
      role: "",
      id: "",
      ids: [],
      type: 0,
      classId: "",
      subjectName: '',
      title: ''
    };
  },
  created() {
    this.role =
      this.$store.getters.info.showRole ||
      this.$store.getters.info.permissions[0].role;
    this.id = this.$route.query.id || "";
    this.ids = this.$route.query.ids && this.$route.query.ids.split() || "";
    this.type = this.$route.query.type
    this.classId = this.$route.query.classId || "";
    this.title = this.$route.query.title || ""
    this.subjectName = this.$route.query.subjectName || ""
  },
  methods: {

  }
};
</script>
<style lang="scss" scoped>
.page-container {
  position: relative;
  height: 100%;

  .table-box {
    min-height: 100%;
  }

  &.active {
    overflow: hidden;
  }


}

.error {
  color: #f30;
}

.page-content {
  padding: 20px 20px 0;
}


.down {
  padding-top: 20px;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
</style>