123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <div v-if="exam && examQuestion()" class="container">
- <div class="header">
- <RemainTime></RemainTime>
- <OverallProgress :exam-question-list="validQuestions"></OverallProgress>
- <QuestionFilters :exam-question-list="validQuestions"></QuestionFilters>
- <Button class="qm-primary-button" @click="submitPaper">交卷</Button>
- </div>
- <div class="main">
- <QuestionView :exam-question="examQuestion()"></QuestionView>
- <ArrowNavView :previous-exam-question="preExamQuestion" :next-exam-question="nextExamQuestion"></ArrowNavView>
- </div>
- <div class="side">
- <div class="question-nav">
- <QuestionNavView :paperStruct="paperStruct" :validQuestions="validQuestions" />
- </div>
- <div class="camera">
- <!-- <FaceRecognition width="100%" height="100%" :showRecognizeButton="false" /> -->
- </div>
- </div>
- </div>
- </template>
- <script>
- import RemainTime from "./RemainTime.vue";
- import OverallProgress from "./OverallProgress.vue";
- import QuestionFilters from "./QuestionFilters.vue";
- import QuestionView from "./QuestionView.vue";
- import ArrowNavView from "./ArrowNavView.vue";
- import QuestionNavView from "./QuestionNavView.vue";
- import FaceRecognition from "../../../components/FaceRecognition/FaceRecognition";
- import { createNamespacedHelpers } from "vuex";
- const { mapState, mapMutations, mapGetters } = createNamespacedHelpers(
- "examingHomeModule"
- );
- export default {
- name: "ExamingHome",
- created() {
- this.initData();
- if (!this.$route.query.order) {
- // created can access this.$route?
- this.$router.push(this.$route.fullPath + "&order=" + 4);
- return;
- }
- },
- // beforeRouteUpdate(to, from, next) {
- // this.updateQuestion(next);
- // },
- methods: {
- ...mapMutations(["updateExamState"]),
- async initData() {
- const exam = await this.$http.get(
- "/api/ecs_exam_work/exam/" + this.$route.params.examId
- );
- const paperStruct = await this.$http.get(
- "/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=" +
- this.$route.query.examRecordId
- );
- const examQuestionList = await this.$http.get(
- "/api/ecs_oe_student/examQuestion/findExamQuestionList?examRecordDataId=" +
- this.$route.query.examRecordId
- );
- this.updateExamState({
- exam: exam.data,
- paperStruct: paperStruct.data,
- examQuestionList: examQuestionList.data
- });
- },
- updateQuestion: async function(next) {
- // 初始化套题的答案,为回填部分选项做准备
- // for (let q of this.examQuestionList) {
- // if (q.subQuestionList.length > 0) {
- // q.stuAnswer = [];
- // for (let sq of q.subQuestionList) {
- // q.stuAnswer.push(sq.stuAnswer);
- // }
- // }
- // }
- next && next();
- if (!this.exam) return;
- // this.examQuestion = this.examQuestionList.find(
- // eq => eq.id == this.$route.query.examQuestionId // number == string
- // );
- // this.preExamQuestion = this.validQuestions[this.examQuestion.orders - 2];
- // this.nextExamQuestion = this.validQuestions[this.examQuestion.orders];
- },
- async submitPaper() {
- //FIXME: submit precondition
- await this.$http.get("/api/exam_control/submit");
- this.$router.push("/");
- },
- examQuestion() {
- return (
- this.examQuestionList &&
- this.examQuestionList.find(
- eq => eq.order == this.$route.query.order // number == string
- )
- );
- }
- },
- computed: {
- ...mapState(["exam", "paperStruct", "examQuestionList"]),
- ...mapGetters(["validQuestions"]),
- preExamQuestion: vm =>
- vm.examQuestion && vm.validQuestions[vm.examQuestion.orders - 2],
- nextExamQuestion: vm =>
- vm.examQuestion && vm.validQuestions[vm.examQuestion.orders]
- },
- watch: {
- $route: function() {
- this.examQuestion();
- }
- },
- components: {
- RemainTime,
- OverallProgress,
- QuestionFilters,
- QuestionView,
- ArrowNavView,
- QuestionNavView,
- FaceRecognition
- }
- };
- </script>
- <style scoped>
- .container {
- display: grid;
- grid-template-areas:
- "header header"
- "main side";
- grid-template-rows: 80px 1fr;
- grid-template-columns: 1fr 400px;
- height: 100vh;
- width: 100vw;
- }
- .header {
- display: grid;
- place-items: center;
- grid-template-columns: 200px 1fr 300px 100px;
- grid-area: header;
- height: 80px;
- background-color: #f5f5f5;
- }
- .main {
- display: grid;
- grid-area: main;
- grid-template-rows: 1fr 50px;
- }
- .side {
- display: grid;
- grid-area: side;
- grid-template-rows: 1fr 300px;
- background-color: #f5f5f5;
- }
- .camera {
- align-self: flex-end;
- justify-self: flex-end;
- }
- @media screen and (max-height: 768px) {
- .container {
- grid-template-rows: 50px 1fr;
- }
- .header {
- height: 50px;
- }
- .side {
- grid-template-rows: 1fr 200px;
- }
- }
- </style>
|