diff --git a/src/api/index.js b/src/api/index.js
index 1b05e92..652bad8 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -39,6 +39,7 @@ export default {
paperLibrarySave: `/exam/exam/paperLibrary/save`,
paperLibraryUpdate: `/exam/exam/paperLibrary/update`,
paperLibraryDisable: `/exam/exam/paperLibrary/updateStatus`,
+ copyExamPaperLibrary: `/exam/exam/paperLibrary/copyExamPaperLibrary`,
examClassificationDel: `/exam/exam/classification/delete`,
examClassificationSave: `/exam/exam/classification/save`,
diff --git a/src/libs/util.js b/src/libs/util.js
index be34c9f..f4e8302 100644
--- a/src/libs/util.js
+++ b/src/libs/util.js
@@ -176,6 +176,13 @@ const util = {
resolve(new Date(data.currentTime))
})
},
+ getUuid () {
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+ var r = Math.random() * 16 | 0,
+ v = c == 'x' ? r : (r & 0x3 | 0x8);
+ return v.toString(16);
+ })
+ }
};
export default util;
\ No newline at end of file
diff --git a/src/pages/ques/detail/index.vue b/src/pages/ques/detail/index.vue
index 975024a..1facd49 100644
--- a/src/pages/ques/detail/index.vue
+++ b/src/pages/ques/detail/index.vue
@@ -4,7 +4,7 @@
试题
+ label-width="110px" :disabled="isDisabled">
@@ -13,7 +13,8 @@
@change="getQuesBank">
-
+
@@ -90,7 +91,7 @@
optReady(editor, item)" />
-
+
@@ -179,17 +180,18 @@
@click="submit(0)">保存
保存
- {{ questionId ? '保存并同步更新相似题'
- :
- '保存并继续新增' }}
+ {{
+ questionId ? '保存并同步更新相似题'
+ :
+ '保存并继续新增' }}
{{ detailType !== 2 ? '取消' : '返回' }}
-
-
+
+
系统已经识别出题库中有与本题相似的其他题目。如果您选择同步更新这些相似题目,那么所有关联的试卷将会自动更新。
@@ -197,7 +199,7 @@
-
@@ -248,7 +250,7 @@ export default {
questionBankId: this.$route.query.questionBankId, // 题库id
questionBankName: this.$route.query.questionBankName,
questionBankCategory: this.$route.query.questionBankCategory,
- detailType: +this.$route.query.detailType,
+ detailType: +this.$route.query.detailType, // 1复制(调新增接口),2查看,3编辑;paperType是试卷里弹框弹出试题时会传进来的type:1新增(需要选择题库分类及题库),2编辑,3查看
numToLetter: Util.numToLetter,
loading: false,
questionBankTypes: [],
@@ -274,7 +276,7 @@ export default {
fillBlanks: [],
uploadList: [],
form: {
- questionBankTypeId: '',
+ questionBankTypeId: [],
difficulty: '',
givenYear: new Date(),
knowledgePointIds: [],
@@ -331,6 +333,10 @@ export default {
'编辑' :
'') + '试题'
},
+ // 查看试题
+ isDisabled () {
+ return this.detailType === 2
+ },
},
mounted () {
const { query } = this.$route
@@ -374,7 +380,6 @@ export default {
const type = this.detailType
if (this.paperType === 1) {
this.getQuesBankType()
- this.getQuesBank()
} else if (!type) {
// 外面知识点树形选中的知识点默认选中到表单里(选的是知识点才需要默认选中,知识点分类不用)
const { path } = this.$route.query
@@ -392,6 +397,8 @@ export default {
// 点击了保存并继续新增则恢复题干以上的字段(不包括题干)
if (v) {
const { form, beforeSubmitForm: before } = this
+ form.questionBankTypeId = v.questionBankTypeId
+ form.questionBankId = v.questionBankId
form.difficulty = v.difficulty
form.givenYear = v.givenYear
form.knowledgePointIds = this.beforeSubmitForm.knowledgePointIds
@@ -516,16 +523,20 @@ export default {
// 获取题库列表
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
+ if (val.length) {
+ let 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
+ } else {
+ this.questionBanks = []
+ }
+ this.form.questionBankId = ''
} catch (e) { }
},
// 单选多选初始化
@@ -574,22 +585,26 @@ export default {
},
// 题干富文本加载完毕回调
stemReady (editor) {
- editor.addListener('contentChange', () => {
- this.questionItemReset(editor.getContent())
- })
+ if (this.isDisabled) {
+ editor.setDisabled()
+ } else {
+ editor.addListener('contentChange', () => {
+ this.questionItemReset(editor.getContent())
+ })
+ }
editor.setContent(this.form.stem)
},
// 解析富文本加载完毕回调
answerAnalysisReady (editor) {
- editor.setContent(this.answerAnalysis)
+ this.isDisabled ? editor.setDisabled() : editor.setContent(this.answerAnalysis)
},
// 上传说明富文本加载完毕回调
uploadInstructionsReady (editor) {
- editor.setContent(this.form.uploadInstructions)
+ this.isDisabled ? editor.setDisabled() : editor.setContent(this.form.uploadInstructions)
},
// 参考答案富文本加载完毕回调
referenceAnswerReady (editor) {
- editor.setContent(this.form.questionAnswerVersions[0].referenceAnswer)
+ this.isDisabled ? editor.setDisabled() : editor.setContent(this.form.questionAnswerVersions[0].referenceAnswer)
},
// 正确答案选择回调
correctChange (i) {
@@ -610,9 +625,11 @@ export default {
},
// 移除选项
optFocus (e) {
- const opts = this.form.questionAnswerVersions
- opts.map(n => n.focus = 0)
- e.focus = 1
+ if (!this.isDisabled) {
+ const opts = this.form.questionAnswerVersions
+ opts.map(n => n.focus = 0)
+ e.focus = 1
+ }
},
// 选项富文本加载完毕回调
optReady (editor, opt) {
@@ -766,7 +783,6 @@ export default {
const form = this.tempForm
const type = this.detailType
const paperEdit = this.curQues // 试卷里编辑试题进来的
- // type: 1复制(调新增接口),2查看,3编辑,4是试卷里点编辑试题进来的
await this.$post(this.api[type === 1 || !form.questionId ? 'addQuestion' : 'updateQuestion'], form)
paperEdit && this.$emit('updateQues', form)
diff --git a/src/pages/ques/list/index.vue b/src/pages/ques/list/index.vue
index 14b7398..9583b7a 100644
--- a/src/pages/ques/list/index.vue
+++ b/src/pages/ques/list/index.vue
@@ -107,8 +107,10 @@
{{ questionTypes.find(e => e.id === scope.row.questionType) ?
questionTypes.find(e => e.id === scope.row.questionType).name : '' }}
-
-
+
+
{{ difficults.find(e => e.id === scope.row.difficulty) ? difficults.find(e =>
@@ -534,8 +536,8 @@ export default {
async switchOff (val, row) {
try {
row.status = val ? 0 : 1 // 调接口前先还原成点击前的状态,因为有几种原因会禁用启用失败
- if (!val) {
- await this.$confirm(`确认要禁用【${row.stem}】吗?
禁用后已引用该试题的试卷将会变成草稿,再次启用后,试卷将自动发布
`, '提示', {
+ if (!val && row.referenceCount) {
+ await this.$confirm(`确认要禁用【${row.stem}】吗?
禁用后已引用该试题的试卷将会变成草稿
`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
diff --git a/src/pages/quesBankType/index.vue b/src/pages/quesBankType/index.vue
index 34d13ed..1d50993 100644
--- a/src/pages/quesBankType/index.vue
+++ b/src/pages/quesBankType/index.vue
@@ -177,17 +177,20 @@ export default {
// 分类提交
async typeSubmit () {
if (this.submiting) return false
- const { form, parentId } = this
- if (!form.name) return Util.warningMsg('请输入题库分类名称')
- this.submiting = true
- if (parentId.length) form.parentId = parentId[parentId.length - 1]
- // form.systemId = this.systemId
- form.createSource = 1
- await this.$post(this.api.categoriesSave, form)
- Util.successMsg('保存成功')
- this.typeVisible = false
- this.submiting = false
- this.getData()
+ try {
+ const { form, parentId } = this
+ if (!form.name) return Util.warningMsg('请输入题库分类名称')
+ this.submiting = true
+ if (parentId.length) form.parentId = parentId[parentId.length - 1]
+ // form.systemId = this.systemId
+ form.createSource = 1
+ await this.$post(this.api.categoriesSave, form)
+ Util.successMsg('保存成功')
+ this.typeVisible = false
+ this.getData()
+ } finally {
+ this.submiting = false
+ }
},
// 删除
del (row) {
diff --git a/src/pages/testPaper/detail/auto.vue b/src/pages/testPaper/detail/auto.vue
index 26ec91e..6d26783 100644
--- a/src/pages/testPaper/detail/auto.vue
+++ b/src/pages/testPaper/detail/auto.vue
@@ -260,10 +260,10 @@ export default {
methods: {
// 初始化
init () {
+ this.handleQuesList()
if (!this.loaded) {
this.loaded = 1
this.yearCheck = this.years
- this.handleQuesList()
this.getQuesBankType()
this.initQuesBank()
this.difficult = this.$parent.form.difficult
@@ -393,6 +393,7 @@ export default {
// 处理大纲列表
handleQuesList () {
this.list = _.cloneDeep(this.$parent.form.paperOutline)
+ console.log("🚀 ~ handleQuesList ~ this.list:", this.list)
},
// 清空已选
async clearChecked () {
@@ -507,13 +508,15 @@ export default {
let total = Decimal(e.basicDifficulty || 0).add(e.normalDifficulty || 0).add(e.hardDifficulty || 0).add(e.veryHardDifficulty || 0).toNumber() // 先算前4个难度的题数
if (total) { // 前面4个空有填1个,则清空随机
this.$set(e, 'randomDifficulty', 0)
+ } else {
+ total = +e.randomDifficulty || 0
}
+
if (total > e.questionNum) {
Util.warningMsg(`${name}的小题总数大于目标题数,请重新输入`)
invalid = 1
break
}
- total = Decimal(total).add(e.randomDifficulty || 0).toNumber()
e.count = total
totalCount = Decimal(totalCount).add(total).toNumber()
}
@@ -536,7 +539,6 @@ export default {
}
})
list.map(e => {
- // e.randomDifficulty = 0
e.givenYears = years
e.knowledgePointsIds = k
})
diff --git a/src/pages/testPaper/detail/index.vue b/src/pages/testPaper/detail/index.vue
index 9e54075..6e009d2 100644
--- a/src/pages/testPaper/detail/index.vue
+++ b/src/pages/testPaper/detail/index.vue
@@ -155,15 +155,15 @@
(分)
-
-
+
+
每空分值
分 填空项{{ k + 1 }}
建议分值占比:{{
+ v-if="ques.answerData && ques.answerData.length && ques.answerData[k] && ques.answerData[k].scoreProportion != 0"> 建议分值占比:{{
ques.answerData[k].scoreProportion }}%
@@ -171,7 +171,7 @@
查看每空分值
- 编辑试题
+ 编辑试题
更换试题
添加试题
移除试题
@@ -223,33 +223,29 @@
-
-
-
-
-
-
- 大题 |
- 已添加题数/目标题数 |
- 已分配分值/目标分值 |
-
-
-
-
- 第{{ arabicToChinese(i + 1) }}大题 |
- {{ item.examQuestions.length }}/{{ item.questionNum }} |
- {{ item.examQuestions.reduce((e, j) => (e += +j.score), 0) || 0 }}/{{ item.targetScore }} |
-
-
- 总计 |
- {{ overview.alreadyQuesCount }}/{{ overview.questionCount }} |
- {{ overview.alreadyScore }}/{{ overview.totalScore }} |
-
-
-
-
-
-
+
+
+
+
+ 大题 |
+ 已添加题数/目标题数 |
+ 已分配分值/目标分值 |
+
+
+
+
+ 第{{ arabicToChinese(i + 1) }}大题 |
+ {{ item.examQuestions.length }}/{{ item.questionNum }} |
+ {{ item.examQuestions.reduce((e, j) => (e += +j.score), 0) || 0 }}/{{ item.targetScore }} |
+
+
+ 总计 |
+ {{ overview.alreadyQuesCount }}/{{ overview.questionCount }} |
+ {{ overview.alreadyScore }}/{{ overview.totalScore }} |
+
+
+
+
@@ -265,7 +261,6 @@
@@ -1270,6 +1306,7 @@ export default {
background-color: #fff;
box-shadow: 0 0 7px rgba(235, 235, 235, .8);
overflow: auto;
+ cursor: move;
.table {
text-align: center;
diff --git a/src/pages/testPaper/detail/repeatQues.vue b/src/pages/testPaper/detail/repeatQues.vue
index 2744a32..9fd9d9a 100644
--- a/src/pages/testPaper/detail/repeatQues.vue
+++ b/src/pages/testPaper/detail/repeatQues.vue
@@ -3,7 +3,7 @@
:show-close="false" custom-class="ques-dia" @closed="closeDia">
-
+
@@ -65,7 +65,11 @@ export default {
closeOnClickModal: false,
})
this.$parent.delQues(this.$parent.form.paperOutline[row.paperIndex], row.quesIndex, 1)
- this.data.splice(i, 1)
+
+ const { data } = this
+ data.splice(i, 1)
+ data.map(e => e.repeat = false)
+ this.data = this.$parent.hasRepeatQues(data)
} catch (e) { }
},
// 替换
@@ -76,10 +80,10 @@ export default {
},
// 检查一下
async check () {
- const { list } = this
+ const { data } = this
this.$parent.form.paperOutline.map(e => {
e.examQuestions.map(n => {
- if (list.find(m => m.questionVersionId === n.questionVersionId)) this.$set(n, 'repeat', true)
+ this.$set(n, 'repeat', !!data.find(m => m.questionVersionId === n.questionVersionId))
})
})
this.$parent.submiting = false
diff --git a/src/pages/testPaperLibrary/index.vue b/src/pages/testPaperLibrary/index.vue
index 6e7d4da..35e657f 100644
--- a/src/pages/testPaperLibrary/index.vue
+++ b/src/pages/testPaperLibrary/index.vue
@@ -78,7 +78,7 @@
- 您将复制当前试卷库中的所有题目到新试卷库,请输入新试卷库名称
+ 您将复制当前试卷库中的所有试卷到新试卷库,请输入新试卷库名称