-
@@ -286,6 +287,7 @@ export default {
specialtyIds: [1],
stem: '',
allowAttachment: 0,
+ fileName: '',
stemAttachment: '',
uploadInstructions: '',
},
@@ -341,15 +343,11 @@ export default {
mounted () {
const { query } = this.$route
if (!this.paperType) {
+ const { referrer2 } = this.$store.state.user
this.crumbs = [
{
name: '试题管理',
- route: 'list',
- query: {
- questionBankId: query.questionBankId,
- questionBankName: query.questionBankName,
- questionBankCategory: query.questionBankCategory,
- }
+ route: referrer2 || 'list',
},
{
name: this.diaTitle
@@ -437,6 +435,7 @@ export default {
}) : [],
specialtyIds: r.professionalList ? r.professionalList.map(e => e.specialtyId) : [],
allowAttachment: r.allowAttachment,
+ fileName: r.fileName,
stemAttachment: r.stemAttachment,
uploadInstructions: r.uploadInstructions,
questionAnswerVersions: opts,
@@ -446,10 +445,10 @@ export default {
this.fillBlanks = opts[0].answerData ? JSON.parse(opts[0].answerData) : []
// 题干文件
- const file = r.allowAttachment
+ const file = r.stemAttachment
if (file) {
this.uploadList = [{
- name: file,
+ name: r.fileName || file,
url: file
}]
}
@@ -553,6 +552,7 @@ export default {
},
// 题型选择回调
questionTypeChange (val) {
+ const { form } = this
// 判断题
if (val === 'judgement') {
const opts = []
@@ -564,21 +564,22 @@ export default {
opts[0].answerIsCorrect = 1
opts[0].optionText = '正确'
opts[1].optionText = '错误'
- this.form.questionAnswerVersions = opts
+ form.questionAnswerVersions = opts
} else if (val === 'fill_blank') {
// 填空题
const opt = _.cloneDeep(this.originOpt)
opt.gradingStandard = 'exact_match'
- this.form.questionAnswerVersions = [opt]
+ form.questionAnswerVersions = [opt]
} else if (val === 'essay') {
// 简答题
const opt = _.cloneDeep(this.originOpt)
opt.gradingStandard = 'manual'
opt.referenceAnswer = ''
- this.form.allowAttachment = 0
- this.form.stemAttachment = ''
- this.form.uploadInstructions = ''
- this.form.questionAnswerVersions = [opt]
+ form.allowAttachment = 0
+ form.fileName = ''
+ form.stemAttachment = ''
+ form.uploadInstructions = ''
+ form.questionAnswerVersions = [opt]
} else {
this.handleSingleMultiple()
}
@@ -645,6 +646,7 @@ export default {
let spanRegex = new RegExp('
(.*?)______(.*?)<\\/span>', 'g')
let newFormItem = []
let gapfillingItems = content.match(spanRegex)
+ console.log("🚀 ~ questionItemReset ~ gapfillingItems:", gapfillingItems)
if (gapfillingItems !== null) {
gapfillingItems.forEach(function (span, index) {
let pairRegex = /(.*?)______(.*?)<\/span>/
@@ -669,9 +671,11 @@ export default {
},
handleRemove () {
Oss.del(this.form.stemAttachment)
+ this.form.fileName = ''
this.form.stemAttachment = ''
},
uploadSuccess (file) {
+ this.form.fileName = file.name
this.form.stemAttachment = file.url
},
handleSelectionChange (val) {
@@ -706,7 +710,8 @@ export default {
if (invalid) return false
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案')
} else if (form.questionType === 'fill_blank') {
- let scorePro = 0
+ let scorePro = 0 // 分值占比总和
+ let filledPro = 0 // 已填写的分值占比数量
for (const e of blanks) {
if (e.fills.every(n => !n.val)) {
Util.warningMsg('请输入填空项正确答案')
@@ -714,9 +719,13 @@ export default {
break
}
const pro = e.scoreProportion
- if (pro && !isNaN(pro)) scorePro = Decimal(scorePro).add(pro || 0).toNumber()
+ if (pro && !isNaN(pro)) {
+ filledPro++
+ scorePro = Decimal(scorePro).add(pro || 0).toNumber()
+ }
}
- if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比不满100,请重新调整')
+ if (filledPro && blanks.length !== filledPro) return Util.warningMsg('分值占比未填写完成')
+ if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比总和需等于100,请重新调整')
}
this.submiting = true
@@ -798,7 +807,7 @@ export default {
// 从试卷里进来的,则直接关闭弹框
this.$emit('closeAdd')
} else {
- this.$router.back()
+ this.questionId ? this.$router.push(this.$store.state.user.referrer2 || 'list') : this.$router.back()
}
},
}
@@ -864,7 +873,8 @@ export default {
}
&:first-child,
- &:last-child {
+ &:last-child,
+ &.isDisabled {
.el-textarea {
width: calc(100% - 52px);
}
diff --git a/src/pages/ques/list/index.vue b/src/pages/ques/list/index.vue
index 9583b7a..787570e 100644
--- a/src/pages/ques/list/index.vue
+++ b/src/pages/ques/list/index.vue
@@ -208,6 +208,7 @@ import Setting from '@/setting'
import Breadcrumb from '@/components/breadcrumb'
import Detail from '../detail'
import Const from '@/const/ques'
+import Qs from 'qs'
export default {
components: { Breadcrumb, Detail },
data () {
@@ -254,7 +255,7 @@ export default {
referenceCountSort: '',
},
list: [],
- page: 1,
+ page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
@@ -296,15 +297,42 @@ export default {
},
},
mounted () {
+ const { referrer1 } = this.$store.state.user
+ console.log("🚀 ~ mounted ~ referrer1:", this.$route.query.questionTypes)
this.crumbs = [
{
name: this.questionBankName || '题库管理',
- route: '/quesBank'
+ route: referrer1 || '/quesBank'
},
{
name: '试题管理'
},
]
+
+ const { query } = this.$route
+ if (query.page) {
+ const { questionTypes, correctRateEnd, correctRateStart, difficultys, specialtyIds, status, keyword, questionTypeSort, givenYearSort, difficultySort, correctRateSort, updateTimeSort, referenceCountSort, givenYears, knowledgePointIds, questionBankId, questionBankName, questionBankCategory } = query
+ this.filter = {
+ questionTypes: questionTypes ? questionTypes.split(',') : [],
+ correctRateEnd: correctRateEnd || '',
+ correctRateStart: correctRateStart || '',
+ difficultys: difficultys ? difficultys.split(',') : [],
+ specialtyIds: specialtyIds ? specialtyIds.split(',').map(e => +e) : [],
+ status: status ? +status : '',
+ keyword: keyword || '',
+ questionTypeSort: questionTypeSort || '',
+ givenYearSort: givenYearSort || '',
+ difficultySort: difficultySort || '',
+ correctRateSort: correctRateSort || '',
+ updateTimeSort: updateTimeSort || '',
+ referenceCountSort: referenceCountSort || '',
+ }
+ this.givenYears = givenYears || ''
+ this.knowledgePointIds = knowledgePointIds ? JSON.parse(knowledgePointIds) : []
+
+ this.$router.push(`/ques?questionBankId=${questionBankId}&questionBankName=${questionBankName}&questionBankCategory=${questionBankCategory}`).catch(() => { })
+ }
+
this.getType()
this.getProfessional()
this.getKnowledge()
@@ -327,11 +355,20 @@ export default {
},
// 前往知识点
toSet () {
+ this.setReferrer()
this.$router.push({
path: '/knowledge',
query: this.$route.query
})
},
+ // 缓存当前页面和参数,详情页返回到列表的时候直接取该url
+ setReferrer () {
+ const { filter } = this
+ this.$store.commit('user/setReferrer', {
+ i: 2,
+ url: `${this.$route.path}?${Qs.stringify(filter)}&${Qs.stringify(this.$route.query)}&questionTypes=${filter.questionTypes}&difficultys=${filter.difficultys}&specialtyIds=${filter.specialtyIds}&givenYears=${this.givenYears}&knowledgePointIds=${JSON.stringify(this.knowledgePointIds)}&page=${this.page}`
+ })
+ },
// 类型回调
typeChange () {
this.$refs.typeTree.setCurrentKey(null)
@@ -429,6 +466,7 @@ export default {
// 添加
add () {
+ this.setReferrer()
const knowledgeCheck = this.$refs.typeTree.getCurrentNode()
this.$router.push({
path: 'detail',
@@ -440,6 +478,7 @@ export default {
},
// 编辑/查看 type: 1复制,2查看,3编辑
toDetail (row, type) {
+ this.setReferrer()
this.$router.push({
path: 'detail',
query: {
diff --git a/src/pages/quesBank/index.vue b/src/pages/quesBank/index.vue
index 9d379ac..dce20a7 100644
--- a/src/pages/quesBank/index.vue
+++ b/src/pages/quesBank/index.vue
@@ -101,6 +101,7 @@