yujialong 3 months ago
parent 68ac297cc9
commit 032c20ce80
  1. 12
      src/pages/ques/detail/index.vue
  2. 4
      src/pages/ques/list/batchImport.vue
  3. 34
      src/pages/testPaper/detail/index.vue

@ -649,7 +649,7 @@ export default {
if (gapfillingItems !== null) {
gapfillingItems.forEach(function (span, index) {
let pairRegex = /<span class="gapfilling-span" data-id="(.*?)">(.*?)______(.*?)<\/span>/
if (span.includes('data-id')) pairRegex = /<span class="gapfilling-span" (.*?)">(.*?)______(.*?)<\/span>/
// if (span.includes('data-id')) pairRegex = /<span class="gapfilling-span" (.*?)">(.*?)______(.*?)<\/span>/
pairRegex.test(span)
newFormItem.push({ fills: [{ val: '' }], uuid: RegExp.$1, scoreProportion: '' })
})
@ -712,17 +712,23 @@ export default {
let scorePro = 0 //
let filledPro = 0 //
for (const e of blanks) {
if (e.fills.every(n => !n.val)) {
if (!e.fills.some(n => n.val)) {
Util.warningMsg('请输入填空项正确答案')
invalid = 1
break
}
const pro = e.scoreProportion
if (pro && !isNaN(pro)) {
if (pro) {
if (isNaN(pro)) {
Util.warningMsg('分值占比请输入数字')
invalid = 1
break
} else {
filledPro++
scorePro = Decimal(scorePro).add(pro || 0).toNumber()
}
}
}
if (filledPro && blanks.length !== filledPro) return Util.warningMsg('分值占比未填写完成')
if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比总和需等于100,请重新调整')
}

@ -90,7 +90,7 @@ export default {
Util.downloadFileDirect('批量导入试题模板.xlsx', new Blob([res.data]))
},
//
handleExceed (files, fileList) {
handleExceed () {
Util.warningMsg(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
)
@ -113,7 +113,7 @@ export default {
Util.errorMsg(message || '上传失败,请检查数据', 3000)
}
},
uploadError (err, file, fileList) {
uploadError () {
this.uploading = false
this.$message({
message: "上传出错,请重试!",

@ -419,16 +419,15 @@ export default {
let totalScore = 0
let alreadyScore = 0
paper.forEach(e => {
questionCount += +e.questionNum //
if (!isNaN(e.questionNum)) questionCount += +e.questionNum //
if (e.examQuestions) {
alreadyQuesCount += e.examQuestions.length //
totalScore = Decimal(totalScore).add(+e.targetScore || 0).toNumber() //
if (!isNaN(e.targetScore)) totalScore = Decimal(totalScore).add(+e.targetScore || 0).toNumber() //
e.examQuestions.forEach(n => {
alreadyScore = Decimal(alreadyScore).add(+n.score || 0).toNumber() //
if (!isNaN(n.score)) alreadyScore = Decimal(alreadyScore).add(+n.score || 0).toNumber() //
})
}
})
console.log("🚀 ~ overview ~ alreadyScore:", alreadyScore, totalScore)
return {
questionCount,
alreadyQuesCount,
@ -715,7 +714,7 @@ export default {
getQuesAlreadyScore (item) {
let total = 0
item.examQuestions.forEach(e => {
total = Decimal(total).add(+e.score).toNumber()
if (!isNaN(e.score)) total = Decimal(total).add(+e.score).toNumber()
})
item.curQuesTotalScore = total
return total
@ -911,7 +910,12 @@ export default {
loop1:
for (const i in paper) {
const e = paper[i]
const chineseNum = this.arabicToChinese(+i + 1)
const chineseNum = Util.arabicToChinese(+i + 1)
if (!e.outlineName) {
Util.warningMsg(`${chineseNum}大题请输入大题名称`)
invalid = 1
break
}
if (!e.questionType) {
Util.warningMsg('请选择题型')
invalid = 1
@ -922,11 +926,6 @@ export default {
invalid = 1
break
}
if (!e.outlineName) {
Util.warningMsg(`${chineseNum}大题请输入大题名称`)
invalid = 1
break
}
if (!e.targetScore) {
Util.warningMsg('请输入目标分值')
invalid = 1
@ -949,8 +948,8 @@ export default {
const { fillScores } = n
if (fillScores) {
for (const e of fillScores) {
if (e.val === '' || e.val === undefined || e.val === null) {
Util.warningMsg(`${chineseNum}大题的第${this.arabicToChinese(+j + 1)}小题填空分数未填写完成,请重新修改`)
if (e.val === '' || e.val === null || isNaN(e.val)) {
Util.warningMsg(`${chineseNum}大题的第${Util.arabicToChinese(+j + 1)}小题填空分数请填写数字`)
invalid = 1
break loop1
}
@ -965,6 +964,15 @@ export default {
break
}
} else {
for (const j in e.examQuestions) {
const n = e.examQuestions[j]
if (n.score === '' || n.score === null || isNaN(n.score)) {
Util.warningMsg(`${chineseNum}大题的第${Util.arabicToChinese(+j + 1)}小题分数请填写数字`)
invalid = 1
break loop1
}
}
if (+e.targetScore !== e.curQuesTotalScore) {
//
Util.warningMsg(`${chineseNum}大题的小题总分跟目标分值不一致,请重新修改`)

Loading…
Cancel
Save