<template>
  <div style="position: relative">
    <LinkTitlesCustom :currentPaths="['试卷检查', '试卷列表', '试卷详情']" />
    <div style="position: absolute;right: 10px;">
      <el-button
        type="primary"
        size="small"
        @click="back"
        style="padding-bottom:8px;"
        icon="el-icon-arrow-left"
        >返回</el-button
      >
    </div>
    <br />
    <div style="margin-left:50px;width: 95%;height: 80%" v-html="html"></div>
  </div>
</template>
<script>
import { mapState } from "vuex";
import { DATA_PROCESS_API } from "@/constants/constants";
import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
export default {
  data() {
    return {
      workId: "",
      examId: "",
      studentPaperId: "",
      examType: "",
      html: ""
    };
  },
  components: {
    LinkTitlesCustom
  },
  computed: {
    ...mapState({ user: state => state.user })
  },
  methods: {
    back() {
      this.$router.back();
    },
    getStudentPaper() {
      var url =
        DATA_PROCESS_API +
        "/studentPapers/check/" +
        this.studentPaperId +
        "/" +
        this.examType;
      this.$http.get(url).then(response => {
        console.log(response);
        this.html = response.data.studentSubjectiveHtml;
      });
    }
  },
  created() {
    this.workId = this.$route.params.workId;
    this.examId = this.$route.params.examId;
    this.studentPaperId = this.$route.params.studentPaperId;
    this.examType = this.$route.params.examType;
    this.getStudentPaper();
  }
};
</script>
