|
|
|
@ -1,188 +1,186 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-drawer title="自动选题" :visible.sync="quesVisible" size="1200px" :close-on-click-modal="false" |
|
|
|
|
custom-class="ques-dia" @closed="closeDia"> |
|
|
|
|
<div class="overflow"> |
|
|
|
|
<h6 class="page-name">难度设置</h6> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<el-drawer title="自动选题" :visible.sync="quesVisible" size="1200px" :close-on-click-modal="false" |
|
|
|
|
custom-class="ques-dia" @closed="closeDia"> |
|
|
|
|
<div class="overflow"> |
|
|
|
|
<h6 class="page-name">难度设置</h6> |
|
|
|
|
<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>简单:系数 <=0.3</p> |
|
|
|
|
<p>普通:0.3<系数<=0.4</p> |
|
|
|
|
<p>较难:0.4<系数<0.5</p> |
|
|
|
|
<p>困难:系数>=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"> |
|
|
|
|
<li style="margin-right: 10px"> |
|
|
|
|
<label>试卷难度</label> |
|
|
|
|
<el-select v-model="difficult" placeholder="请选择试卷难度" @change="difficultChange"> |
|
|
|
|
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<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> |
|
|
|
|
<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>简单:系数 <=0.3</p> |
|
|
|
|
<p>普通:0.3<系数<=0.4</p> |
|
|
|
|
<p>较难:0.4<系数<0.5</p> |
|
|
|
|
<p>困难:系数>=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"> |
|
|
|
|
<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"> |
|
|
|
|
<div v-for="(item, i) in quesBanks" :key="i" :class="['line', { active: curQuesBank.id === item.id }]" |
|
|
|
|
@click="questionBankClick(item)"> |
|
|
|
|
<span class="serial first">{{ i + 1 }}</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> |
|
|
|
|
<template v-if="quesBanks.length"> |
|
|
|
|
<div class="line"> |
|
|
|
|
<span class="serial first">序号</span> |
|
|
|
|
<span>题库名称</span> |
|
|
|
|
</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 v-for="(item, i) in knowledges" :key="i" class="line"> |
|
|
|
|
<el-checkbox v-model="item.check" :disabled="item.disabled" |
|
|
|
|
@change="val => knowledgeChange(val, item)"></el-checkbox> |
|
|
|
|
<span class="serial">{{ i + 1 }}</span> |
|
|
|
|
<p class="stem" :title="item.name">{{ item.name }}</p> |
|
|
|
|
</div> |
|
|
|
|
<div class="able-check lines"> |
|
|
|
|
<div v-for="(item, i) in quesBanks" :key="i" :class="['line', { active: curQuesBank.id === item.id }]" |
|
|
|
|
@click="questionBankClick(item)"> |
|
|
|
|
<span class="serial first">{{ i + 1 }}</span> |
|
|
|
|
<p class="stem" :title="item.questionBankName">{{ item.questionBankName }}</p> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<div v-else class="empty"> |
|
|
|
|
<img class="icon" src="@/assets/images/empty.svg" alt=""> |
|
|
|
|
<p>暂无数据</p> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<div v-else class="empty"> |
|
|
|
|
<img class="icon" src="@/assets/images/empty.svg" alt=""> |
|
|
|
|
<p>暂无数据</p> |
|
|
|
|
</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> |
|
|
|
|
<!-- 知识点 --> |
|
|
|
|
<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> |
|
|
|
|
|
|
|
|
|
<template v-for="(item, i) in checked"> |
|
|
|
|
<div :key="i" class="j-between m-b-10"> |
|
|
|
|
<div class="flex a-center"> |
|
|
|
|
题库:{{ item.quesBank.questionBankName }} |
|
|
|
|
<i class="el-icon-delete action-icon m-l-10" @click="delQuesBank(i)"></i> |
|
|
|
|
</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 class="lines"> |
|
|
|
|
<div v-for="(item, i) in knowledges" :key="i" class="line"> |
|
|
|
|
<el-checkbox v-model="item.check" :disabled="item.disabled" |
|
|
|
|
@change="val => knowledgeChange(val, item)"></el-checkbox> |
|
|
|
|
<span class="serial">{{ i + 1 }}</span> |
|
|
|
|
<p class="stem" :title="item.name">{{ item.name }}</p> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<div v-else class="empty"> |
|
|
|
|
<img class="icon" src="@/assets/images/empty.svg" alt=""> |
|
|
|
|
<p>暂无数据</p> |
|
|
|
|
</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> |
|
|
|
|
<div class="years flex"> |
|
|
|
|
<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> |
|
|
|
|
<template v-for="(item, i) in checked"> |
|
|
|
|
<div :key="i" class="j-between m-b-10"> |
|
|
|
|
<div class="flex a-center"> |
|
|
|
|
题库:{{ item.quesBank.questionBankName }} |
|
|
|
|
<i class="el-icon-delete action-icon m-l-10" @click="delQuesBank(i)"></i> |
|
|
|
|
</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 class="btns"> |
|
|
|
|
<el-button @click="quesVisible = false">取消</el-button> |
|
|
|
|
<el-button type="primary" :loading="submiting" @click="submit">自动选题</el-button> |
|
|
|
|
<h6 class="page-name m-t-20">年份设置</h6> |
|
|
|
|
<div class="years flex"> |
|
|
|
|
<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> |
|
|
|
|
</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> |
|
|
|
|
<script> |
|
|
|
|
import Setting from '@/setting' |
|
|
|
@ -438,44 +436,46 @@ export default { |
|
|
|
|
|
|
|
|
|
// 试卷难度选择回调 |
|
|
|
|
difficultChange (val) { |
|
|
|
|
const difficultyWeights = [0.2, 0.4, 0.6, 0.8] |
|
|
|
|
const names = ['basicDifficulty', 'normalDifficulty', 'hardDifficulty', 'veryHardDifficulty'] |
|
|
|
|
// 遍历题型数组 |
|
|
|
|
this.list.forEach(e => { |
|
|
|
|
const total = e.questionNum |
|
|
|
|
|
|
|
|
|
let already = 0 // 已经分配的数量 |
|
|
|
|
if (val === 1) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.7)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'hardDifficulty', 0) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', 0) |
|
|
|
|
} else if (val === 2) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.45)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.55)) |
|
|
|
|
this.$set(e, 'hardDifficulty', 0) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', 0) |
|
|
|
|
} else if (val === 3) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'hardDifficulty', Math.floor(total * 0.4)) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', 0) |
|
|
|
|
} else if (val === 4) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.1)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.1)) |
|
|
|
|
this.$set(e, 'hardDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', Math.floor(total * 0.5)) |
|
|
|
|
} |
|
|
|
|
if (val) { |
|
|
|
|
const difficultyWeights = [0.2, 0.4, 0.6, 0.8] |
|
|
|
|
const names = ['basicDifficulty', 'normalDifficulty', 'hardDifficulty', 'veryHardDifficulty'] |
|
|
|
|
// 遍历题型数组 |
|
|
|
|
this.list.forEach(e => { |
|
|
|
|
const total = e.questionNum |
|
|
|
|
|
|
|
|
|
let already = 0 // 已经分配的数量 |
|
|
|
|
if (val === 1) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.7)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'hardDifficulty', 0) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', 0) |
|
|
|
|
} else if (val === 2) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.45)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.55)) |
|
|
|
|
this.$set(e, 'hardDifficulty', 0) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', 0) |
|
|
|
|
} else if (val === 3) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) |
|
|
|
|
this.$set(e, 'hardDifficulty', Math.floor(total * 0.4)) |
|
|
|
|
this.$set(e, 'veryHardDifficulty', 0) |
|
|
|
|
} else if (val === 4) { |
|
|
|
|
this.$set(e, 'basicDifficulty', Math.floor(total * 0.1)) |
|
|
|
|
this.$set(e, 'normalDifficulty', Math.floor(total * 0.1)) |
|
|
|
|
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() |
|
|
|
|
// 如果按比例分配还没分配完 |
|
|
|
|
while (total > already) { |
|
|
|
|
e[names[val - 1]]++ |
|
|
|
|
already++ |
|
|
|
|
} |
|
|
|
|
this.$set(e, 'randomDifficulty', 0) |
|
|
|
|
}) |
|
|
|
|
already = Decimal(already).add(e.basicDifficulty).add(e.normalDifficulty).add(e.hardDifficulty).add(e.veryHardDifficulty).toNumber() |
|
|
|
|
// 如果按比例分配还没分配完 |
|
|
|
|
while (total > already) { |
|
|
|
|
e[names[val - 1]]++ |
|
|
|
|
already++ |
|
|
|
|
} |
|
|
|
|
this.$set(e, 'randomDifficulty', 0) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 年份全选回调 |
|
|
|
|
yearAllChange (val) { |
|
|
|
@ -488,7 +488,7 @@ export default { |
|
|
|
|
// 提交 |
|
|
|
|
async submit () { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const { list } = this |
|
|
|
|
const { list, checked } = this |
|
|
|
|
let invalid = 0 |
|
|
|
|
let totalCount = 0 |
|
|
|
|
for (const i in list) { |
|
|
|
@ -540,6 +540,7 @@ export default { |
|
|
|
|
list.map(e => { |
|
|
|
|
e.givenYears = years |
|
|
|
|
e.knowledgePointsIds = k |
|
|
|
|
e.questionBankIds = checked.map(n => n.quesBank.id) |
|
|
|
|
}) |
|
|
|
|
try { |
|
|
|
|
const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list) |
|
|
|
|