提交 84fc7563 authored 作者: lihuihui's avatar lihuihui

update

上级 61020542
......@@ -15,8 +15,7 @@
<app-list v-bind="tableOptions" ref="list" class="app-list" @selection-change="handleSelectionChange">
<template v-slot:input-filter>
<div class="filter-input">
<el-input v-model="filterInput" placeholder="请选择"></el-input>
<div class="pop" @click="dialogVisible = true"></div>
<question-type-cascader v-model="filterInput"></question-type-cascader>
</div>
</template>
</app-list>
......@@ -36,38 +35,23 @@
<el-button type="primary" @click="addQuestionConfirm">&nbsp;&nbsp;&nbsp;&nbsp;确定&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
</div>
</template>
<el-dialog title="提示" :visible="dialogVisible" width="30%" :before-close="handleClose">
<el-tree
:data="treeList"
:props="defaultProps"
@node-click="handleNodeClick"
:expand-on-click-node="false"
></el-tree>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="dialogConfirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getAppList, getQuestionCategory } from '../api'
import { getAppList } from '../api'
import QuestionTypeCascader from '@/components/base/QuestionTypeCascader.vue'
export default {
components: {
QuestionTypeCascader
},
data() {
return {
dialogVisible: false,
filterInput: '',
source: '1',
questionBank: '1',
type: 1,
visible: false,
treeList: [],
defaultProps: '',
treeValue: {
name: '',
id: ''
},
checkedList: []
}
},
......@@ -125,7 +109,7 @@ export default {
question_types: [1, 2, 3, 6],
permission: this.questionBank,
project_prefix: 'x1',
question_category: this.treeValue.id
question_category: this.filterInput
},
callback(data) {
const questionType = {
......@@ -156,7 +140,7 @@ export default {
{ label: '题目类型', prop: 'questionTypeName' },
{ label: '试题分类', prop: 'question_category.category_name' },
{ label: '题目标题', prop: 'question_title' },
{ label: '知识点', prop: 'knowledge_point.title' },
// { label: '知识点', prop: 'knowledge_point.title' },
{ label: '等级难度', prop: 'question_difficulty' },
{ label: '更新人', prop: 'operator.nickname' },
{ label: '更新时间', prop: 'updated_at' },
......@@ -169,6 +153,7 @@ export default {
this.getTreeList()
},
methods: {
// 列表checked点击 重整数据:组合成与题对应的数据
handleSelectionChange(data) {
this.checkedList = data.reduce((a, b) => {
const data = {}
......@@ -181,9 +166,11 @@ export default {
return a
}, [])
},
// 筛选更新列表
radioChange() {
this.$refs.list.refetch()
},
// 添加题型
addQuestionConfirm() {
const data = {
question_title: '',
......@@ -208,50 +195,6 @@ export default {
data.question_options = options
}
this.$emit('questionList', data)
},
handleNodeClick(data) {
this.treeValue.name = data.label
this.treeValue.id = data.id
},
handleClose() {
this.treeValue.name = ''
this.treeValue.id = ''
this.dialogVisible = false
},
dialogConfirm() {
this.dialogVisible = false
this.filterInput = this.treeValue.name
this.$refs.list.refetch()
},
// 获取tree列表
getTreeList() {
getQuestionCategory('x1').then(res => {
if (Array.isArray(res.data)) {
this.initTree(res.data)
}
})
},
// 过滤数据 变成tree组件需要的数据
initTree(data) {
this.treeList = data.reduce((a, b) => {
b.label = b.category_name
if (b.children.length) {
setData(b.children)
}
a.push(b)
return a
}, [])
function setData(item) {
return item.map(element => {
if (element.children.length) {
setData(element.children)
element.label = element.category_name
} else {
element.label = element.category_name
}
return element
})
}
}
}
}
......
<template>
<div>
<!-- <el-divider content-position="center" class="divider">子题目1</el-divider> -->
<el-form :model="ruleForm" :ruleForm="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="子题目类型" prop="desc">
<el-select v-model="ruleForm.desc" placeholder="请选择活动区域">
<el-option label="单选题" value="questionType1"></el-option>
<el-option label="多选题" value="questionType2"></el-option>
<el-option label="判断题" value="questionType3"></el-option>
<el-option label="问答题" value="questionType4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="难度等级" prop="desc">
<el-select v-model="ruleForm.desc" placeholder="请选择活动区域">
<el-option label="单选题" value="questionType1"></el-option>
<el-option label="多选题" value="questionType2"></el-option>
<el-option label="判断题" value="questionType3"></el-option>
<el-option label="问答题" value="questionType4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="子题目标题" prop="data2">
<el-input v-model="ruleForm.data2"></el-input>
</el-form-item>
<el-form-item label="子题目内容" prop="data2">
<v-editor></v-editor>
</el-form-item>
<el-form-item label="选项">
<radio></radio>
<!-- <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button> -->
<!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
</el-form-item>
<el-form-item label="知识点/标签">
<el-input v-model="ruleForm.data2"></el-input>
</el-form-item>
<el-form-item label="子题目解析" prop="data2">
<v-editor></v-editor>
</el-form-item>
<el-form-item label="试题分类" prop="desc">
<el-select v-model="ruleForm.desc" placeholder="请选择活动区域">
<el-option label="单选题" value="questionType1"></el-option>
<el-option label="多选题" value="questionType2"></el-option>
<el-option label="判断题" value="questionType3"></el-option>
<el-option label="问答题" value="questionType4"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">保存子题目</el-button>
<el-button type="primary" @click="resetForm('ruleForm')">删除子题目</el-button>
<!-- <el-input v-model="ruleForm.data2"></el-input> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import Radio from './QTypeRadio.vue'
import VEditor from '@/components/tinymce/Index.vue'
export default {
components: { VEditor, Radio },
data() {
return {
ruleForm: {}
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div>
<el-form :model="ruleForm" :ruleForm="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="题目类型" prop="desc">
<el-select v-model="ruleForm.desc" placeholder="请选择活动区域">
<el-option label="单选题" value="questionType1"></el-option>
<el-option label="多选题" value="questionType2"></el-option>
<el-option label="判断题" value="questionType3"></el-option>
<el-option label="问答题" value="questionType4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="题目标题" prop="data2">
<el-input v-model="ruleForm.data2"></el-input>
</el-form-item>
<el-form-item label="公共题干" prop="data2">
<v-editor></v-editor>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">添加子题目</el-button>
<el-button type="primary" @click="resetForm('ruleForm')">删除子题目</el-button>
</el-form-item>
</el-form>
<case-chidren></case-chidren>
</div>
</template>
<script>
import CaseChidren from './CaseChidren.vue'
import VEditor from '@/components/tinymce/Index.vue'
export default {
components: { VEditor, CaseChidren },
data() {
return {
ruleForm: {}
}
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -27,8 +27,6 @@
<el-form-item label="公共题干" prop="common_content">
<v-editor :disabled="!!($route.query.type === 'view')" v-model="ruleForm.common_content"></v-editor>
</el-form-item>
<!-- </el-form-item> -->
<!-- <el-form-item> -->
<el-form-item label="标签" prop="question_tag">
<el-input v-model="ruleForm.question_tag"></el-input>
</el-form-item>
......@@ -158,10 +156,12 @@ export default {
this.getTreeList()
},
methods: {
// 添加子题 drawer关闭
handleCloseDrawer() {
this.drawer = false
},
submitForm(formName) {
// 提交
submitForm() {
this.ruleForm.children = this.chidrenList
if (this.$route.query.id) {
updateQuestion(this.$route.query.id, this.ruleForm).then(res => {
......@@ -178,6 +178,7 @@ export default {
window.localStorage.removeItem('cacheQuestion')
}
},
// 暂存本地
cacheQuestion() {
const cacheData = {
form: this.ruleForm,
......@@ -191,6 +192,7 @@ export default {
type: 'success'
})
},
// 切换题型
questionTypeChange() {
this.$emit('questionType', this.ruleForm.question_type)
},
......
......@@ -134,7 +134,7 @@ export default {
{ label: '题目类型', prop: 'question_type' },
{ label: '试题分类', prop: 'question_category.category_name' },
{ label: '题目标题', prop: 'question_title' },
{ label: '知识点', prop: 'knowledge_point.title' },
// { label: '知识点', prop: 'knowledge_point.title' },
{ label: '等级难度', prop: 'question_difficulty' },
{ label: '更新人', prop: 'operator.nickname' },
{ label: '更新时间', prop: 'updated_at' },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论