提交 5cd51775 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 5b56bd37
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
<div class="question-item"> <div class="question-item">
<div class="question-item-title" v-html="questionData.content"></div> <div class="question-item-title" v-html="questionData.content"></div>
<template v-if="questionType === 1 || questionType === 6"> <template v-if="questionType === 1 || questionType === 6">
<el-radio-group v-model="questionData.answer[0]" :disabled="true" class="question-item-content"> <el-radio-group v-model="questionData.user_answer[0]" :disabled="true" class="question-item-content">
<div class="question-item-option" v-for="subItem in questionData.options" :key="subItem.id"> <div class="question-item-option" v-for="subItem in questionData.options" :key="subItem.id">
<el-radio :label="subItem.id">{{ subItem.option }}</el-radio> <el-radio :label="subItem.id">{{ subItem.option }}</el-radio>
</div> </div>
</el-radio-group> </el-radio-group>
</template> </template>
<template v-if="questionType === 2"> <template v-if="questionType === 2">
<el-checkbox-group v-model="questionData.answer" :disabled="true" class="question-item-content"> <el-checkbox-group v-model="questionData.user_answer" :disabled="true" class="question-item-content">
<div class="question-item-option" v-for="subItem in questionData.options" :key="subItem.id"> <div class="question-item-option" v-for="subItem in questionData.options" :key="subItem.id">
<el-checkbox :label="subItem.id"> {{ subItem.option }} </el-checkbox> <el-checkbox :label="subItem.id"> {{ subItem.option }} </el-checkbox>
</div> </div>
</el-checkbox-group> </el-checkbox-group>
</template> </template>
<template v-if="questionType === 3"> <template v-if="questionType === 3">
<div class="SAQ">{{ questionData.answer || '' }}</div> <div class="SAQ">{{ questionData.user_answer[0] || '' }}</div>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="primary" size="mini" plain @click="showComment = !showComment">点击评分</el-button> <el-button type="primary" size="mini" plain @click="showComment = !showComment">点击评分</el-button>
</div> </div>
......
...@@ -329,6 +329,8 @@ export default { ...@@ -329,6 +329,8 @@ export default {
this.questionList = this.questionData.questions.question_items this.questionList = this.questionData.questions.question_items
this.questionList.forEach(item => { this.questionList.forEach(item => {
const score = this.questionData.score_item[item.question_item_id] const score = this.questionData.score_item[item.question_item_id]
// 用户答案
const answer = this.questionData.answers[item.question_item_id]
item.question_list.forEach(subItem => { item.question_list.forEach(subItem => {
if (subItem.group_id) { if (subItem.group_id) {
subItem.list.forEach(it => { subItem.list.forEach(it => {
...@@ -338,6 +340,7 @@ export default { ...@@ -338,6 +340,7 @@ export default {
if (obj.comment) it.comment = obj.comment if (obj.comment) it.comment = obj.comment
if (it.answer) it.answer = JSON.parse(it.answer) if (it.answer) it.answer = JSON.parse(it.answer)
if (it.options) it.options = JSON.parse(it.options) if (it.options) it.options = JSON.parse(it.options)
it.user_answer = answer[it.id]?.answer || []
}) })
} else { } else {
const obj = score[subItem.id] const obj = score[subItem.id]
...@@ -346,6 +349,7 @@ export default { ...@@ -346,6 +349,7 @@ export default {
if (obj.comment) subItem.comment = obj.comment if (obj.comment) subItem.comment = obj.comment
if (subItem.answer) subItem.answer = JSON.parse(subItem.answer) if (subItem.answer) subItem.answer = JSON.parse(subItem.answer)
if (subItem.options) subItem.options = JSON.parse(subItem.options) if (subItem.options) subItem.options = JSON.parse(subItem.options)
subItem.user_answer = answer[subItem.id]?.answer || []
} }
}) })
}) })
......
...@@ -117,7 +117,14 @@ export default { ...@@ -117,7 +117,14 @@ export default {
return map[row.question_difficulty] || row.question_difficulty return map[row.question_difficulty] || row.question_difficulty
} }
}, },
{ label: '更新人', prop: 'operator.realname' } {
label: '更新人',
prop: 'operator.realname',
computed({ row }) {
const user = row.operator
return user.realname || user.nickname || user.username
}
}
] ]
} }
} }
......
...@@ -103,7 +103,14 @@ export default { ...@@ -103,7 +103,14 @@ export default {
{ label: '试卷名称', prop: 'paper_title', minWidth: 200 }, { label: '试卷名称', prop: 'paper_title', minWidth: 200 },
{ label: '总分', prop: 'paper_total_score' }, { label: '总分', prop: 'paper_total_score' },
{ label: '及格分数', prop: 'pass_score' }, { label: '及格分数', prop: 'pass_score' },
{ label: '更新人', prop: 'operator.realname' }, {
label: '更新人',
prop: 'operator.realname',
computed({ row }) {
const user = row.operator
return user.realname || user.nickname || user.username
}
},
{ label: '更新时间', prop: 'updated_at' }, { label: '更新时间', prop: 'updated_at' },
{ label: '操作', slots: 'table-x', align: 'right', width: 150 } { label: '操作', slots: 'table-x', align: 'right', width: 150 }
] ]
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<el-radio v-model="source" label="2">新建子题目</el-radio> <el-radio v-model="source" label="2">新建子题目</el-radio>
</div> </div>
<div class="radio-tips" v-if="source === '1'"> <div class="radio-tips" v-if="source === '1'">
子题目来自于已有题库,您可以从系统的题库中选择题目,组合成情景题的子题目 子题目来自于已有题库,您可以从系统的题库中选择题目,组合成该大题的子题目
</div> </div>
<template v-if="source == 1"> <template v-if="source == 1">
<div class="radio-box"> <div class="radio-box">
...@@ -168,7 +168,8 @@ export default { ...@@ -168,7 +168,8 @@ export default {
methods: { methods: {
// 列表checked点击 重整数据:组合成与题对应的数据 // 列表checked点击 重整数据:组合成与题对应的数据
handleSelectionChange(data) { handleSelectionChange(data) {
this.checkedList = data.reduce((a, b) => { this.checkedList = data
.reduce((a, b) => {
const data = {} const data = {}
data.question_title = b.question_title data.question_title = b.question_title
data.child_question_type = b.question_type || 1 data.child_question_type = b.question_type || 1
...@@ -178,7 +179,8 @@ export default { ...@@ -178,7 +179,8 @@ export default {
if (this.type !== 3) data.question_options = b.question_options if (this.type !== 3) data.question_options = b.question_options
a.push(data) a.push(data)
return a return a
}, []).sort((a, b) => a.order - b.order) }, [])
.sort((a, b) => a.order - b.order)
console.log(this.checkedList, '123') console.log(this.checkedList, '123')
}, },
// 筛选更新列表 // 筛选更新列表
......
...@@ -9,12 +9,6 @@ ...@@ -9,12 +9,6 @@
<template v-slot:filter-category="{ params }"> <template v-slot:filter-category="{ params }">
<question-type-cascader v-model="params.question_category" @change="refetchList"></question-type-cascader> <question-type-cascader v-model="params.question_category" @change="refetchList"></question-type-cascader>
</template> </template>
<template v-slot:category_name="{ row }">
<p class="category_name">{{ row.question_category.name }}</p>
</template>
<template v-slot:question_title="{ row }">
<p class="category_name">{{ row.question_title }}</p>
</template>
<div class="operate-btn"> <div class="operate-btn">
<el-button type="primary" icon="el-icon-plus" @click="$router.push({ path: '/question/create' })" <el-button type="primary" icon="el-icon-plus" @click="$router.push({ path: '/question/create' })"
...@@ -139,28 +133,30 @@ export default { ...@@ -139,28 +133,30 @@ export default {
b.order = index + 1 b.order = index + 1
b.question_type = questionType[b.question_type] b.question_type = questionType[b.question_type]
b.question_difficulty = questionDifficulty[b.question_difficulty] b.question_difficulty = questionDifficulty[b.question_difficulty]
b.opeName = b.operator.realname || b.operator.nickname b.opeName = b.operator.realname || b.operator.nickname || b.operator.username
a.push(b) a.push(b)
return a return a
}, []) }, [])
} }
}, },
columns: [ columns: [
{ type: 'selection', minWidth: '50px', fixed: 'left' }, { type: 'selection', fixed: 'left' },
{ label: '序号', prop: 'order', width: 50 }, { label: '序号', type: 'index' },
{ label: '题目类型', prop: 'question_type', width: 80 }, { label: '题目类型', prop: 'question_type', width: 100 },
{ { label: '试题分类', prop: 'question_category.name', minWidth: 200 },
label: '试题分类', { label: '题目标题', prop: 'question_title', minWidth: 200 },
prop: 'question_category.category_name',
slots: 'category_name',
width: 200
},
{ label: '题目标题', prop: 'question_title', width: 200, slots: 'question_title' },
// { label: '知识点', prop: 'knowledge_point.title' }, // { label: '知识点', prop: 'knowledge_point.title' },
{ label: '等级难度', prop: 'question_difficulty', width: 80 }, { label: '等级难度', prop: 'question_difficulty', width: 80 },
{ label: '更新人', prop: 'opeName' }, {
label: '更新人',
prop: 'operator.realname',
computed({ row }) {
const user = row.operator
return user.realname || user.nickname || user.username
}
},
{ label: '更新时间', prop: 'updated_at', width: 180 }, { label: '更新时间', prop: 'updated_at', width: 180 },
{ label: '操作', slots: 'table-x', align: 'right', width: 200 } { label: '操作', slots: 'table-x', align: 'right', width: 150 }
] ]
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论