组卷->新增试题/编辑试题等

master
yujialong 3 months ago
parent 0165016dd7
commit 0a07ceed91
  1. 239
      src/pages/ques/detail/index.vue
  2. 17
      src/pages/ques/list/index.vue
  3. 2
      src/pages/quesBankType/index.vue
  4. 35
      src/pages/testPaper/detail/index.vue
  5. 76
      src/pages/testPaper/detail/manual.vue
  6. 3
      src/pages/testPaper/detail/template.vue
  7. 6
      src/pages/testPaper/list/index.vue

@ -1,22 +1,37 @@
<template> <template>
<div class="page"> <div class="page h-full">
<Breadcrumb :data="crumbs" /> <Breadcrumb v-if="!paperType" :data="crumbs" />
<p class="page-name mb">试题</p> <p class="page-name mb">试题</p>
<el-form :model="form" :rules="rules" class="input-form model" ref="form" label-width="110px" <el-form :model="form" :rules="rules" :class="['input-form model', { paper: paperType }]" ref="form"
:disabled="detailType === 2"> label-width="110px" :disabled="detailType === 2">
<div class="item-line"> <div class="item-line">
<el-form-item label="题库分类"> <template v-if="paperType === 1">
<el-input v-model="questionBankCategory" disabled /> <el-form-item prop="questionBankTypeId" label="题库分类">
</el-form-item> <el-cascader placeholder="请选择题库分类" v-model="form.questionBankTypeId" :options="questionBankTypes"
<el-form-item label="题库"> :props="{ value: 'id', label: 'name', checkStrictly: true }" clearable
<el-input v-model="questionBankName" disabled /> @change="getQuesBank"></el-cascader>
</el-form-item> </el-form-item>
<el-form-item prop="questionBankId" label="题库">
<el-select v-model="form.questionBankId" filterable placeholder="请选择题库" @change="getKnowledge">
<el-option v-for="(item, i) in questionBanks" :key="i" :label="item.questionBankName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</template>
<template v-else>
<el-form-item label="题库分类">
<el-input v-model="questionBankCategory" disabled />
</el-form-item>
<el-form-item label="题库">
<el-input v-model="questionBankName" disabled />
</el-form-item>
</template>
</div> </div>
<div class="item-line"> <div class="item-line">
<el-form-item prop="specialtyIds" label="所属专业"> <el-form-item prop="specialtyIds" label="所属专业">
<el-select v-model="form.specialtyIds" clearable multiple filterable placeholder="请选择所属专业"> <el-select v-model="form.specialtyIds" clearable multiple filterable placeholder="请选择所属专业">
<el-option v-for="(item, i) in professionals" :key="i" :label="item.professionalName" <el-option v-for="(item, i) in professionals" :key="i" :label="item.professionalName"
:value="item.professionalId" filter></el-option> :value="item.professionalId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="knowledgePointIds" label="所属知识点"> <el-form-item prop="knowledgePointIds" label="所属知识点">
@ -57,7 +72,8 @@
</el-form-item> </el-form-item>
<!-- 单选多选判断特有 --> <!-- 单选多选判断特有 -->
<el-form-item v-if="form.questionType !== 'fill_blank' && form.questionType !== 'essay'" label="正确答案" required> <el-form-item v-if="form.questionType !== 'fill_blank' && form.questionType !== 'essay'"
prop="questionAnswerVersions" label="正确答案">
<div class="opts"> <div class="opts">
<div v-for="(item, i) in form.questionAnswerVersions" :key="i" class="opt"> <div v-for="(item, i) in form.questionAnswerVersions" :key="i" class="opt">
<el-checkbox v-if="form.questionType === 'multiple_choice'" class="correct-check" <el-checkbox v-if="form.questionType === 'multiple_choice'" class="correct-check"
@ -72,8 +88,9 @@
<UeditorPlus v-else class="opt-editor" :ref="'opt' + item.optionNumber" :config="editorConfig" <UeditorPlus v-else class="opt-editor" :ref="'opt' + item.optionNumber" :config="editorConfig"
v-model="item.optionText" @ready="editor => optReady(editor, item)" /> v-model="item.optionText" @ready="editor => optReady(editor, item)" />
<template v-if="form.questionType !== 'judgement'"> <template v-if="form.questionType !== 'judgement'">
<i class="icon el-icon-circle-plus-outline" @click="addOpt(i)"></i> <i class="icon el-icon-circle-plus-outline m-t-8" @click="addOpt(i)"></i>
<i class="icon el-icon-remove-outline" @click="delOpt(i)"></i> <i v-if="form.questionAnswerVersions.length > 2" class="icon el-icon-remove-outline m-t-8"
@click="delOpt(i)"></i>
</template> </template>
</div> </div>
</div> </div>
@ -89,8 +106,8 @@
<div v-if="item.fills" class="fill-items"> <div v-if="item.fills" class="fill-items">
<div v-for="(fill, j) in item.fills" :key="j" class="fill-item"> <div v-for="(fill, j) in item.fills" :key="j" class="fill-item">
<el-input type="textarea" autosize resize="none" placeholder="请输入" v-model="fill.val" /> <el-input type="textarea" autosize resize="none" placeholder="请输入" v-model="fill.val" />
<span v-if="j !== item.fills.length - 1" class="m-r-8"></span>
<i v-if="j" class="action-icon el-icon-remove-outline" @click="item.fills.splice(j, 1)"></i> <i v-if="j" class="action-icon el-icon-remove-outline" @click="item.fills.splice(j, 1)"></i>
<span v-if="j !== item.fills.length - 1"></span>
</div> </div>
</div> </div>
@ -187,15 +204,6 @@
<el-button type="primary" @click="saveQues">确定</el-button> <el-button type="primary" @click="saveQues">确定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="richEditor.dialogVisible" width="1000px" :show-close="false" center
:close-on-click-modal="false">
<!-- <UeditorPlus ref="title2" @ready="editorReady" /> -->
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="editorSubmit">确定</el-button>
<el-button @click="richEditor.dialogVisible = false">取消</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -209,6 +217,7 @@ import dayjs from 'dayjs'
import _ from 'lodash' import _ from 'lodash'
import Const from '@/const/ques' import Const from '@/const/ques'
export default { export default {
props: ['paperType', 'curQues'], //
components: { Breadcrumb, UeditorPlus, Upload }, components: { Breadcrumb, UeditorPlus, Upload },
data () { data () {
return { return {
@ -218,26 +227,17 @@ export default {
questionBankId: this.$route.query.questionBankId, // id questionBankId: this.$route.query.questionBankId, // id
questionBankName: this.$route.query.questionBankName, questionBankName: this.$route.query.questionBankName,
questionBankCategory: this.$route.query.questionBankCategory, questionBankCategory: this.$route.query.questionBankCategory,
detailType: this.$route.query.detailType, detailType: +this.$route.query.detailType,
numToLetter: Util.numToLetter, numToLetter: Util.numToLetter,
detailTypes: ['', '复制', '查看', '编辑', '编辑'], questionBankTypes: [],
types: [], questionBanks: [],
cascaderValue: [],
cascaderProps: {
checkStrictly: true,
label: "classificationName",
value: "classificationId"
},
professionals: [], professionals: [],
difficults: Const.difficults, difficults: Const.difficults,
questionTypes: Const.questionTypes, questionTypes: Const.questionTypes,
knowledges: [], knowledges: [],
editorConfig: {}, editorConfig: {
richEditor: { zIndex: 2500,
object: null,
parameterName: '',
instance: null
}, },
originForm: {}, originForm: {},
originOpt: { originOpt: {
@ -252,6 +252,7 @@ export default {
fillBlanks: [], fillBlanks: [],
uploadList: [], uploadList: [],
form: { form: {
questionBankTypeId: '',
difficulty: '', difficulty: '',
givenYear: new Date(), givenYear: new Date(),
knowledgePointIds: [], knowledgePointIds: [],
@ -265,6 +266,9 @@ export default {
uploadInstructions: '', uploadInstructions: '',
}, },
rules: { rules: {
questionBankId: [
{ required: true, message: '请选择题库', trigger: 'change' }
],
knowledgePointIds: [ knowledgePointIds: [
{ required: true, message: '请选择知识点', trigger: 'change' } { required: true, message: '请选择知识点', trigger: 'change' }
], ],
@ -274,6 +278,9 @@ export default {
questionType: [ questionType: [
{ required: true, message: '请选择题型', trigger: 'change' } { required: true, message: '请选择题型', trigger: 'change' }
], ],
questionAnswerVersions: [
{ required: true, message: '请选择正确答案', trigger: 'change' }
],
}, },
templateVisible: false, templateVisible: false,
submiting: false, submiting: false,
@ -302,20 +309,30 @@ export default {
}, },
mounted () { mounted () {
const { query } = this.$route const { query } = this.$route
this.crumbs = [ if (!this.paperType) {
{ this.crumbs = [
name: '试题管理', {
route: 'list', name: '试题管理',
query: { route: 'list',
questionBankId: query.questionBankId, query: {
questionBankName: query.questionBankName, questionBankId: query.questionBankId,
questionBankCategory: query.questionBankCategory, questionBankName: query.questionBankName,
} questionBankCategory: query.questionBankCategory,
}, }
{ },
name: this.diaTitle {
}, name: this.diaTitle
] },
]
this.form.questionBankId = query.questionBankId
} else if (this.curQues) {
this.questionId = this.curQues.questionId
this.version = this.curQues.version
}
this.editorConfig = this.paperType ? {
zIndex: 2500
} : {}
this.originForm = _.cloneDeep(this.form) this.originForm = _.cloneDeep(this.form)
// this.originFillBlank = _.cloneDeep(this.fillBlanks[0]) // this.originFillBlank = _.cloneDeep(this.fillBlanks[0])
@ -328,13 +345,15 @@ export default {
this.form = _.cloneDeep(this.originForm) this.form = _.cloneDeep(this.originForm)
const type = this.detailType const type = this.detailType
// if (this.paperType === 1) {
if (!type) { this.getQuesBankType()
this.getQuesBank()
} else if (!type) {
//
const { path } = this.$route.query const { path } = this.$route.query
if (path) this.form.knowledgePointIds = [path.split('/').map(e => +e)] if (path) this.form.knowledgePointIds = [path.split('/').map(e => +e)]
} else if (type === 4) {
// this.questionBankId = this.row.questionBankId
} }
const { stem, answerAnalysis, referenceAnswer, uploadInstructions } = this.$refs const { stem, answerAnalysis, referenceAnswer, uploadInstructions } = this.$refs
stem && stem.instance && stem.setText('') stem && stem.instance && stem.setText('')
answerAnalysis && answerAnalysis.instance && answerAnalysis.setText('') answerAnalysis && answerAnalysis.instance && answerAnalysis.setText('')
@ -363,17 +382,12 @@ export default {
// //
async getDetail () { async getDetail () {
try { try {
const { questionId, version } = this let { questionId, version } = this
if (questionId) { if (questionId) {
const res = await this.$post(`${this.api.findQuestion}?questionId=${questionId}&version=${version}`) const res = await this.$post(`${this.api.findQuestion}?questionId=${questionId}&version=${version}`)
const r = res.message const r = res.message
const opts = r.questionAnswerVersionsList const opts = r.questionAnswerVersionsList
if (this.detailType === 4) {
this.questionBankName = r.questionBankName
// this.questionBankCategory = r.questionBankCategory
}
opts.map(e => e.focus = 0) opts.map(e => e.focus = 0)
this.form = { this.form = {
questionId: r.questionId, questionId: r.questionId,
@ -391,9 +405,10 @@ export default {
stemAttachment: r.stemAttachment, stemAttachment: r.stemAttachment,
uploadInstructions: r.uploadInstructions, uploadInstructions: r.uploadInstructions,
questionAnswerVersions: opts, questionAnswerVersions: opts,
questionBankId: r.questionBankId,
} }
this.answerAnalysis = opts[0].answerAnalysis this.answerAnalysis = opts[0].answerAnalysis
this.fillBlanks = JSON.parse(opts[0].answerData) this.fillBlanks = opts[0].answerData ? JSON.parse(opts[0].answerData) : []
// //
const file = r.allowAttachment const file = r.allowAttachment
@ -403,19 +418,29 @@ export default {
url: file url: file
}] }]
} }
//
if (this.paperType === 2) {
this.questionBankName = r.questionBankName
console.log("🚀 ~ getKnowledge ~ id:", this.form)
// this.questionBankCategory = r.questionBankCategory
this.$nextTick(() => {
this.getKnowledge()
})
}
} }
} catch (e) { } } catch (e) { }
}, },
// //
async getKnowledge () { async getKnowledge () {
if (this.questionBankId) { const { questionBankId: id } = this.form
if (id) {
try { try {
const { data } = await this.$post(this.api.TreeStructure, { const { data } = await this.$post(this.api.TreeStructure, {
createSource: 1, createSource: 1,
questionBankId: this.questionBankId, questionBankId: id,
keyword: '', keyword: '',
}) })
this.handleType(data) this.handleType(data, 1)
this.knowledges = data this.knowledges = data
} catch (e) { } } catch (e) { }
} }
@ -432,16 +457,42 @@ export default {
} catch (e) { } } catch (e) { }
}, },
// //
handleType (list) { handleType (list, disable) {
list.map(e => { list.map(e => {
if (!e.type) e.disabled = true if (disable && !e.type) e.disabled = true
if (e.children && e.children.length) { if (e.children && e.children.length) {
this.handleType(e.children) this.handleType(e.children, disable)
} else { } else {
delete e.children delete e.children
} }
}) })
}, },
//
async getQuesBankType () {
try {
const { data } = await this.$post(this.api.getAllQuestionBankCategories, {
createSource: 1,
status: 1,
})
this.handleType(data)
this.questionBankTypes = data
} catch (e) { }
},
//
async getQuesBank () {
try {
let type
const val = this.form.questionBankTypeId
if (val.length) type = val[val.length - 1]
const res = await this.$post(this.api.questionBankList, {
status: 1,
pageNum: 1,
pageSize: 1000,
questionCategoryId: type || '',
})
this.questionBanks = res.message.records
} catch (e) { }
},
// //
handleSingleMultiple () { handleSingleMultiple () {
// //
@ -537,31 +588,6 @@ export default {
editor.focus() editor.focus()
}, },
editorReady (instance) {
console.log("🚀 ~ editorReady ~ instance:", instance)
// this.richEditor.instance = instance
// let currentContent = this.richEditor.object[this.richEditor.parameterName]
// this.richEditor.instance.setContent(currentContent)
// // Ueditor
// this.richEditor.instance.focus(true)
},
inputClick (object, parameterName) {
this.richEditor.object = object
this.richEditor.parameterName = parameterName
this.richEditor.dialogVisible = true
},
editorSubmit () {
let content = this.richEditor.instance.getContent()
if (this.richEditor.parameterName === 'title') { //
// if (this.questionItemReset(content)) {
// this.richEditor.object[this.richEditor.parameterName] = content
// this.richEditor.dialogVisible = false
// }
} else {
this.richEditor.object[this.richEditor.parameterName] = content
this.richEditor.dialogVisible = false
}
},
// 线 // 线
questionItemReset (content) { questionItemReset (content) {
let spanRegex = new RegExp('<span class="gapfilling-span" (.*?)>(.*?)______(.*?)<\\/span>', 'g') let spanRegex = new RegExp('<span class="gapfilling-span" (.*?)>(.*?)______(.*?)<\\/span>', 'g')
@ -637,7 +663,7 @@ export default {
try { try {
this.beforeSubmitForm = _.cloneDeep(form) this.beforeSubmitForm = _.cloneDeep(form)
form.stem = stem form.stem = stem
form.questionBankId = this.questionBankId if (!this.paperType) form.questionBankId = this.questionBankId
form.knowledgePointIds = form.knowledgePointIds.map(e => { form.knowledgePointIds = form.knowledgePointIds.map(e => {
return e[e.length - 1] return e[e.length - 1]
}) })
@ -669,7 +695,7 @@ export default {
} }
if (form.questionId) { if (form.questionId) {
try { try {
await this.$confirm(`<p style="margin-bottom: 10px;">您确定要保存对本题所做的更改吗?</p>${this.detailType === 4 ? '' : '<p style="margin-bottom: 10px;">保存后,所有关联的试卷将会自动更新</p>'}${keep ? '<p>系统未识别到与本题相似的题目</p>' : ''}`, '提示', { await this.$confirm(`<p style="margin-bottom: 10px;">您确定要保存对本题所做的更改吗?</p>${this.detailType === 4 ? '' : `<p style="margin-bottom: 10px;">保存后,所有关联的试卷将会自动更新。${keep ? '系统未识别到与本题相似的题目' : ''}</p>`}`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
@ -697,9 +723,10 @@ export default {
try { try {
const form = this.tempForm const form = this.tempForm
const type = this.detailType const type = this.detailType
const paperEdit = this.curQues //
// type: 1()234createNewVersion // type: 1()234createNewVersion
const res = await this.$post(this.api[type === 4 ? 'createNewVersion' : type === 1 || !form.questionId ? 'addQuestion' : 'updateQuestion'], form) const res = await this.$post(this.api[paperEdit ? 'createNewVersion' : type === 1 || !form.questionId ? 'addQuestion' : 'updateQuestion'], form)
type === 4 && this.$emit('updateQues', this.tempForm, res.questionVersionId) paperEdit && this.$emit('updateQues', form, res.questionVersionId)
Util.successMsg('保存成功') Util.successMsg('保存成功')
!form.questionId && this.keep ? this.init(form) : this.back() !form.questionId && this.keep ? this.init(form) : this.back()
@ -709,15 +736,21 @@ export default {
} }
}, },
back () { back () {
this.$router.back() if (this.paperType) {
//
this.$emit('closeAdd')
} else {
this.$router.back()
}
}, },
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.action-icon { .input-form.model.paper {
margin-right: 10px; height: calc(100vh - 172px);
padding-bottom: 30px;
} }
.ques { .ques {
@ -807,6 +840,10 @@ export default {
margin-right: 15px; margin-right: 15px;
} }
.el-radio {
margin-top: 8px;
}
.opt-input { .opt-input {
width: 100%; width: 100%;
min-height: 32px; min-height: 32px;

@ -409,14 +409,19 @@ export default {
this.page = 1 this.page = 1
this.getList() this.getList()
}, },
getSort (o) {
return o ? (o === 'ascending' ? 'asc' : 'desc') : ''
},
// //
sortChange (column) { sortChange (column) {
if (column.prop === 'questionType') this.filter.questionTypeSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : '' const { prop: p, order: o } = column
if (column.prop === 'givenYear') this.filter.givenYearSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : '' const { filter } = this
if (column.prop === 'difficulty') this.filter.difficultySort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : '' filter.questionTypeSort = p === 'questionType' ? this.getSort(o) : ''
if (column.prop === 'correctRate') this.filter.correctRateSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : '' filter.givenYearSort = p === 'givenYear' ? this.getSort(o) : ''
if (column.prop === 'updateTime') this.filter.updateTimeSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : '' filter.difficultySort = p === 'difficulty' ? this.getSort(o) : ''
if (column.prop === 'referenceCount') this.filter.referenceCountSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : '' filter.correctRateSort = p === 'correctRate' ? this.getSort(o) : ''
filter.updateTimeSort = p === 'updateTime' ? this.getSort(o) : ''
filter.referenceCountSort = p === 'referenceCount' ? this.getSort(o) : ''
this.getList() this.getList()
}, },

@ -25,7 +25,7 @@
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> <el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="name" label="题库分类名称"></el-table-column> <el-table-column prop="name" label="题库分类名称"></el-table-column>
<el-table-column prop="orderNum" label="已关联题库" align="center"></el-table-column> <el-table-column prop="questionBankCount" label="已关联题库" align="center"></el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> <el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<el-table-column prop="createUserName" label="创建人" align="center"></el-table-column> <el-table-column prop="createUserName" label="创建人" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="300"> <el-table-column label="操作" align="center" width="300">

@ -98,7 +98,8 @@
<el-table-column label="操作" align="center" width="120"> <el-table-column label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i> <i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i>
<i class="el-icon-remove-outline action-icon" @click="delLine(scope.$index)"></i> <i v-if="form.paperOutline.length > 1" class="el-icon-remove-outline action-icon"
@click="delLine(scope.$index)"></i>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -181,8 +182,7 @@
查看每空分值<el-input class="l-input" placeholder="请输入分值" v-model="ques.score" readonly /> 查看每空分值<el-input class="l-input" placeholder="请输入分值" v-model="ques.score" readonly />
</div> </div>
</el-popover> </el-popover>
<el-button type="text" @click="toQues(item, j, ques)">编辑试题</el-button>
<!-- <el-button type="text" @click="toQues(item, j, ques)">编辑试题</el-button> -->
<el-button type="text" @click="showManualDia(item, j, ques)">更换试题</el-button> <el-button type="text" @click="showManualDia(item, j, ques)">更换试题</el-button>
<el-button type="text" @click="showManualDia(item, j)">添加试题</el-button> <el-button type="text" @click="showManualDia(item, j)">添加试题</el-button>
<el-button type="text" @click="delQues(item, j)">移除试题</el-button> <el-button type="text" @click="delQues(item, j)">移除试题</el-button>
@ -210,6 +210,12 @@
<Manual :visible.sync="manualVisible" :questionType.sync="curType.questionType" /> <Manual :visible.sync="manualVisible" :questionType.sync="curType.questionType" />
<Auto :visible.sync="autoVisible" /> <Auto :visible.sync="autoVisible" />
<RepeatQues :visible.sync="repeatVisible" :list.sync="repeatQues" /> <RepeatQues :visible.sync="repeatVisible" :list.sync="repeatQues" />
<el-drawer title="编辑试题" :visible.sync="addQuesVisible" size="1200px" :close-on-click-modal="false"
custom-class="editques-dia">
<QuesDetail :paperType.sync="testPaperType" :curQues.sync="curRow" @closeAdd="closeAdd"
@updateQues="updateQues" />
</el-drawer>
</div> </div>
</template> </template>
<script> <script>
@ -220,16 +226,17 @@ import Template from './template'
import Manual from './manual' import Manual from './manual'
import Auto from './auto' import Auto from './auto'
import RepeatQues from './repeatQues' import RepeatQues from './repeatQues'
import QuesDetail from '@/pages/ques/detail'
import Setting from '@/setting' import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import QuesConst from '@/const/ques' import QuesConst from '@/const/ques'
import TestPaperConst from '@/const/testPaper' import TestPaperConst from '@/const/testPaper'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
import { template } from 'lodash' import _ from 'lodash'
export default { export default {
components: { UeditorPlus, Breadcrumb, Template, Manual, Auto, RepeatQues, Draggable }, components: { UeditorPlus, Breadcrumb, Template, Manual, Auto, RepeatQues, Draggable, QuesDetail },
data () { data () {
return { return {
crumbs: [], crumbs: [],
@ -348,10 +355,11 @@ export default {
quesVisible: false, quesVisible: false,
curRow: {}, curRow: {},
detailType: '',
difficultSelected: false, difficultSelected: false,
addQuesVisible: false,
testPaperType: 2,
repeatVisible: false, repeatVisible: false,
repeatQues: [], repeatQues: [],
@ -633,13 +641,17 @@ export default {
}) })
ques.score = total ques.score = total
}, },
// //
toQues (item, i, ques) { toQues (item, i, ques) {
this.curType = item this.curType = item
this.curQuesIndex = i this.curQuesIndex = i
this.curRow = ques this.curRow = ques
this.quesVisible = true this.addQuesVisible = true
this.detailType = 4 },
//
closeAdd () {
this.addQuesVisible = false
}, },
// //
updateQues (ques, id) { updateQues (ques, id) {
@ -649,6 +661,7 @@ export default {
this.curType.examQuestions[this.curQuesIndex] = Object.assign(this.curRow, ques) this.curType.examQuestions[this.curQuesIndex] = Object.assign(this.curRow, ques)
this.calcDifficult() this.calcDifficult()
}, },
// //
showManualDia (item, i, ques) { showManualDia (item, i, ques) {
this.curType = item this.curType = item
@ -1144,4 +1157,10 @@ export default {
padding-left: 32px; padding-left: 32px;
} }
} }
/deep/.editques-dia {
.el-drawer__header {
margin-bottom: 0;
}
}
</style> </style>

@ -104,22 +104,24 @@
<span class="kl">知识点</span> <span class="kl">知识点</span>
</div> </div>
<template v-for="(item, i) in checked"> <div class="lines">
<div v-if="item.stemText.includes(checkedKeyword) || item.knowledgePointName.includes(checkedKeyword)" <template v-for="(item, i) in checked">
:key="i" class="line j-between"> <div v-if="item.stemText.includes(checkedKeyword) || item.knowledgePointName.includes(checkedKeyword)"
<div class="check-left"> :key="i" class="line">
<el-checkbox v-model="item.check"></el-checkbox> <div class="check-left">
<span class="serial">{{ i + 1 }}</span> <el-checkbox v-model="item.check"></el-checkbox>
<el-tooltip effect="dark" :content="item.stemText" placement="top-start"> <span class="serial">{{ i + 1 }}</span>
<p class="checked-stem">{{ item.stemText }}</p> <el-tooltip effect="dark" :content="item.stemText" placement="top-start">
</el-tooltip> <p class="checked-stem">{{ item.stemText }}</p>
<el-tooltip effect="dark" :content="item.knowledgePointName" placement="top-start"> </el-tooltip>
<p class="kl checked-kl">{{ item.knowledgePointName }}</p> <el-tooltip effect="dark" :content="item.knowledgePointName" placement="top-start">
</el-tooltip> <p class="kl checked-kl">{{ item.knowledgePointName }}</p>
</el-tooltip>
</div>
<i class="el-icon-delete action-icon" @click="delChecked(item)"></i>
</div> </div>
<i class="el-icon-delete action-icon" @click="delChecked(item)"></i> </template>
</div> </div>
</template>
</div> </div>
</template> </template>
<div v-else class="empty"> <div v-else class="empty">
@ -131,7 +133,6 @@
<div class="flex j-between p-l-20 p-r-20"> <div class="flex j-between p-l-20 p-r-20">
<p>未找到试题<a class="link" @click="toAddQues">去新增</a></p> <p>未找到试题<a class="link" @click="toAddQues">去新增</a></p>
<p>已选题数/目标题数{{ checkedLen }}/{{ $parent.curType.questionNum }} <p>已选题数/目标题数{{ checkedLen }}/{{ $parent.curType.questionNum }}
<!-- &emsp;&emsp;<a class="link" @click="toEditQues">修改目标</a> -->
</p> </p>
</div> </div>
@ -140,6 +141,12 @@
<el-button type="primary" :loading="submiting" @click="submit">确定</el-button> <el-button type="primary" :loading="submiting" @click="submit">确定</el-button>
</div> </div>
</el-drawer> </el-drawer>
<el-drawer title="新增试题" :visible.sync="addQuesVisible" size="1200px" :close-on-click-modal="false"
custom-class="add-dia">
<QuesDetail :paperType.sync="paperType" @closeAdd="closeAdd" />
</el-drawer>
</div> </div>
</template> </template>
<script> <script>
@ -147,8 +154,10 @@ import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import _ from 'lodash' import _ from 'lodash'
import QuesConst from '@/const/ques' import QuesConst from '@/const/ques'
import QuesDetail from '@/pages/ques/detail'
export default { export default {
props: ['visible', 'questionType'], props: ['visible', 'questionType'],
components: { QuesDetail },
data () { data () {
return { return {
selectQuesVisible: false, selectQuesVisible: false,
@ -176,7 +185,8 @@ export default {
quesVisible: false, quesVisible: false,
curRow: {}, curRow: {},
detailType: '', addQuesVisible: false,
paperType: 1,
}; };
}, },
computed: { computed: {
@ -410,12 +420,12 @@ export default {
}, },
// //
toAddQues () { toAddQues () {
this.quesVisible = true // this.$router.push('/ques/detail?detailType=5')
this.detailType = 5 this.addQuesVisible = true
}, },
// //
toEditQues () { closeAdd () {
this.addQuesVisible = false
}, },
// //
updateQues (ques, id) { updateQues (ques, id) {
@ -502,6 +512,10 @@ export default {
width: 38%; width: 38%;
padding: 15px; padding: 15px;
border-right: 1px solid #eee; border-right: 1px solid #eee;
&:first-child {
width: 24%;
}
} }
.total { .total {
@ -511,9 +525,17 @@ export default {
.lines { .lines {
height: calc(100vh - 358px); height: calc(100vh - 358px);
// padding-right: 10px;
overflow: auto; overflow: auto;
} }
.ques {
.lines {
height: calc(100vh - 328px);
overflow: auto;
}
}
.line { .line {
display: flex; display: flex;
padding: 5px 0; padding: 5px 0;
@ -557,13 +579,13 @@ export default {
@include ellipsis; @include ellipsis;
&.checked-kl { &.checked-kl {
width: 90px; width: 100px;
margin-right: 10px; margin-right: 10px;
} }
} }
.checked-stem { .checked-stem {
max-width: 165px; width: 190px;
margin-right: 20px; margin-right: 20px;
@include ellipsis; @include ellipsis;
} }
@ -583,4 +605,10 @@ export default {
cursor: pointer; cursor: pointer;
} }
} }
/deep/.add-dia {
.el-drawer__header {
margin-bottom: 0;
}
}
</style> </style>

@ -79,7 +79,8 @@
<el-table-column label="操作" align="center" width="120"> <el-table-column label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i> <i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i>
<i class="el-icon-remove-outline action-icon" @click="delLine(scope.$index)"></i> <i v-if="form.paperOutline.length > 1" class="el-icon-remove-outline action-icon"
@click="delLine(scope.$index)"></i>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -141,7 +141,7 @@
e.id === scope.row.paperType).name : '' }}</template> e.id === scope.row.paperType).name : '' }}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" width="60"> <el-table-column label="状态" align="center" width="60">
<template slot-scope="scope">{{ scope.row.status ? '草稿' : (scope.row.isDisable ? '禁用' : '启用') }}</template> <template slot-scope="scope">{{ !scope.row.status ? '草稿' : (scope.row.isDisable ? '禁用' : '启用') }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center" width="160" <el-table-column prop="createTime" label="创建时间" align="center" width="160"
sortable="custom"></el-table-column> sortable="custom"></el-table-column>
@ -154,7 +154,7 @@
<el-button type="text" @click="preview(scope.row)">预览</el-button> <el-button type="text" @click="preview(scope.row)">预览</el-button>
<el-button type="text" @click="toDetail(scope.row)">编辑</el-button> <el-button type="text" @click="toDetail(scope.row)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button> <el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-if="!scope.row.status" v-model="scope.row.isDisable" :active-value="false" <el-switch v-if="scope.row.status" v-model="scope.row.isDisable" :active-value="false"
:inactive-value="true" style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '禁用' : '启用'" :inactive-value="true" style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '禁用' : '启用'"
@change="switchOff($event, scope.row, scope.$index)"></el-switch> @change="switchOff($event, scope.row, scope.$index)"></el-switch>
</template> </template>
@ -412,7 +412,7 @@ export default {
const res = await this.$post(this.api.examPaperList, { const res = await this.$post(this.api.examPaperList, {
...this.filter, ...this.filter,
isDisable: this.status === 2 ? '' : this.status, // isDisable: this.status === 2 ? '' : this.status, //
status: this.status === 2 ? 1 : '', // 稿 status: this.status === 2 ? 0 : '', // 稿
particularYear: this.particularYear ? [this.particularYear] : [], particularYear: this.particularYear ? [this.particularYear] : [],
questionType: this.questionType.length ? this.questionType.join() : '', questionType: this.questionType.length ? this.questionType.join() : '',
type: this.isNotJoin, type: this.isNotJoin,

Loading…
Cancel
Save