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

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

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