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

chore: 修改课程考试相关内容

上级 3425b686
......@@ -122,6 +122,7 @@ export default class PlayerAction extends BaseACTION {
video_provider: (__.video && __.video.video_provider) || '',
time: (__.video && tools.convertTime.durationToTimeString(__.video.video_length)) || '',
name: __.name,
chapterId: __.id, // 需要chapterId 用来 提交 作业或问题 , 这个 chapterId 是 每个章节下 对应课程的 id,不是 章节id
type: __.type,
work_type: (__.homework && __.homework.work_type) || '',
homework: _homework,
......
......@@ -158,7 +158,7 @@ export default {
let str = ''
let stuAnswer = '' // 学生答案
let stuIsCorrect = 0 // 学生是否答对
let _json = JSON.parse(_.question_options)
let _json = _.question_options ? JSON.parse(_.question_options) : []
_json.forEach(function (__, j) {
if (__.checked) {
switch (j) {
......
......@@ -6,7 +6,7 @@
<h3>{{exam.title}}</h3>
</div>
</div>
<template v-if="exam.type !== 3">
<template v-if="status.isStart && exam.type !== 3">
<div class="play-paper-content play-chapter-exam">
<template v-if="exam.id">
<div class="exam">
......@@ -15,7 +15,7 @@
<!-- <div class='tit'>{{exam.title}}</div> -->
<template v-if="exam.type === 2">
<template v-if="exam.score">
<div style="font-size: 18px;">总分{{exam.score.total}}</div>
<div style="font-size: 18px;">分数{{exam.score.total}}</div>
</template>
</template>
<template v-else-if="exam.type === 1">
......@@ -23,15 +23,15 @@
</template>
<!-- </div> -->
<!-- </div> -->
<template v-if="(exam.type !== 1 && exam.type !== 2)">
<template v-if="(exam.type !== 1)">
<div
style="text-align: center;"
v-if="exam.paper_deadline"
>考试截止时间为:{{exam.paper_deadline}}</div>
<template v-for="exam in exam.examination">
<template v-for="question in exam.examination">
<!-- 单选题 -->
<template v-if="exam.radioList.length">
<template v-for="(item, index) in exam.radioList">
<template v-if="question.radioList.length">
<template v-for="(item, index) in question.radioList">
<div v-bind:key="item.id" class="q-group" :data-index="index">
<div class="q-num">{{index+1}}.</div>
<div class="q-title" v-html="item.content"></div>
......@@ -59,10 +59,10 @@
</template>
</template>
<!-- 多选题 -->
<template v-if="exam.checkboxList.length">
<template v-for="(item, index) in exam.checkboxList">
<template v-if="question.checkboxList.length">
<template v-for="(item, index) in question.checkboxList">
<div v-bind:key="item.id" class="q-group" :data-index="index">
<div class="q-num">{{exam.radioList.length+index+1}}.</div>
<div class="q-num">{{question.radioList.length+index+1}}.</div>
<div class="q-title" v-html="item.content"></div>
<div class="q-type">(多选题)</div>
<el-checkbox-group class="checkbox-group" v-model="item.user_answer">
......@@ -88,12 +88,12 @@
</template>
</template>
<!-- 简答题 -->
<template v-if="exam.shortAnswerList.length">
<template v-for="(item, index) in exam.shortAnswerList">
<template v-if="question.shortAnswerList.length">
<template v-for="(item, index) in question.shortAnswerList">
<div class="q-group" :key="index">
<div
class="q-sa-title"
>{{exam.radioList.length+exam.checkboxList.length+index+1}}.&nbsp;&nbsp;简答题</div>
>{{question.radioList.length+question.checkboxList.length+index+1}}.&nbsp;&nbsp;简答题</div>
<div class="edit_html" v-html="item.content || ''"></div>
<v-editor v-model="item.user_answer"></v-editor>
<div style="height: 10px;"></div>
......@@ -105,6 +105,7 @@
:formData="item"
:isUpload="!exam.type"
></component>
<div class="result">评语:{{item.check_comment}}</div>
</div>
</template>
</template>
......@@ -309,11 +310,11 @@ export default {
},
init() {
const data = this.activeChatper.paper
this.exam = data
this.exam.id = data.id
this.exam.title = data.paper_title
this.exam.score = {}
this.exam.examination = data.examination.map(exam => {
const exam = {}
exam.id = data.id
exam.title = data.paper_title
exam.score = {}
exam.examination = data.examination.map(exam => {
for (let i = 0; i < exam.radioList.length; i++) {
exam.radioList[i].user_answer = ''
exam.radioList[i].right_answer = ''
......@@ -351,31 +352,32 @@ export default {
}
return exam
})
this.exam.paper_deadline = data.paper_deadline
exam.paper_deadline = data.paper_deadline
this.exam = JSON.parse(JSON.stringify(exam))
// this.loadExamStatus()
// this.loadExamInfo()
this.loadAjax()
// if (this._time) {
// clearInterval(this._time)
// this._time = null
// }
// this._time = setInterval(() => {
// // this.loadExamStatus()
// if (!this.exam.type && this.status.isStart) {
// // console.log(11, '暂存')
// this.submitExam({ submitType: true }) // 暂存, submitType: true 暂存;其他或不填为提交
// }
// /* 到时间 自动提交 */
// if (
// !this.exam.type &&
// this.status.isStart &&
// new Date(this.status.terminateTime).getTime() -
// new Date(this.status.serverTime).getTime() <=
// 5000
// ) {
// this.submitExam({ submitType: false, currentTarget: { dataset: {} } })
// }
// }, 3000)
if (this._time) {
clearInterval(this._time)
this._time = null
}
this._time = setInterval(() => {
// this.loadExamStatus()
if (!this.exam.type && this.status.isStart) {
// console.log(11, '暂存')
this.submitExam({ submitType: true }) // 暂存, submitType: true 暂存;其他或不填为提交
}
/* 到时间 自动提交 */
if (
!this.exam.type &&
this.status.isStart &&
new Date(this.status.terminateTime).getTime() -
new Date(this.status.serverTime).getTime() <=
5000
) {
this.submitExam({ submitType: false, currentTarget: { dataset: {} } })
}
}, 3000)
},
/* 定时调用 - 考试状态 */
loadExamStatus() {
......@@ -445,11 +447,8 @@ export default {
console.log(
'没有考试内容,认为是第一次答题,并且在答题期间,所以显示考试开始页面'
)
if (!flag) {
this.status.isStart = false
}
} else {
// this.exam.id = _data.id
this.status.isStart = true
this.exam.title = _data.title
this.exam.type = _data.type
this.exam.score = _data.score
......@@ -565,7 +564,7 @@ export default {
background: 'rgba(255, 255, 255, 0.9)'
})
}
cAction.Player.submitExam(this.cid, this.sid, this.exam.id, body)
cAction.Player.submitExam(this.cid, this.sid, this.id, body)
.then(_res => {
if (e.submitType) {
// this.$message.success('暂存成功')
......
......@@ -46,12 +46,12 @@
</template>
<!-- </div> -->
<!-- </div> -->
<template v-if="(exam.type !== 1 && exam.type !== 2)">
<template v-if="(exam.type !== 1)">
<div style="text-align: center;">考试截止时间为:{{status.terminateTime}}</div>
<template v-for="exam in exam.examination">
<template v-for="question in exam.examination">
<!-- 单选题 -->
<template v-if="exam.radioList.length">
<template v-for="(item, index) in exam.radioList">
<template v-if="question.radioList.length">
<template v-for="(item, index) in question.radioList">
<div v-bind:key="item.id" class="q-group" :data-index="index">
<div class="q-num">{{index+1}}.</div>
<div class="q-title" v-html="item.content"></div>
......@@ -79,10 +79,10 @@
</template>
</template>
<!-- 多选题 -->
<template v-if="exam.checkboxList.length">
<template v-for="(item, index) in exam.checkboxList">
<template v-if="question.checkboxList.length">
<template v-for="(item, index) in question.checkboxList">
<div v-bind:key="item.id" class="q-group" :data-index="index">
<div class="q-num">{{exam.radioList.length+index+1}}.</div>
<div class="q-num">{{question.radioList.length+index+1}}.</div>
<div class="q-title" v-html="item.content"></div>
<div class="q-type">(多选题)</div>
<el-checkbox-group class="checkbox-group" v-model="item.user_answer">
......@@ -108,12 +108,12 @@
</template>
</template>
<!-- 简答题 -->
<template v-if="exam.shortAnswerList.length">
<template v-for="(item, index) in exam.shortAnswerList">
<template v-if="question.shortAnswerList.length">
<template v-for="(item, index) in question.shortAnswerList">
<div class="q-group" :key="index">
<div
class="q-sa-title"
>{{exam.radioList.length+exam.checkboxList.length+index+1}}.&nbsp;&nbsp;简答题</div>
>{{question.radioList.length+question.checkboxList.length+index+1}}.&nbsp;&nbsp;简答题</div>
<div class="edit_html" v-html="item.content || ''"></div>
<v-editor v-model="item.user_answer"></v-editor>
<div style="height: 10px;"></div>
......@@ -125,6 +125,7 @@
:formData="item"
:isUpload="!exam.type"
></component>
<div class="result">评语:{{item.check_comment}}</div>
</div>
</template>
</template>
......
......@@ -80,8 +80,8 @@ export default {
return
}
this.$router.push({ path: `/player/${sid}/${cid}/live/${_id}` })
} else if (_course.chapters[i2].type === 5) {
this.$router.push({ path: `/player/${sid}/${cid}/chapter-exam2/${_course.chapters[i2].id}` })
} else if (_course.chapters[i2].type === 9) {
this.$router.push({ path: `/player/${sid}/${cid}/chapter-exam2/${_course.chapters[i2].chapterId}` })
}
return
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论