提交 2e3003dc authored 作者: lihuihui's avatar lihuihui

修改bug

上级 56887b98
......@@ -142,7 +142,8 @@ export default {
return data.data.reduce((a, b, index) => {
const type = b.question_type
b.order = index + 1
b.question_type = questionType[b.question_type]
// b.question_type = questionType[b.question_type]
b.questionTypeName = questionType[b.question_type]
b.question_difficulty = questionDifficulty[b.question_difficulty]
if (type !== 5 && type !== 7 && type !== 8) a.push(b)
return a
......@@ -152,7 +153,7 @@ export default {
columns: [
{ type: 'selection', minWidth: '50px', fixed: 'left' },
{ label: '序号', prop: 'order' },
{ label: '题目类型', prop: 'question_type' },
{ label: '题目类型', prop: 'questionTypeName' },
{ label: '试题分类', prop: 'question_category.category_name' },
{ label: '题目标题', prop: 'question_title' },
{ label: '知识点', prop: 'knowledge_point.title' },
......@@ -169,10 +170,11 @@ export default {
},
methods: {
handleSelectionChange(data) {
console.log(data, 'datas')
this.checkedList = data.reduce((a, b) => {
const data = {}
data.question_title = b.question_title
data.child_question_type = b.child_question_type || 1
data.child_question_type = b.question_type || 1
data.question_content = b.question_content
data.question_analysis = b.question_analysis
if (this.type !== 3) data.question_options = b.question_options
......
<template>
<div class="radio-box">
<template v-for="(item, index) in datas">
<template v-for="(item, index) in option">
<div class="opt" :key="index">
<el-checkbox v-model="checkboxValue" :label="index" @change="checkboxChange">
<el-tag>{{ A_Z()[index] }}</el-tag>
<el-input v-model="item.option" maxlength="80" show-word-limit></el-input>
</el-checkbox>
<i class="el-icon-remove-outline icon-style" v-if="index != datas.length - 1" @click="remove(index)"></i>
<i class="el-icon-remove-outline icon-style" v-if="index != option.length - 1" @click="remove(index)"></i>
<i class="el-icon-circle-plus-outline icon-style" v-else @click="add"></i>
</div>
</template>
......@@ -44,20 +44,20 @@ export default {
}
},
mounted() {
if (this.option) {
this.datas = this.option
this.checkboxValue = [0]
this.datas.forEach((item, index) => {
if (item.checked) this.checkboxValue.push(index)
})
}
// if (this.option) {
// this.datas = this.option
this.checkboxValue = [0]
this.option.forEach((item, index) => {
if (item.checked) this.checkboxValue.push(index)
})
// }
},
methods: {
add() {
this.datas.push({ option: '', checked: false })
this.option.push({ option: '', checked: false })
},
remove(index) {
this.datas.splice(index, 1)
this.option.splice(index, 1)
},
A_Z() {
const result = []
......@@ -67,14 +67,14 @@ export default {
return result
},
checkboxChange() {
this.datas.map(item => {
this.option.map(item => {
item.checked = false
return item
})
this.checkboxValue.forEach(item => {
this.datas[item].checked = true
this.option[item].checked = true
})
console.log(this.datas)
console.log(this.option)
}
}
}
......
......@@ -2,7 +2,7 @@
<div>
<div class="tool-btn" v-if="!!!($route.query.type === 'view')">
<el-button type="primary" @click="drawer = true">添加子题目</el-button>
<el-button type="primary" @click="cacheQuestion">保存主题目</el-button>
<el-button type="primary" v-if="!!!($route.query.type === 'edit')" @click="cacheQuestion">保存主题目</el-button>
</div>
<el-form :disabled="!!($route.query.type === 'view')" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="题库范围" prop="permission">
......
......@@ -4,7 +4,7 @@
<div v-for="(ruleForm, index) in dataList" :key="index">
<el-divider content-position="center" class="divider">子题目{{ index + 1 }}</el-divider>
<el-form-item style="text-align: right;" v-if="!!!($route.query.type === 'view')">
<el-button type="primary" @click="$emit('cacheChidren')">保存子题目</el-button>
<el-button type="primary" v-if="!!!($route.query.type === 'edit')" @click="$emit('cacheChidren')">保存子题目</el-button>
<el-button type="primary" @click="removeChidren(index)">删除子题目</el-button>
</el-form-item>
<el-form-item label="子题目类型" prop="child_question_type">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论