From 54730b188630e71ac9ee4044a4b9be160072d0d1 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 02 七月 2024 10:59:22 +0800
Subject: [PATCH] feat:新增考试记录题目查看
---
src/views/exam/paper/edit.vue | 119 ++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 92 insertions(+), 27 deletions(-)
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 () {
--
Gitblit v1.8.0