|
@@ -2,10 +2,10 @@
|
|
|
<div>
|
|
|
<el-card>
|
|
|
<mx-condition :local-data="extraData" :query-params="queryParams" :require-fields="requireFields"
|
|
|
- @query="handleQuery" use-alias-mapping></mx-condition>
|
|
|
+ :invisible-fields="invisibleFields" @query="handleQuery" use-alias-mapping/>
|
|
|
</el-card>
|
|
|
<el-container>
|
|
|
- <left-tree-side>
|
|
|
+ <left-tree-side v-if="!isCollectionBranch">
|
|
|
<span slot="title">{{ !isKnowledgeBranch ? '章节目录' : '知识点目录' }}</span>
|
|
|
<el-tree ref="branchTree" highlight-current :expand-on-click-node="false" :data="branchTree"
|
|
|
:props="treeProps" node-key="id" @node-click="handleTreeNodeClick"></el-tree>
|
|
@@ -13,7 +13,7 @@
|
|
|
<!-- 手动组卷 -->
|
|
|
<el-main style="background: #fff">
|
|
|
<!-- 头部 -->
|
|
|
- <div class="main_header">
|
|
|
+ <div class="main_header" v-if="!isCollectionBranch">
|
|
|
<div class="left">
|
|
|
<div class="main_tit">{{ title }}</div>
|
|
|
<!-- 暂不支持 -->
|
|
@@ -89,12 +89,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import consts from '@/common/mx-const'
|
|
|
+import consts from '@/common/MxConst'
|
|
|
import MxCondition from '@/components/MxCondition/mx-condition'
|
|
|
import {
|
|
|
addToQuestionCard,
|
|
|
chapterTree,
|
|
|
deleteQuestionCard,
|
|
|
+ favQuestions,
|
|
|
getQuestionCardList,
|
|
|
knowledgeTree,
|
|
|
listByChapter,
|
|
@@ -111,12 +112,13 @@ import MxQuestionReadonly from "@/components/MxQuestionReadonly/MxQuestionReadon
|
|
|
export default {
|
|
|
mixins: [PaperWorkIdentifierMixin],
|
|
|
name: 'paper-by-hand',
|
|
|
- components: {MxQuestionReadonly, LeftTreeSide, CorrectQuestionDialog, MxCondition },
|
|
|
+ components: {MxQuestionReadonly, LeftTreeSide, CorrectQuestionDialog, MxCondition},
|
|
|
data() {
|
|
|
return {
|
|
|
queryParams: null,
|
|
|
queryOutput: null,
|
|
|
requireFields: [],
|
|
|
+ invisibleFields: [],
|
|
|
chapterTree: [],
|
|
|
knowledgeTree: [],
|
|
|
treeProps: {
|
|
@@ -143,6 +145,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ isCollectionBranch() {
|
|
|
+ return this.queryParams?.exeBranch == consts.enum.questionBranches.collect.value
|
|
|
+ },
|
|
|
isKnowledgeBranch() {
|
|
|
return this.queryParams?.exeBranch == consts.enum.questionBranches.knowledge.value
|
|
|
},
|
|
@@ -160,7 +165,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- 'queryParams.exeBranch': async function(newVal, oldVal) {
|
|
|
+ 'queryParams.exeBranch': async function (newVal, oldVal) {
|
|
|
if (newVal && oldVal) {
|
|
|
// ignored first mx-condition model assign
|
|
|
await this.$nextTick()
|
|
@@ -186,6 +191,7 @@ export default {
|
|
|
if (!this.queryParams || force) {
|
|
|
const model = {}
|
|
|
model.exeBranch = this.queryParams?.exeBranch || consts.enum.questionBranches.chapter.value
|
|
|
+ this.invisibleFields = []
|
|
|
switch (model.exeBranch) {
|
|
|
case consts.enum.questionBranches.chapter.value:
|
|
|
model.exeSubject = '' // 科目
|
|
@@ -201,6 +207,13 @@ export default {
|
|
|
this.requireFields = ['exeBranch', 'exeSubject']
|
|
|
if (this.isPaperWork && !this.ignoreQType) this.requireFields.push('exeQTypeKnowledge')
|
|
|
break
|
|
|
+ case consts.enum.questionBranches.collect.value:
|
|
|
+ model.favCollectType = consts.enum.collectionType.question.type
|
|
|
+ model.favSubject = ''
|
|
|
+ model.favQueType = ''
|
|
|
+ this.requireFields = ['exeBranch', 'favSubject', 'favQueType']
|
|
|
+ this.invisibleFields = ['favCollectType']
|
|
|
+ break
|
|
|
default:
|
|
|
console.log('unexpected type for branch', model.exeBranch)
|
|
|
return
|
|
@@ -212,11 +225,12 @@ export default {
|
|
|
// temporary save & parameter check
|
|
|
this.queryOutput = model
|
|
|
delete this.queryOutput.exeBranch // 本页API调用并不需要这个参数
|
|
|
+ if (this.isCollectionBranch) return this.queryCollections()
|
|
|
if (!this.isKnowledgeBranch && !this.queryOutput.gradeId) return // 这是exeBranch条件切换时的中间状态,不要触发后续查询
|
|
|
|
|
|
// refresh tree by need
|
|
|
// TODO: 这里最好是由mx-condition解析依赖关系,但现在mx-condition的渲染逻辑不太方便切入
|
|
|
- const treeCacheObj = { ...this.queryOutput }
|
|
|
+ const treeCacheObj = {...this.queryOutput}
|
|
|
delete treeCacheObj.qtpye // 树和题型无关
|
|
|
const newTreeCacheKey = `${model.exeBranch}_${JSON.stringify(treeCacheObj)}`
|
|
|
if (newTreeCacheKey != this.treeCacheKey) {
|
|
@@ -255,6 +269,18 @@ export default {
|
|
|
this.pageNum = 1
|
|
|
this.queryQuestions()
|
|
|
},
|
|
|
+ async queryCollections() {
|
|
|
+ console.log('queryCollections', this.queryOutput)
|
|
|
+ if (!this.queryOutput.subjectName) return // 条件切换中间状态
|
|
|
+ delete this.queryOutput.collectType // favQuestions接口不需要这个参数
|
|
|
+ const res = await favQuestions({
|
|
|
+ pageNum: this.pageNum,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ ...this.queryOutput,
|
|
|
+ ...this.extraData
|
|
|
+ })
|
|
|
+ await this._renderQuestions(res)
|
|
|
+ },
|
|
|
async queryQuestions() {
|
|
|
const commit = {
|
|
|
pageNum: this.pageNum,
|
|
@@ -265,11 +291,12 @@ export default {
|
|
|
}
|
|
|
const queryFunc = this.isKnowledgeBranch ? listByKnowledge : listByChapter
|
|
|
const res = await queryFunc(commit)
|
|
|
+ await this._renderQuestions(res)
|
|
|
+ },
|
|
|
+ async _renderQuestions(res) {
|
|
|
+ res.rows.forEach(r => r.expand = false) // add reactive field before render
|
|
|
this.total = res.total
|
|
|
- this.queList = res.rows.map(r => {
|
|
|
- r.expand = false // add reactive field
|
|
|
- return r
|
|
|
- })
|
|
|
+ this.queList = res.rows
|
|
|
|
|
|
await this.$nextTick()
|
|
|
this.mxGlobal.MathQueue(this.mathId)
|