bug
lohir
2024-10-16 80561b2bc83bb35582ba62e0c21a63c3ee5a0e82
bug
3个文件已修改
65 ■■■■■ 已修改文件
src/api/exam.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/class-management/Class.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/exam/ExamManage.vue 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/exam.js
@@ -108,3 +108,19 @@
    data: data
  })
}
// 考试记录作废
export const cancel = (id) => {
  return axios({
    url: '/api/admin/exam/cancel/' + id,
    method: 'PUT'
  })
}
// 考试记录恢复
export const recover = (id) => {
  return axios({
    url: "/api/admin/exam/recover/" + id,
    method: "PUT"
  })
}
src/views/class-management/Class.vue
@@ -322,7 +322,7 @@
        this.page()
      })
    },
    recover(id) {
    recover (id) {
      recover(id).then(res => {
        this.$message.success(res.data.message)
        this.page()
src/views/exam/exam/ExamManage.vue
@@ -75,21 +75,43 @@
            size="small"
            @click="handlerEdit(scope.row)"
            v-if="scope.row.status === 'not_start'"
            v-show="scope.row.status !== 'cancel'"
          >修改
          </el-button>
          <el-popconfirm
            v-if="scope.row.status === 'not_start'"
            v-show="scope.row.status !== 'cancel'"
            style="margin: 0 5px"
            title="确定要删除该考试吗?"
            @confirm="deleteExam(scope.row.id)"
          >
            <el-button slot="reference" type="danger" size="small">删除</el-button>
            <el-button slot="reference" type="danger" size="small" v-show="scope.row.status !== 'cancel'">删除</el-button>
          </el-popconfirm>
          <el-button v-if="scope.row.status === 'finished'" type="success" size="small" @click="markPaper(scope.row)">
          <el-button v-if="scope.row.status === 'finished'" type="success" size="small" @click="markPaper(scope.row)" v-show="scope.row.status !== 'cancel'">
            阅卷
          </el-button>
          <el-button v-if="scope.row.status === 'ing'" type="warning" size="small" @click="monitor(scope.row)">监控</el-button>
          <el-button v-if="scope.row.status === 'ing'" type="warning" size="small" @click="monitor(scope.row)" v-show="scope.row.status !== 'cancel'">监控</el-button>
          <el-popconfirm
            class="confirm"
            style="margin: 0 5px"
            title="确定要作废该考试记录吗?"
            @confirm="cancel(scope.row.id)"
          >
            <el-button slot="reference" v-show="scope.row.status !== 'cancel'" type="danger"
                       size="small"
                       v-if="scope.row.status !== 'ing'">作废
            </el-button>
          </el-popconfirm>
          <el-popconfirm
            class="confirm"
            title="确定要恢复该考试记录吗?"
            @confirm="recover(scope.row.id)"
          >
            <el-button slot="reference" v-show="scope.row.status === 'cancel'" type="success"
                       size="small">恢复正常
            </el-button>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
@@ -150,8 +172,7 @@
<script>
import Pagination from '@/components/Pagination'
import { getExams, addExam, editExam, deleteExamById } from '@/api/exam'
import { myClasses } from '@/api/classes'
import { getExams, addExam, editExam, deleteExamById, cancel, recover } from '@/api/exam'
import examPaperAPI from '@/api/examPaper'
export default {
@@ -211,6 +232,20 @@
    this.MyExamPaperList()
  },
  methods: {
    // 作废考试
    cancel (id) {
      cancel(id).then(res => {
        this.$message.success(res.data.message)
        this.page()
      })
    },
    // 恢复考试
    recover (id) {
      recover(id).then(res => {
        this.$message.success(res.data.message)
        this.page()
      })
    },
    // 考试监控列表
    monitor (row) {
      this.$router.push({ path: '/exam/monitor', query: { examId: row.id } })
@@ -229,6 +264,8 @@
        return '未开始'
      } else if (row.status === 'finished') {
        return '已结束'
      } else if (row.status === 'cancel') {
        return '已作废'
      }
    },
    MyExamPaperList () {