fuliqi
2024-06-28 632e609a88161923c64170cbd0c41437eeca5af5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
  <div class="paper-container">
    <div class="paper-card">
      <el-card style="height: 100vh">
        <el-row style="text-align: left; margin-bottom : 20px; font-size: 20px">语文考试</el-row>
        <el-row>
          <el-col class="info">
            <span class="exam-info">学员姓名:</span>
            <span class="exam-info">{{ form.userName }}</span>
          </el-col>
        </el-row>
        <el-row>
          <el-col class="info">
            <span class="exam-info">交卷时间:</span>
            <span class="exam-info">{{ form.updateTime }}</span>
          </el-col>
        </el-row>
        <el-row>
          <el-col class="info">
            <span class="exam-info">完成耗时:</span>
            <span class="exam-info">{{ form.doTime }}</span>
          </el-col>
        </el-row>
        <el-row>
          <el-col class="info">
            <span class="exam-info">得分:</span>
            <span class="exam-info">{{ form.score + ' / ' + form.totalScore }}</span>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row class="do-exam-title">
          <el-col :span="24">
                <span :key="item.itemOrder" v-for="item in form.answers">
                    <el-tag :type="questionDoRightTag(item.right)" class="do-exam-title-tag"
                            @click="goAnchor('#question-' + item.itemOrder)">{{ item.itemOrder }}</el-tag>
                </span>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <div style="text-align: center">
          <el-button type="primary" style="width: 120px;height: 35px" @click="submit">提交批改</el-button>
        </div>
      </el-card>
    </div>
    <div class="paper-form">
      <el-form :model="form" ref="form" v-loading="formLoading" label-width="100px">
        <el-row :key="index" v-for="(titleItem, index) in form.titleItems">
          <h3>{{ titleItem.name }}</h3>
          <el-card class="exampaper-item-box" v-if="titleItem.questionList.length !== 0">
            <el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder + '.'"
                          v-for="questionItem in titleItem.questionList" class="exam-question-item"
                          label-width="50px" :id="'question-' + questionItem.itemOrder">
              <MarkPaperShow :qType="questionItem.questionType" :question="questionItem"/>
            </el-form-item>
          </el-card>
        </el-row>
      </el-form>
    </div>
  </div>
</template>
 
<script>
import { getStudentExam } from '@/api/exam'
import MarkPaperShow from '@/views/exam/exam/components/MarkPaperShow'
import { mapGetters, mapState } from 'vuex'
 
export default {
  name: 'MarkPaperDetail',
  components: { MarkPaperShow },
  mounted () {
    getStudentExam(this.$route.query.examId, this.$route.query.userId).then(re => {
      this.form = re.data.data
      this.formLoading = false
    })
  },
  data () {
    return {
      paperQuestionList: [],
      form: {},
      formLoading: false,
      userId: null,
      userName: '张三',
      questionLoading: false,
    }
  },
  methods: {
    submit () {
      // 提交批改
    },
    goAnchor (selector) {
      this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
    },
    questionDoRightTag (status) {
      return this.enumFormat(this.doRightTag, status)
    },
    getStudentPaper () {
      getStudentExam(this.examInfo.examId, this.userId).then(res => {
        this.examInfo = res.data.data
      })
    }
  },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
    ...mapState('enumItem', {
      doRightTag: state => state.exam.question.answer.doRightTag
    })
  }
}
</script>
 
<style scoped>
 
.paper-container {
  display: flex;
  flex-direction: row;
  height: 100%;
  padding: 20px;
  min-height: 100%;
}
 
.paper-card {
  position: fixed;
  width: 270px;
}
 
.paper-form {
  flex: 1; /* 占据剩余空间 */
  margin-left: 300px;
}
 
.info {
  display: flex;
  flex-direction: row;
  justify-content: left;
  font-size: 14px;
  margin-top: 10px;
}
 
</style>