yujialong 1 month ago
parent 761e5549b6
commit 688a08ab1a
  1. 1
      public/static/ueditorPlus/ueditor.config.js
  2. 92
      src/pages/knowledge/index.vue
  3. 21
      src/pages/ques/detail/index.vue
  4. 4
      src/pages/ques/list/batchImport.vue
  5. 15
      src/pages/ques/list/index.vue
  6. 405
      src/pages/testPaper/detail/auto.vue
  7. 4
      src/pages/testPaper/detail/index.vue
  8. 5
      src/styles/common.scss

@ -60,6 +60,7 @@
".gif", ".gif",
".bmp" ".bmp"
], ],
autoFloatEnabled: false,
// fontfamily: [], // fontfamily: [],
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义

@ -1,7 +1,7 @@
<template> <template>
<div :class="['page', { inQues }]"> <el-drawer title="知识点设置" :visible.sync="kpVisible" size="1200px" :close-on-click-modal="false" append-to-body
<Breadcrumb v-if="!inQues" style="margin-bottom: 0;" :data="crumbs" /> custom-class="kp-dia" @closed="closeDia">
<div class="wrap"> <div class="page">
<div class="side"> <div class="side">
<div class="m-b-20"> <div class="m-b-20">
<el-radio-group v-model="isNotJoin" @change="changeType"> <el-radio-group v-model="isNotJoin" @change="changeType">
@ -22,7 +22,7 @@
<el-input class="m-b-10" placeholder="请输入知识点分类" prefix-icon="el-icon-search" size="small" clearable <el-input class="m-b-10" placeholder="请输入知识点分类" prefix-icon="el-icon-search" size="small" clearable
v-model="keyword"></el-input> v-model="keyword"></el-input>
<div style="overflow: auto"> <div class="type-wrap">
<el-tree v-loading="loading" :data="types" default-expand-all ref="typeTree" node-key="id" highlight-current <el-tree v-loading="loading" :data="types" default-expand-all ref="typeTree" node-key="id" highlight-current
:expand-on-click-node="false" @node-click="handleNodeClick" :props="{ label: 'name', isLeaf: 'leaf' }"> :expand-on-click-node="false" @node-click="handleNodeClick" :props="{ label: 'name', isLeaf: 'leaf' }">
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
@ -117,7 +117,6 @@
</div> </div>
</div> </div>
<el-dialog title="提示" :visible.sync="delVisible" width="400px" :close-on-click-modal="false" append-to-body <el-dialog title="提示" :visible.sync="delVisible" width="400px" :close-on-click-modal="false" append-to-body
custom-class="del-dia"> custom-class="del-dia">
<div class="del-wrap"> <div class="del-wrap">
@ -132,7 +131,7 @@
<el-button type="primary" @click="delTypeSubmit">确定</el-button> <el-button type="primary" @click="delTypeSubmit">确定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </el-drawer>
</template> </template>
<script> <script>
@ -140,12 +139,12 @@ import Util from '@/libs/util'
import _ from 'lodash' import _ from 'lodash'
import Breadcrumb from '@/components/breadcrumb' import Breadcrumb from '@/components/breadcrumb'
export default { export default {
props: ['visible'],
components: { Breadcrumb }, components: { Breadcrumb },
data () { data () {
return { return {
crumbs: [], kpVisible: false,
questionBankId: this.$route.query.questionBankId, questionBankId: this.$route.query.questionBankId,
inQues: false,
createSource: 1, createSource: 1,
loading: false, loading: false,
keyword: '', keyword: '',
@ -209,26 +208,12 @@ export default {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(this.getList, 500) this.searchTimer = setTimeout(this.getList, 500)
}, },
visible () {
this.kpVisible = this.visible
this.visible && this.getType()
}
}, },
mounted () { mounted () { },
const { query } = this.$route
const { referrer1, referrer2 } = this.$store.state.user
this.crumbs = [
{
name: query.questionBankName || '题库管理',
route: referrer1 || '/quesBank'
},
{
name: '试题列表',
route: referrer2 || '/ques',
},
{
name: '知识点列表'
},
]
this.inQues = this.$route.path === '/ques/detail' //
this.getType()
},
methods: { methods: {
// //
async getType () { async getType () {
@ -259,7 +244,7 @@ export default {
name: '', name: '',
} }
this.typeVisible = true this.typeVisible = true
this.cascaderValue = data.path.split('/').map(e => +e) this.cascaderValue = data ? data.path.split('/').map(e => +e) : []
}, },
// //
editType (node, data) { editType (node, data) {
@ -403,7 +388,6 @@ export default {
name: row.name, name: row.name,
parentId: path.slice(0, path.length - 1), parentId: path.slice(0, path.length - 1),
} }
console.log(11, this.form)
}, },
// //
async knowledgeSubmit () { async knowledgeSubmit () {
@ -446,40 +430,48 @@ export default {
Util.warningMsg('请选择数据') Util.warningMsg('请选择数据')
} }
}, },
//
closeDia () {
this.$emit('closed')
this.$emit('update:visible', false)
}
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.m-b-20 {
margin-bottom: 20px;
}
.org-name { .org-name {
margin-right: 20px; margin-right: 20px;
} }
.w-100 {
width: 100%;
}
.inQues { /deep/.kp-dia {
padding: 0 25px; .el-drawer__header {
} margin-bottom: 0;
}
.wrap { .page {
display: flex; display: flex;
padding: 0 24px;
.side { .side {
width: 300px; width: 300px;
padding: 24px 10px 24px 0; padding: 24px 10px 24px 0;
margin-right: 24px; margin-right: 24px;
border-right: 1px solid rgba(0, 0, 0, 0.06); border-right: 1px solid rgba(0, 0, 0, 0.06);
} }
.type-wrap {
max-height: calc(100vh - 265px);
overflow: auto;
}
.right { .right {
width: calc(100% - 324px); width: calc(100% - 324px);
padding: 24px 0; max-height: calc(100vh - 53px);
padding: 24px 0;
overflow: auto;
}
} }
} }
</style> </style>

@ -222,11 +222,7 @@
</span> </span>
</el-dialog> </el-dialog>
<Knowledge :visible.sync="kpVisible" @closed="getKnowledge" />
<el-drawer title="知识点设置" :visible.sync="kpVisible" size="1200px" :close-on-click-modal="false" append-to-body
custom-class="kp-dia" @closed="getKnowledge">
<Knowledge />
</el-drawer>
</div> </div>
</template> </template>
<script> <script>
@ -598,15 +594,18 @@ export default {
}, },
// //
answerAnalysisReady (editor) { answerAnalysisReady (editor) {
this.isDisabled ? editor.setDisabled() : editor.setContent(this.answerAnalysis) this.isDisabled && editor.setDisabled()
editor.setContent(this.answerAnalysis)
}, },
// //
uploadInstructionsReady (editor) { uploadInstructionsReady (editor) {
this.isDisabled ? editor.setDisabled() : editor.setContent(this.form.uploadInstructions) this.isDisabled && editor.setDisabled()
editor.setContent(this.form.uploadInstructions)
}, },
// //
referenceAnswerReady (editor) { referenceAnswerReady (editor) {
this.isDisabled ? editor.setDisabled() : editor.setContent(this.form.questionAnswerVersions[0].referenceAnswer) this.isDisabled && editor.setDisabled()
editor.setContent(this.form.questionAnswerVersions[0].referenceAnswer)
}, },
// //
correctChange (i) { correctChange (i) {
@ -946,10 +945,4 @@ export default {
.correct-check { .correct-check {
margin-right: 15px; margin-right: 15px;
} }
/deep/.kp-dia {
.el-drawer__header {
margin-bottom: 0;
}
}
</style> </style>

@ -30,7 +30,7 @@
:on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove"
:limit="1" :data="{ :limit="1" :data="{
questionBankId: params.questionBankId questionBankId: params.questionBankId
}" :disabled="uploading" :loading="uploading" :on-exceed="handleExceed" }" :disabled="uploading" v-loading="uploading" :on-exceed="handleExceed"
:action="this.api.batchImportQuestions" :file-list="uploadList" :headers="headers"> :action="this.api.batchImportQuestions" :file-list="uploadList" :headers="headers">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
@ -145,7 +145,7 @@ export default {
.el-progress__text, .el-progress__text,
.el-progress, .el-progress,
.el-upload-list__item-status-label { .el-upload-list__item-status-label {
// display: none !important; display: none !important;
} }
} }
</style> </style>

@ -164,18 +164,21 @@
</el-dialog> </el-dialog>
<BatchImport :visible.sync="importVisible" :params.sync="$route.query" /> <BatchImport :visible.sync="importVisible" :params.sync="$route.query" />
<Knowledge :visible.sync="kpVisible" @closed="getType" />
</div> </div>
</template> </template>
<script> <script>
import Breadcrumb from '@/components/breadcrumb' import Breadcrumb from '@/components/breadcrumb'
import BatchImport from './batchImport' import BatchImport from './batchImport'
import Knowledge from '@/pages/knowledge'
import Util from '@/libs/util' import Util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
import Const from '@/const/ques' import Const from '@/const/ques'
import Qs from 'qs' import Qs from 'qs'
export default { export default {
components: { Breadcrumb, BatchImport }, components: { Breadcrumb, BatchImport, Knowledge },
data () { data () {
return { return {
crumbs: [], crumbs: [],
@ -230,6 +233,8 @@ export default {
curRow: {}, curRow: {},
importVisible: false, importVisible: false,
kpVisible: false,
}; };
}, },
computed: { computed: {
@ -318,11 +323,7 @@ export default {
}, },
// //
toSet () { toSet () {
this.setReferrer() this.kpVisible = true
this.$router.push({
path: '/knowledge',
query: this.$route.query
})
}, },
// url // url
setReferrer () { setReferrer () {
@ -489,6 +490,8 @@ export default {
await this.$post(this.api.delQuestion, ids) await this.$post(this.api.delQuestion, ids)
Util.successMsg('删除成功') Util.successMsg('删除成功')
this.getList() this.getList()
this.multipleSelection = []
this.$refs.table.clearSelection()
} catch (e) { } } catch (e) { }
} }
}, },

@ -1,188 +1,186 @@
<template> <template>
<div> <el-drawer title="自动选题" :visible.sync="quesVisible" size="1200px" :close-on-click-modal="false"
<el-drawer title="自动选题" :visible.sync="quesVisible" size="1200px" :close-on-click-modal="false" custom-class="ques-dia" @closed="closeDia">
custom-class="ques-dia" @closed="closeDia"> <div class="overflow">
<div class="overflow"> <h6 class="page-name">难度设置</h6>
<h6 class="page-name">难度设置</h6> <div class="tool">
<div class="tool"> <ul class="filter">
<li style="margin-right: 10px">
<label>试卷难度</label>
<el-select v-model="difficult" placeholder="请选择试卷难度" clearable @change="difficultChange">
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<el-tooltip placement="top">
<div class="diff-text" slot="content">
<p>基础题难度系数0.2</p>
<p>普通题难度系数0.4</p>
<p>较难题难度系数0.6</p>
<p>困难题难度系数0.8</p>
<p>1<span class="em">题型难度系数</span>=对应题型所有试题的难度系数之和/总试题数</p>
<p>2<span class="em">试卷总难度系数</span>=所有试题的难度系数之和/总试题数</p>
<p>3<span class="em">难度系数评价</span></p>
<div class="coe">
<p>简单系数 &lt;=0.3</p>
<p>普通0.3&lt;系数&lt;=0.4</p>
<p>较难0.4&lt;系数&lt;0.5</p>
<p>困难:系数&gt;=0.5</p>
</div>
</div>
<i class="el-icon-question" style="font-size: 16px;color: #8f8f8f;cursor: pointer;"></i>
</el-tooltip>
</ul>
</div>
<el-table :data="list" stripe header-align="center" row-key="libraryId">
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column label="大题" align="center" min-width="100">
<template slot-scope="scope">{{ arabicToChinese(scope.$index + 1) }}大题</template>
</el-table-column>
<el-table-column prop="name" label="题型" align="center" min-width="90">
<template slot-scope="scope">
<p v-if="scope.row.questionType">{{ questionTypes.find(e => e.id === scope.row.questionType).name }}</p>
</template>
</el-table-column>
<el-table-column prop="questionNum" label="目标题数" align="center" min-width="80"></el-table-column>
<el-table-column label="基础(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.basicDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="普通(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.normalDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="较难(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.hardDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="难(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.veryHardDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="难度随机(道题)" align="center" width="100">
<template slot-scope="scope">
<el-input v-model.number="scope.row.randomDifficulty" type="number" />
</template>
</el-table-column>
</el-table>
<h6 class="page-name m-t-20">知识点设置</h6>
<div class="wrap">
<!-- 题库 -->
<div class="item">
<p class="total m-b-10">题库</p>
<ul class="filter"> <ul class="filter">
<li style="margin-right: 10px"> <li class="m-b-10">
<label>试卷难度</label> <label>题库分类</label>
<el-select v-model="difficult" placeholder="请选择试卷难度" @change="difficultChange"> <el-cascader style="width: 240px;" placeholder="请选择题库分类" v-model="quesBankTypeVal"
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> :options="quesBankTypes" :props="{ value: 'id', label: 'name', checkStrictly: true }" clearable
</el-select> @change="initQuesBank"></el-cascader>
</li>
<li>
<el-input placeholder="请输入题库名称" prefix-icon="el-icon-search" v-model="quesBankKeyword" clearable />
</li> </li>
<el-tooltip placement="top">
<div class="diff-text" slot="content">
<p>基础题难度系数0.2</p>
<p>普通题难度系数0.4</p>
<p>较难题难度系数0.6</p>
<p>困难题难度系数0.8</p>
<p>1<span class="em">题型难度系数</span>=对应题型所有试题的难度系数之和/总试题数</p>
<p>2<span class="em">试卷总难度系数</span>=所有试题的难度系数之和/总试题数</p>
<p>3<span class="em">难度系数评价</span></p>
<div class="coe">
<p>简单系数 &lt;=0.3</p>
<p>普通0.3&lt;系数&lt;=0.4</p>
<p>较难0.4&lt;系数&lt;0.5</p>
<p>困难:系数&gt;=0.5</p>
</div>
</div>
<i class="el-icon-question" style="font-size: 16px;color: #8f8f8f;cursor: pointer;"></i>
</el-tooltip>
</ul> </ul>
</div>
<el-table :data="list" stripe header-align="center" row-key="libraryId">
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column label="大题" align="center" min-width="100">
<template slot-scope="scope">{{ arabicToChinese(scope.$index + 1) }}大题</template>
</el-table-column>
<el-table-column prop="name" label="题型" align="center" min-width="90">
<template slot-scope="scope">
<p v-if="scope.row.questionType">{{ questionTypes.find(e => e.id === scope.row.questionType).name }}</p>
</template>
</el-table-column>
<el-table-column prop="questionNum" label="目标题数" align="center" min-width="80"></el-table-column>
<el-table-column label="基础(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.basicDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="普通(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.normalDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="较难(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.hardDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="难(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.veryHardDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="难度随机(道题)" align="center" width="100">
<template slot-scope="scope">
<el-input v-model.number="scope.row.randomDifficulty" type="number" />
</template>
</el-table-column>
</el-table>
<h6 class="page-name m-t-20">知识点设置</h6>
<div class="wrap">
<!-- 题库 -->
<div class="item">
<p class="total m-b-10">题库</p>
<ul class="filter">
<li class="m-b-10">
<label>题库分类</label>
<el-cascader style="width: 240px;" placeholder="请选择题库分类" v-model="quesBankTypeVal"
:options="quesBankTypes" :props="{ value: 'id', label: 'name', checkStrictly: true }" clearable
@change="initQuesBank"></el-cascader>
</li>
<li>
<el-input placeholder="请输入题库名称" prefix-icon="el-icon-search" v-model="quesBankKeyword" clearable />
</li>
</ul>
<template v-if="quesBanks.length">
<div class="line">
<span class="serial first">序号</span>
<span>题库名称</span>
</div>
<div class="able-check lines"> <template v-if="quesBanks.length">
<div v-for="(item, i) in quesBanks" :key="i" :class="['line', { active: curQuesBank.id === item.id }]" <div class="line">
@click="questionBankClick(item)"> <span class="serial first">序号</span>
<span class="serial first">{{ i + 1 }}</span> <span>题库名称</span>
<p class="stem" :title="item.questionBankName">{{ item.questionBankName }}</p>
</div>
</div>
</template>
<div v-else class="empty">
<img class="icon" src="@/assets/images/empty.svg" alt="">
<p>暂无数据</p>
</div> </div>
</div>
<!-- 知识点 -->
<div class="item">
<p class="total m-b-10">知识点</p>
<ul class="filter">
<li class="m-b-10">
<label>知识点框架</label>
<el-cascader style="width: 240px;" placeholder="请选择知识点分类" v-model="knowledgeTypeVal"
:options="knowledgeTypes" :props="{ value: 'id', label: 'name', checkStrictly: true }" clearable
@change="getKnowledge"></el-cascader>
</li>
<li>
<el-input placeholder="请输入知识点名称" prefix-icon="el-icon-search" v-model="knowledgeKeyword" clearable />
</li>
</ul>
<template v-if="knowledges.length">
<div class="line">
<el-checkbox v-model="knowledgeCheck" @change="knowledgeAllCheckChange"></el-checkbox>
<span class="serial">序号</span>
<span>知识点名称</span>
</div>
<div class="lines"> <div class="able-check lines">
<div v-for="(item, i) in knowledges" :key="i" class="line"> <div v-for="(item, i) in quesBanks" :key="i" :class="['line', { active: curQuesBank.id === item.id }]"
<el-checkbox v-model="item.check" :disabled="item.disabled" @click="questionBankClick(item)">
@change="val => knowledgeChange(val, item)"></el-checkbox> <span class="serial first">{{ i + 1 }}</span>
<span class="serial">{{ i + 1 }}</span> <p class="stem" :title="item.questionBankName">{{ item.questionBankName }}</p>
<p class="stem" :title="item.name">{{ item.name }}</p>
</div>
</div> </div>
</template>
<div v-else class="empty">
<img class="icon" src="@/assets/images/empty.svg" alt="">
<p>暂无数据</p>
</div> </div>
</template>
<div v-else class="empty">
<img class="icon" src="@/assets/images/empty.svg" alt="">
<p>暂无数据</p>
</div> </div>
<!-- 已选知识点 --> </div>
<div class="item"> <!-- 知识点 -->
<div class="flex j-between a-center m-b-20"> <div class="item">
<p class="total m-b-10">已选知识点{{ allKnowledges.length }}</p> <p class="total m-b-10">知识点</p>
<p class="clear" @click="clearChecked"> <ul class="filter">
<i class="el-icon-delete m-r-5"></i> <li class="m-b-10">
清空 <label>知识点框架</label>
</p> <el-cascader style="width: 240px;" placeholder="请选择知识点分类" v-model="knowledgeTypeVal"
:options="knowledgeTypes" :props="{ value: 'id', label: 'name', checkStrictly: true }" clearable
@change="getKnowledge"></el-cascader>
</li>
<li>
<el-input placeholder="请输入知识点名称" prefix-icon="el-icon-search" v-model="knowledgeKeyword" clearable />
</li>
</ul>
<template v-if="knowledges.length">
<div class="line">
<el-checkbox v-model="knowledgeCheck" @change="knowledgeAllCheckChange"></el-checkbox>
<span class="serial">序号</span>
<span>知识点名称</span>
</div> </div>
<template v-for="(item, i) in checked"> <div class="lines">
<div :key="i" class="j-between m-b-10"> <div v-for="(item, i) in knowledges" :key="i" class="line">
<div class="flex a-center"> <el-checkbox v-model="item.check" :disabled="item.disabled"
题库{{ item.quesBank.questionBankName }} @change="val => knowledgeChange(val, item)"></el-checkbox>
<i class="el-icon-delete action-icon m-l-10" @click="delQuesBank(i)"></i> <span class="serial">{{ i + 1 }}</span>
</div> <p class="stem" :title="item.name">{{ item.name }}</p>
<div class="knowledges">
<el-tag v-for="(tag, j) in item.knowledges" :key="tag.name" class="m-r-8 m-b-8" closable
@close="delKnowledge(i, j, item, tag)">{{ tag.name }}</el-tag>
</div>
</div> </div>
</template> </div>
</template>
<div v-else class="empty">
<img class="icon" src="@/assets/images/empty.svg" alt="">
<p>暂无数据</p>
</div> </div>
</div> </div>
<!-- 已选知识点 -->
<div class="item">
<div class="flex j-between a-center m-b-20">
<p class="total m-b-10">已选知识点{{ allKnowledges.length }}</p>
<p class="clear" @click="clearChecked">
<i class="el-icon-delete m-r-5"></i>
清空
</p>
</div>
<h6 class="page-name m-t-20">年份设置</h6> <template v-for="(item, i) in checked">
<div class="years flex"> <div :key="i" class="j-between m-b-10">
<el-checkbox style="margin-right: 20px" v-model="yearAll" @change="yearAllChange">全选</el-checkbox> <div class="flex a-center">
<el-checkbox-group v-model="yearCheck" @change="yearChange"> 题库{{ item.quesBank.questionBankName }}
<el-checkbox v-for="(item, i) in years" :key="i" :label="item"></el-checkbox> <i class="el-icon-delete action-icon m-l-10" @click="delQuesBank(i)"></i>
</el-checkbox-group> </div>
<div class="knowledges">
<el-tag v-for="(tag, j) in item.knowledges" :key="tag.name" class="m-r-8 m-b-8" closable
@close="delKnowledge(i, j, item, tag)">{{ tag.name }}</el-tag>
</div>
</div>
</template>
</div> </div>
</div> </div>
<div class="btns"> <h6 class="page-name m-t-20">年份设置</h6>
<el-button @click="quesVisible = false">取消</el-button> <div class="years flex">
<el-button type="primary" :loading="submiting" @click="submit">自动选题</el-button> <el-checkbox style="margin-right: 20px" v-model="yearAll" @change="yearAllChange">全选</el-checkbox>
<el-checkbox-group v-model="yearCheck" @change="yearChange">
<el-checkbox v-for="(item, i) in years" :key="i" :label="item"></el-checkbox>
</el-checkbox-group>
</div> </div>
</el-drawer> </div>
</div>
<div class="btns">
<el-button @click="quesVisible = false">取消</el-button>
<el-button type="primary" :loading="submiting" @click="submit">自动选题</el-button>
</div>
</el-drawer>
</template> </template>
<script> <script>
import Setting from '@/setting' import Setting from '@/setting'
@ -438,44 +436,46 @@ export default {
// //
difficultChange (val) { difficultChange (val) {
const difficultyWeights = [0.2, 0.4, 0.6, 0.8] if (val) {
const names = ['basicDifficulty', 'normalDifficulty', 'hardDifficulty', 'veryHardDifficulty'] const difficultyWeights = [0.2, 0.4, 0.6, 0.8]
// const names = ['basicDifficulty', 'normalDifficulty', 'hardDifficulty', 'veryHardDifficulty']
this.list.forEach(e => { //
const total = e.questionNum this.list.forEach(e => {
const total = e.questionNum
let already = 0 //
if (val === 1) { let already = 0 //
this.$set(e, 'basicDifficulty', Math.floor(total * 0.7)) if (val === 1) {
this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) this.$set(e, 'basicDifficulty', Math.floor(total * 0.7))
this.$set(e, 'hardDifficulty', 0) this.$set(e, 'normalDifficulty', Math.floor(total * 0.3))
this.$set(e, 'veryHardDifficulty', 0) this.$set(e, 'hardDifficulty', 0)
} else if (val === 2) { this.$set(e, 'veryHardDifficulty', 0)
this.$set(e, 'basicDifficulty', Math.floor(total * 0.45)) } else if (val === 2) {
this.$set(e, 'normalDifficulty', Math.floor(total * 0.55)) this.$set(e, 'basicDifficulty', Math.floor(total * 0.45))
this.$set(e, 'hardDifficulty', 0) this.$set(e, 'normalDifficulty', Math.floor(total * 0.55))
this.$set(e, 'veryHardDifficulty', 0) this.$set(e, 'hardDifficulty', 0)
} else if (val === 3) { this.$set(e, 'veryHardDifficulty', 0)
this.$set(e, 'basicDifficulty', Math.floor(total * 0.3)) } else if (val === 3) {
this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) this.$set(e, 'basicDifficulty', Math.floor(total * 0.3))
this.$set(e, 'hardDifficulty', Math.floor(total * 0.4)) this.$set(e, 'normalDifficulty', Math.floor(total * 0.3))
this.$set(e, 'veryHardDifficulty', 0) this.$set(e, 'hardDifficulty', Math.floor(total * 0.4))
} else if (val === 4) { this.$set(e, 'veryHardDifficulty', 0)
this.$set(e, 'basicDifficulty', Math.floor(total * 0.1)) } else if (val === 4) {
this.$set(e, 'normalDifficulty', Math.floor(total * 0.1)) this.$set(e, 'basicDifficulty', Math.floor(total * 0.1))
this.$set(e, 'hardDifficulty', Math.floor(total * 0.3)) this.$set(e, 'normalDifficulty', Math.floor(total * 0.1))
this.$set(e, 'veryHardDifficulty', Math.floor(total * 0.5)) this.$set(e, 'hardDifficulty', Math.floor(total * 0.3))
} this.$set(e, 'veryHardDifficulty', Math.floor(total * 0.5))
}
already = Decimal(already).add(e.basicDifficulty).add(e.normalDifficulty).add(e.hardDifficulty).add(e.veryHardDifficulty).toNumber() already = Decimal(already).add(e.basicDifficulty).add(e.normalDifficulty).add(e.hardDifficulty).add(e.veryHardDifficulty).toNumber()
// //
while (total > already) { while (total > already) {
e[names[val - 1]]++ e[names[val - 1]]++
already++ already++
} }
this.$set(e, 'randomDifficulty', 0) this.$set(e, 'randomDifficulty', 0)
}) })
}
}, },
// //
yearAllChange (val) { yearAllChange (val) {
@ -488,7 +488,7 @@ export default {
// //
async submit () { async submit () {
if (this.submiting) return false if (this.submiting) return false
const { list } = this const { list, checked } = this
let invalid = 0 let invalid = 0
let totalCount = 0 let totalCount = 0
for (const i in list) { for (const i in list) {
@ -540,6 +540,7 @@ export default {
list.map(e => { list.map(e => {
e.givenYears = years e.givenYears = years
e.knowledgePointsIds = k e.knowledgePointsIds = k
e.questionBankIds = checked.map(n => n.quesBank.id)
}) })
try { try {
const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list) const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list)

@ -921,12 +921,12 @@ export default {
invalid = 1 invalid = 1
break break
} }
if (!e.questionNum) { if (e.questionNum === '') {
Util.warningMsg('请输入目标题数') Util.warningMsg('请输入目标题数')
invalid = 1 invalid = 1
break break
} }
if (!e.targetScore) { if (e.targetScore === '') {
Util.warningMsg('请输入目标分值') Util.warningMsg('请输入目标分值')
invalid = 1 invalid = 1
break break

@ -495,4 +495,9 @@
list-style-type: disc; list-style-type: disc;
} }
} }
}
.el-drawer__header > :first-child {
font-size: 16px;
font-weight: 600;
color: #333;
} }
Loading…
Cancel
Save