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

优化课后考试

上级 06bb1660
...@@ -95,3 +95,10 @@ export function paySuccess(id) { ...@@ -95,3 +95,10 @@ export function paySuccess(id) {
export function getAcitivityReportList(id) { export function getAcitivityReportList(id) {
return httpRequest.get(`/api/lms/v2/education/symposium/${id}/report`) return httpRequest.get(`/api/lms/v2/education/symposium/${id}/report`)
} }
// 上传文件
export function uploadFile(data) {
return httpRequest.post('/api/lms/v2/lobby/tools/upload', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
...@@ -179,7 +179,10 @@ export default { ...@@ -179,7 +179,10 @@ export default {
}, },
// 获取考试结果 // 获取考试结果
getExamResult() { getExamResult() {
api.getCourseExamResult(this.sid, this.cid, this.pid, { paper_type: 0 }).then(response => { this.loading = true
api
.getCourseExamResult(this.sid, this.cid, this.pid, { paper_type: 0 })
.then(response => {
// 设置问题列表数据 // 设置问题列表数据
if (response.code !== 8001) { if (response.code !== 8001) {
this.isStartExam = true this.isStartExam = true
...@@ -191,9 +194,15 @@ export default { ...@@ -191,9 +194,15 @@ export default {
} }
} }
}) })
.finally(() => {
this.loading = false
})
}, },
// 提交校验 // 提交校验
checkSubmit() { checkSubmit() {
if (!this.questions.length) {
return
}
for (let i = 0; i < this.questions.length; i++) { for (let i = 0; i < this.questions.length; i++) {
const questions = this.questions[i] const questions = this.questions[i]
for (let k = 0; k < questions.length; k++) { for (let k = 0; k < questions.length; k++) {
......
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
immediate: true, immediate: true,
handler(data) { handler(data) {
if (!this.questions.length) { if (!this.questions.length) {
this.questions = data.homework ? this.genQuenstions(data.homework.questions) : [] this.questions = data.homework ? this.genQuestions(data.homework.questions) : []
} }
} }
} }
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
} }
return item return item
}) })
this.questions = this.genQuenstions(this.questions) this.questions = this.genQuestions(this.questions)
} }
}) })
.finally(() => { .finally(() => {
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
}) })
}, },
// 组装问题数据 // 组装问题数据
genQuenstions(list) { genQuestions(list) {
if (!list) { if (!list) {
return [] return []
} }
...@@ -167,9 +167,12 @@ export default { ...@@ -167,9 +167,12 @@ export default {
}, },
// 提交校验 // 提交校验
checkSubmit() { checkSubmit() {
const quenstions = this.questions const questions = this.questions
for (let i = 0; i < quenstions.length; i++) { if (!questions.length) {
const value = quenstions[i].formModel.user_answer return
}
for (let i = 0; i < questions.length; i++) {
const value = questions[i].formModel.user_answer
if (Array.isArray(value) ? !value.length : !value) { if (Array.isArray(value) ? !value.length : !value) {
return false return false
} }
......
...@@ -117,7 +117,7 @@ export default { ...@@ -117,7 +117,7 @@ export default {
immediate: true, immediate: true,
handler(data) { handler(data) {
if (!this.questions.length) { if (!this.questions.length) {
this.questions = data.homework ? this.genQuenstions(data.homework.questions) : [] this.questions = data.homework ? this.genQuestions(data.homework.questions) : []
} }
} }
} }
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
} }
return item return item
}) })
this.questions = this.genQuenstions(this.questions) this.questions = this.genQuestions(this.questions)
} }
}) })
.finally(() => { .finally(() => {
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
}) })
}, },
// 组装问题数据 // 组装问题数据
genQuenstions(list) { genQuestions(list) {
if (!list) { if (!list) {
return [] return []
} }
...@@ -232,9 +232,9 @@ export default { ...@@ -232,9 +232,9 @@ export default {
}, },
// 提交校验 // 提交校验
checkSubmit() { checkSubmit() {
const quenstions = this.questions const questions = this.questions
for (let i = 0; i < quenstions.length; i++) { for (let i = 0; i < questions.length; i++) {
const value = quenstions[i].formModel.user_answer const value = questions[i].formModel.user_answer
if (Array.isArray(value) ? !value.length : !value) { if (Array.isArray(value) ? !value.length : !value) {
return false return false
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论