fuliqi
2024-07-02 11fbb577737ee65f9446bfa60b6cf96954e2390c
阅卷
7个文件已修改
271 ■■■■ 已修改文件
src/api/exam.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/exam/MarkPaper.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/exam/MarkPaperDetail.vue 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/exam/components/MarkPaperShow.vue 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/paper/edit.vue 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/paper/list.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/exam.js
@@ -84,3 +84,11 @@
    params: params
  })
}
// 提交阅卷
export const submitMark = (params) => {
  return axios({
    url: '/api/admin/exam/mark/paper',
    method: 'POST',
    data: params
  })
}
src/views/exam/exam/MarkPaper.vue
@@ -117,10 +117,10 @@
    }
  },
  methods: {
    statusFormatter (row) {
      if (row.status === 'finish' || row.markPaperStatus === 'finish') {
    statusFormatter (row, column, cellValue, index) {
      if (cellValue === 'finish') {
        return '完成'
      } else if (row.status === 'temp' || row.markPaperStatus === 'temp') {
      } else if (cellValue === 'temp') {
        return '未完成'
      }
    },
src/views/exam/exam/MarkPaperDetail.vue
@@ -1,6 +1,6 @@
<template>
  <div class="paper-container">
    <div class="paper-card">
    <div class="paper-card" v-loading="formLoading">
      <el-card style="height: 100vh">
        <el-row style="text-align: left; margin-bottom : 20px; font-size: 20px">语文考试</el-row>
        <el-row>
@@ -12,13 +12,13 @@
        <el-row>
          <el-col class="info">
            <span class="exam-info">交卷时间:</span>
            <span class="exam-info">{{ form.updateTime }}</span>
            <span class="exam-info">{{ form.submitTime }}</span>
          </el-col>
        </el-row>
        <el-row>
          <el-col class="info">
            <span class="exam-info">完成耗时:</span>
            <span class="exam-info">{{ form.doTime }}</span>
            <span class="exam-info">{{ formattedDoTime }}</span>
          </el-col>
        </el-row>
        <el-row>
@@ -30,7 +30,7 @@
        <el-divider></el-divider>
        <el-row class="do-exam-title">
          <el-col :span="24">
                <span :key="item.itemOrder" v-for="item in form.answers">
                <span :key="item.itemOrder" v-for="item in form.navbar">
                    <el-tag :type="questionDoRightTag(item.right)" class="do-exam-title-tag"
                            @click="goAnchor('#question-' + item.itemOrder)">{{ item.itemOrder }}</el-tag>
                </span>
@@ -38,19 +38,19 @@
        </el-row>
        <el-divider></el-divider>
        <div style="text-align: center">
          <el-button type="primary" style="width: 120px;height: 35px" @click="submit">提交批改</el-button>
          <el-button type="primary" style="width: 120px;height: 35px" @click="open">提交批改</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>
          <h3>{{ titleItem.title }}</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"/>
              <MarkPaperShow :qType="questionItem.questionType" :question="questionItem" :answer="form.navbar"/>
            </el-form-item>
          </el-card>
        </el-row>
@@ -60,7 +60,7 @@
</template>
<script>
import { getStudentExam } from '@/api/exam'
import { getStudentExam, submitMark } from '@/api/exam'
import MarkPaperShow from '@/views/exam/exam/components/MarkPaperShow'
import { mapGetters, mapState } from 'vuex'
@@ -69,6 +69,7 @@
  components: { MarkPaperShow },
  mounted () {
    getStudentExam(this.$route.query.examId, this.$route.query.userId).then(re => {
      this.formLoading = true
      this.form = re.data.data
      this.formLoading = false
    })
@@ -80,12 +81,26 @@
      formLoading: false,
      userId: null,
      userName: '张三',
      questionLoading: false,
      questionLoading: false
    }
  },
  methods: {
    submit () {
      // 提交批改
    open () {
      this.$confirm('确认是否提交成绩批改?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        submitMark(this.form).then(re => {
          if (re.data.code === 1) {
            console.log('1111111')
            this.$message.success('提交成功')
            this.$router.back()
          } else {
            this.$message.error(re.message)
          }
        })
      })
    },
    goAnchor (selector) {
      this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
@@ -100,6 +115,12 @@
    }
  },
  computed: {
    formattedDoTime () {
      const totalSeconds = this.form.doTime
      const minutes = Math.floor(totalSeconds / 60)
      const seconds = totalSeconds % 60
      return `${minutes}分${seconds < 10 ? '0' + seconds : seconds}秒`
    },
    ...mapGetters('enumItem', ['enumFormat']),
    ...mapState('enumItem', {
      doRightTag: state => state.exam.question.answer.doRightTag
src/views/exam/exam/components/MarkPaperShow.vue
@@ -7,7 +7,7 @@
        <div class="q-title" v-html="question.title"/>
        <div class="q-content">
          <el-radio-group v-model="question.answer">
            <el-radio v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix">
            <el-radio class="custom-radio" v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix " disabled>
              <span class="question-prefix">{{ item.prefix }}.</span>
              <span v-html="item.content" class="q-item-span-content"></span>
            </el-radio>
@@ -19,7 +19,7 @@
        <div class="q-title" v-html="question.title"/>
        <div class="q-content">
          <el-checkbox-group v-model="question.answerList">
            <el-checkbox v-for="item in question.questionItemList" :label="item.prefix" :key="item.prefix">
            <el-checkbox v-for="item in question.questionItemList" :label="item.prefix" :key="item.prefix" disabled>
              <span class="question-prefix">{{ item.prefix }}.</span>
              <span v-html="item.content" class="q-item-span-content"></span>
            </el-checkbox>
@@ -28,10 +28,10 @@
      </div>
      <!-- 判断 -->
      <div v-else-if="qType == 3">
        <div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px"/>
        <div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px" />
        <span style="padding-right: 10px;">(</span>
        <el-radio-group v-model="question.answer">
          <el-radio v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix">
          <el-radio v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix " disabled>
            <span v-html="item.content" class="q-item-span-content"></span>
          </el-radio>
        </el-radio-group>
@@ -41,9 +41,10 @@
      <div v-else-if="qType == 4">
        <div class="q-title" v-html="question.title"/>
        <div v-if="question.answerList !== null">
          <el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.questionItemList" label-width="50px"
          <el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.questionItemList"
                        label-width="50px"
                        style="margin-top: 10px;margin-bottom: 10px;">
            <el-input v-model="question.answerList[item.prefix - 1]"/>
            <el-input v-model="question.answerList[item.prefix - 1]" disabled/>
          </el-form-item>
        </div>
      </div>
@@ -51,7 +52,7 @@
      <div v-else-if="qType == 5 || qType == 7 || qType == 8">
        <div class="q-title" v-html="question.title"/>
        <div>
          <el-input v-model="question.answer" type="textarea" rows="5"></el-input>
          <el-input v-model="question.answer" type="textarea" rows="5" ></el-input>
        </div>
      </div>
      <div class="question-answer-show-item" style="margin-top: 15px">
@@ -81,17 +82,15 @@
        <span class="question-show-item">正确答案:</span>
        <!-- 选择、多选、简答、语音、计算、分析 -->
        <span v-if="qType == 1 || qType == 2 || qType == 5 || qType == 6 || qType == 7 || qType == 8"
              v-html="question.qustionAnswer" class="q-item-span-content"/>
              v-html="question.questionAnswer" class="q-item-span-content"/>
        <!-- 判断 -->
        <span v-if="qType == 3" v-html="trueFalseFormatter(question)" class="q-item-span-content"/>
        <!-- 填空 -->
        <span v-if="qType == 4">{{ question.qustionAnswer }}</span>
        <span v-if="qType == 4">{{ question.questionAnswer }}</span>
      </div>
      <div v-if="question.right == null">
        <span style="color:#ECAB3C;">{{ '批改:' }}</span>
        <el-input-number size="mini" v-model="question.score" :precision="1" :min="0"
                         :max="parseInt(question.questionScore)"></el-input-number>
      </div>
      <span style="color:#ECAB3C;">{{ '批改:' }}</span>
      <el-input-number size="mini" v-model="question.score" :precision="1" :min="0"
                       :max="parseInt(question.questionScore)" @change="updateRight"></el-input-number>
    </div>
    <div v-else>
    </div>
@@ -112,9 +111,9 @@
      }
    },
    answer: {
      type: Object,
      type: Array,
      default: function () {
        return { id: null, content: '', contentArray: [], right: false }
        return {}
      }
    },
    qLoading: {
@@ -127,8 +126,16 @@
    }
  },
  methods: {
    updateRight () {
      // 当score变化时,检查它是否等于questionScore
      this.question.right = this.question.score === parseInt(this.question.questionScore)
      const foundAnswer = this.answer.find(answer => answer.itemOrder === this.question.itemOrder)
      if (foundAnswer) {
        foundAnswer.right = this.question.right
      }
    },
    trueFalseFormatter (question) {
      return question.items.filter(d => d.prefix === question.questionAnswer)[0].content
      return question.questionItemList.filter(d => d.prefix === question.questionAnswer)[0].content
    },
    rightTagFormatter (status) {
      return this.enumFormat(this.rightTag, status)
@@ -146,3 +153,39 @@
  }
}
</script>
<style scoped>
/deep/ .el-checkbox__input.is-disabled + .el-checkbox__label {
  color: #606266
}
/deep/ .el-checkbox__input.is-disabled.is-checked + .el-checkbox__label {
  color: #606266
}
/deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after {
  border-color: #606266
}
/deep/ .el-radio__input.is-disabled + span.el-radio__label {
  color: #606266
}
/deep/ .el-radio__input.is-disabled.is-checked .el-radio__inner::after {
  background-color: #606266;
}
/deep/ .el-radio__input.is-disabled .el-radio__inner, .el-radio__input.is-disabled.is-checked .el-radio__inner {
  border-color: #606266
}
/deep/ .el-input.is-disabled .el-input__inner, textarea:disabled {
  color: #606266
}
/deep/ .el-range-editor.is-disabled input {
  color: #606266
}
</style>
src/views/exam/paper/edit.vue
@@ -14,8 +14,10 @@
      <el-form-item label="试卷名称:" prop="name" required>
        <el-input style="width: 300px" v-model="form.name"/>
      </el-form-item>
      <!-- 题目详细信息 -->
      <el-form-item :key="index" :label="'标题'+(index+1)+':'" required
                    v-for="(titleItem,index) in form.questionTitleList" v-show="form.paperType===1 || (form.paperType ===3 && form.id)">
                    v-for="(titleItem,index) in form.questionTitleList"
                    v-show="form.paperType===1 || (form.paperType ===3 && form.id)">
        <el-input v-model="titleItem.title" style="width: 50%"/>
        <el-select @change="addQuestionType" v-model="titleItem.questionType" style="margin-left: 20px"
                   placeholder="请选择题目类型">
@@ -26,7 +28,8 @@
            :value="item.value"
            :disabled="addedQuestionTypes.includes(item.value)"/><!-- 禁用已添加的选项 -->
        </el-select>
        <el-input-number v-show ="titleItem.questionList.length > 0" v-model="titleItem.eachScore" @change="updateScores(titleItem)" :min="0" :precision="1"
        <el-input-number v-show="titleItem.questionList.length > 0" v-model="titleItem.eachScore"
                         @change="updateScores(titleItem)" :min="0" :precision="1"
                         style="margin-left: 20px" placeholder="每题分数"></el-input-number>
        <el-button type="text" class="link-left" style="margin-left: 20px" size="mini" @click="addQuestion(titleItem)">
          添加题目
@@ -72,31 +75,53 @@
        <el-radio v-model="form.visibility" :label="'1'">私有</el-radio>
        <el-radio v-model="form.visibility" :label="'2'">公开</el-radio>
      </el-form-item>
      <!-- 题目配置信息 随机试卷或新建随序才显示 -->
      <el-form-item v-show="form.paperType ===2 || (form.paperType ===3 && !form.id)" :key="index"
                    :label="translateQuestionType(item.questionType)+':'" v-for="(item,index) in form.questionSetting">
        <div style="display: flex;">
        <div>
          <span style="margin-right: 10px">{{ '标题' }}</span>
          <el-input v-model="item.title" style="margin-right: 50px;width: 500px"/>
          <span style="margin-right: 10px">{{ '数量' }}</span>
          <el-input-number v-model="item.num" :precision="0" :min="0" style="margin-right: 50px"/>
          <span style="margin-right: 10px">{{ '每题分数' }}</span>
          <el-input-number v-model="item.score" :min="0" :precision="1"/>
          <el-input v-model="item.title" style="margin-bottom: 20px;margin-right: 30px;width: 800px"/>
          <el-button type="primary" @click=addToQuestionSetting(item.questionType) >添加</el-button>
          <div style="display: flex;" :key="index" v-for="(setting,index) in item.settingList">
            <span style="margin-right: 10px;margin-bottom: 10px;">{{ '难度' }}</span>
            <el-rate v-model="setting.difficult" :precision="0" :min="0" style="margin-right: 25px;padding: 5px 0"/>
            <span style="margin-right: 10px">{{ '科目' }}</span>
            <el-select v-model="setting.subjectId" placeholder="学科" style="margin-right: 25px">
              <el-option v-for="item in subjects" :key="item.id" :label="item.name" :value="item.id"/>
            </el-select>
            <span style="margin-right: 10px">{{ '数量' }}</span>
            <el-input-number v-model="setting.num" :precision="0" :min="0" style="margin-right: 25px"/>
            <span style="margin-right: 10px">{{ '每题分数' }}</span>
            <el-input-number v-model="setting.score" :min="0" :precision="1"/>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="合计:">
        <div style="display: flex;">
          <span style="margin-right: 10px">{{ '数量:' }}</span>
          <span v-if ="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="margin-right: 50px;width: 100px">{{ totalNum }}</span>
          <span v-if ="form.paperType ===1 || (form.paperType ===3 && form.id)" style="margin-right: 50px;width: 100px">{{ form.num }}</span>
          <span v-if="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="margin-right: 50px;width: 100px">{{
              totalNum
            }}</span>
          <span v-if="form.paperType ===1 || (form.paperType ===3 && form.id)" style="margin-right: 50px;width: 100px">{{
              form.num
            }}</span>
          <span style="margin-right: 10px">{{ '总分:' }}</span>
          <span v-if ="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="width: 100px">{{ totalScore }}</span>
          <span v-if ="form.paperType ===1 || (form.paperType ===3 && form.id)" style="width: 100px">{{ form.score }}</span>
          <span v-if="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="width: 100px">{{
              totalScore
            }}</span>
          <span v-if="form.paperType ===1 || (form.paperType ===3 && form.id)" style="width: 100px">{{
              form.score
            }}</span>
        </div>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="resetForm">重置</el-button>
        <el-button type="success" @click="addTitle" v-show="form.paperType ===1 ||(form.paperType ===3 && form.id)">添加标题</el-button>
        <el-button type="success" @click="addTitle" v-show="form.paperType ===1 ||(form.paperType ===3 && form.id)">
          添加标题
        </el-button>
      </el-form-item>
    </el-form>
