From 11fbb577737ee65f9446bfa60b6cf96954e2390c Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期二, 02 七月 2024 09:25:00 +0800 Subject: [PATCH] 阅卷 --- src/views/exam/exam/components/MarkPaperShow.vue | 77 ++++++++++++--- src/views/exam/paper/list.vue | 14 -- vue.config.js | 4 src/api/exam.js | 8 + src/views/exam/exam/MarkPaper.vue | 6 src/views/exam/paper/edit.vue | 119 ++++++++++++++++++----- src/views/exam/exam/MarkPaperDetail.vue | 43 ++++++-- 7 files changed, 197 insertions(+), 74 deletions(-) diff --git a/src/api/exam.js b/src/api/exam.js index b49c4d0..ddf21f0 100644 --- a/src/api/exam.js +++ b/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 + }) +} diff --git a/src/views/exam/exam/MarkPaper.vue b/src/views/exam/exam/MarkPaper.vue index 7c68b67..657ee0f 100644 --- a/src/views/exam/exam/MarkPaper.vue +++ b/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 '鏈畬鎴�' } }, diff --git a/src/views/exam/exam/MarkPaperDetail.vue b/src/views/exam/exam/MarkPaperDetail.vue index 4c2d105..ef466f7 100644 --- a/src/views/exam/exam/MarkPaperDetail.vue +++ b/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 diff --git a/src/views/exam/exam/components/MarkPaperShow.vue b/src/views/exam/exam/components/MarkPaperShow.vue index 456ec64..6b875da 100644 --- a/src/views/exam/exam/components/MarkPaperShow.vue +++ b/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">姝g‘绛旀锛�</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 () { + // 褰搒core鍙樺寲鏃讹紝妫�鏌ュ畠鏄惁绛変簬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> diff --git a/src/views/exam/paper/edit.vue b/src/views/exam/paper/edit.vue index d37f453..53411d1 100644 --- a/src/views/exam/paper/edit.vue +++ b/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 () { diff --git a/src/views/exam/paper/list.vue b/src/views/exam/paper/list.vue index b70a611..16e86fe 100644 --- a/src/views/exam/paper/list.vue +++ b/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" diff --git a/vue.config.js b/vue.config.js index cc6f74c..7978686 100644 --- a/vue.config.js +++ b/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 } } -- Gitblit v1.8.0