提交 182737e9 authored 作者: 王鹏飞's avatar 王鹏飞

fix: 修改课后考试和课程考试的试题序号

上级 2b708783
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<!-- 考试试题 --> <!-- 考试试题 -->
<div class="exam-form" v-if="isStartExam"> <div class="exam-form" v-if="isStartExam">
<el-form :disabled="isSubmited"> <el-form :disabled="isSubmited">
<template v-for="items in questions"> <template v-for="(items, i) in questions">
<exam-item <exam-item
v-for="(item, index) in items" v-for="(item, index) in items"
:index="index" :index="getIndex(i, index)"
:type="item.type" :type="item.type"
:data="item" :data="item"
:value="item.formModel" :value="item.formModel"
...@@ -304,6 +304,13 @@ export default { ...@@ -304,6 +304,13 @@ export default {
.finally(() => { .finally(() => {
this.submitLoading = false this.submitLoading = false
}) })
},
getIndex(parentIndex, index) {
while (parentIndex > 0) {
index = index + this.questions[parentIndex - 1].length
parentIndex--
}
return index
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
<!-- 考试试题 --> <!-- 考试试题 -->
<div class="exam-form" v-else> <div class="exam-form" v-else>
<el-form :disabled="!canEditable"> <el-form :disabled="!canEditable">
<template v-for="items in questions"> <template v-for="(items, i) in questions">
<exam-item <exam-item
v-for="(item, index) in items" v-for="(item, index) in items"
:index="index" :index="getIndex(i, index)"
:type="item.type" :type="item.type"
:data="item" :data="item"
:value="item.formModel" :value="item.formModel"
...@@ -432,6 +432,13 @@ export default { ...@@ -432,6 +432,13 @@ export default {
this.countdownTimer && clearInterval(this.countdownTimer) this.countdownTimer && clearInterval(this.countdownTimer)
} }
}, 1000) }, 1000)
},
getIndex(parentIndex, index) {
while (parentIndex > 0) {
index = index + this.questions[parentIndex - 1].length
parentIndex--
}
return index
} }
}, },
beforeMount() { beforeMount() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论