@@ -156,14 +181,46 @@
        deductTypeScore: 0,
        visibility: '1',
        questionSetting: [
          { questionType: 1, title: '单选题', score: null, num: null },
          { questionType: 2, title: '多选题', score: null, num: null },
          { questionType: 3, title: '判断题', score: null, num: null },
          { questionType: 4, title: '填空题', score: null, num: null },
          { questionType: 5, title: '简答题', score: null, num: null },
          { questionType: 6, title: '语音题', score: null, num: null },
          { questionType: 7, title: '计算题', score: null, num: null },
          { questionType: 8, title: '分析题', score: null, num: null },
          {
            title: '单选题',
            questionType: 1,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '多选题',
            questionType: 2,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '判断题',
            questionType: 3,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '填空题',
            questionType: 4,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '简答题',
            questionType: 5,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '语音题',
            questionType: 6,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '计算题',
            questionType: 7,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          },
          {
            title: '分析题',
            questionType: 8,
            settingList: [{ difficult: null, score: null, num: null, subjectId: null }]
          }
        ],
        questionTitleList: []
      },
@@ -180,7 +237,7 @@
        { name: '简答题', value: 5 },
        { name: '语音题', value: 6 },
        { name: '计算题', value: 7 },
        { name: '分析题', value: 8 },
        { name: '分析题', value: 8 }
      ],
      addedQuestionTypes: [], // 已添加的题目类型
      subjects: [],
