<template>
  <div class="fx-column">
    <evaluation-title :title="testTypeOptions.title+'报告'" nav-back-button></evaluation-title>
    <test-report v-if="latestTestResult" :category="prevData.category" :source="latestTestResult"></test-report>
  </div>
</template>

<script>
import TestReport from '@/views/elective/test/components/test-report'
import TransferMixin from '@/components/mx-transfer-mixin'
import MxPaperNavigator from '@/components/MxPaper/mx-paper-navigator'
import config from '@/common/mx-config'
import { getTestMajorResult } from '@/api/webApi/test-major'

export default {
  mixins: [TransferMixin],
  name: 'elective-report',
  components: { MxPaperNavigator, TestReport },
  data() {
    return {
      latestTestResult: null
    }
  },
  computed: {
    testTypeOptions() {
      return config.roundSelectTestEntryOptions[this.prevData.category] || {}
    }
  },
  mounted() {
    this.loadTestResult()
  },
  methods: {
    loadTestResult() {
      getTestMajorResult(this.prevData).then(res => this.latestTestResult = res.data)
    }
  }
}
</script>

<style scoped>

</style>