@@ -228,10 +285,18 @@
      examPaperApi.select(id).then(re => {
        _this.form = re.data
        _this.formLoading = false
        this.addQuestionType()
      })
    }
  },
  methods: {
    addToQuestionSetting (questionType) {
      this.form.questionSetting.forEach(item => {
        if (item.questionType === questionType) {
          item.settingList.push({ difficult: null, score: null, num: null, subjectId: null })
        }
      })
    },
    updateTotalScore () {
      this.form.score = 0
      this.form.questionTitleList.forEach(titleItem => {
@@ -325,19 +390,19 @@
      this.questionPage.showDialog = true
      this.search()
    },
    removeTitleItem (titleItem ,index) {
    removeTitleItem (titleItem, index) {
      this.form.questionTitleList.splice(index, 1)
      this.form.num = this.form.num - titleItem.questionList.length
      this.updateTotalScore();
      this.updateTotalScore()
      if (!this.form.questionTitleList || this.form.questionTitleList.length === 0) {
        this.addedQuestionTypes = []
      } else {
        this.addQuestionType()
      }
    },
    removeQuestion (titleItem ,questionIndex) {
      titleItem.questionList.splice(questionIndex ,1)
      this.updateTotalScore();
    removeQuestion (titleItem, questionIndex) {
      titleItem.questionList.splice(questionIndex, 1)
      this.updateTotalScore()
      this.form.num = this.form.num - 1
    },
    queryForm () {
src/views/exam/paper/list.vue
@@ -4,15 +4,6 @@
      <el-form-item label="试卷ID:">
        <el-input v-model="queryParam.id" clearable></el-input>
      </el-form-item>
      <el-form-item label="学科:" >
        <el-select
          v-model="queryParam.subjectId"
          placeholder="全部科目"
          clearable
        >
          <el-option v-for="item in subjects" :key="item.id" :label="item.name" :value="item.id"/>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">查询</el-button>
        <router-link :to="{path:'/exam/paper/edit'}" class="link-left">
@@ -22,11 +13,6 @@
    </el-form>
    <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
      <el-table-column align="center" prop="id" label="Id" width="90px"/>
      <el-table-column align="center" prop="subjectId" label="学科" width="120px" >
        <template slot-scope="scope">
          {{ translate(scope.row.subjectId) }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="name" label="名称"  />
      <el-table-column
        align="center"
vue.config.js
@@ -19,8 +19,8 @@
    hotOnly: false,
    proxy: {
      '/api': {
        // target: 'http://localhost:8000',
        target: 'http://192.168.3.64:8000',
        target: 'http://localhost:8000',
        // target: 'http://192.168.3.64:8000',
        changeOrigin: true
      }
    }