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

课程考试支持多次考试

上级 a979c5a3
...@@ -211,15 +211,30 @@ export default class CourseAction extends BaseACTION { ...@@ -211,15 +211,30 @@ export default class CourseAction extends BaseACTION {
type: 102 type: 102
}) })
if (cur.course_examination) { if (cur.course_examination) {
let courseExamChildren = []
if (data.exist_examination.length > 1) {
courseExamChildren = data.exist_examination.map((item, index) => {
const map = ['一', '二', '三']
return {
name: `第${map[index]}次考试`,
id: 'course_exam',
offset: index,
sid: sid,
cid: cid,
examId: cur.course_examination,
type: 101
}
})
}
json.tabs1ChapterList.course.push({ json.tabs1ChapterList.course.push({
title: '课程考试', title: '课程考试',
isUp: true, isUp: true,
chapters: [], chapters: courseExamChildren,
id: 'course_exam', id: 'course_exam',
sid: sid, sid: sid,
cid: cid, cid: cid,
examId: cur.course_examination, examId: cur.course_examination,
type: 102 type: 101
}) })
} }
/* 课程考核 考核标准文案读取 */ /* 课程考核 考核标准文案读取 */
......
<template> <template>
<div class="q-item"> <div class="q-item">
<div class="q-item-hd"> <div class="q-item-hd">
<div class="q-item-num">{{index + 1}}.</div> <div class="q-item-num">{{ index + 1 }}.</div>
<div class="q-item-title" v-html="data.content"></div> <div class="q-item-title" v-html="data.content"></div>
<div class="q-item-aside"> <div class="q-item-aside">
<template v-if="typeText">({{typeText}})</template> <template v-if="typeText">({{ typeText }})</template>
<template v-if="data.hasOwnProperty('score')">({{data.score}}分)</template> <template v-if="data.hasOwnProperty('score')">({{ data.score }}分)</template>
</div> </div>
</div> </div>
<div class="q-item-bd"> <div class="q-item-bd">
<!-- 单选 --> <!-- 单选 -->
<el-radio-group v-model="currentValue.user_answer" v-if="type === 1"> <el-radio-group v-model="currentValue.user_answer" v-if="type === 1">
<div class="q-option-item" v-for="item in currentOptions" :key="item.id"> <div class="q-option-item" v-for="item in currentOptions" :key="item.id">
<el-radio :class="genClass(item)" :label="item.id">{{item.abc_option}}</el-radio> <el-radio :class="genClass(item)" :label="item.id">{{ item.abc_option }}</el-radio>
</div> </div>
</el-radio-group> </el-radio-group>
<!-- 多选 --> <!-- 多选 -->
<el-checkbox-group v-model="currentValue.user_answer" v-if="type === 2"> <el-checkbox-group v-model="currentValue.user_answer" v-if="type === 2">
<div class="q-option-item" v-for="item in currentOptions" :key="item.id"> <div class="q-option-item" v-for="item in currentOptions" :key="item.id">
<el-checkbox :class="genClass(item)" :label="item.id">{{item.abc_option}}</el-checkbox> <el-checkbox :class="genClass(item)" :label="item.id">{{ item.abc_option }}</el-checkbox>
</div> </div>
</el-checkbox-group> </el-checkbox-group>
<!-- 简答题 --> <!-- 简答题 -->
...@@ -27,39 +27,34 @@ ...@@ -27,39 +27,34 @@
<v-upload :disabled="disabled" v-model="currentValue.attachments">请上传对应的文件附件:</v-upload> <v-upload :disabled="disabled" v-model="currentValue.attachments">请上传对应的文件附件:</v-upload>
</template> </template>
</div> </div>
<div class="q-item-ft" v-if="disabled"> <div class="q-item-ft" v-if="disabled && showResult">
<template v-if="type === 3"> <template v-if="type === 3">
<p v-if="data.check_comment"> <p v-if="data.check_comment">
<span>评语:</span> <span>评语:</span>
<span>{{data.check_comment}}</span> <span>{{ data.check_comment }}</span>
</p> </p>
</template> </template>
<template v-else> <template v-else>
<div class="result"> <div class="result">
<p> <p>
<span>学生答案:</span> <span>学生答案:</span>
<span :class="isCorrect ? 'is-success' : 'is-error'">{{submitAnswerText}}</span> <span :class="isCorrect ? 'is-success' : 'is-error'">{{ submitAnswerText }}</span>
</p> </p>
<p> <p>
<span>正确答案:</span> <span>正确答案:</span>
<span>{{correctAnswerText}}</span> <span>{{ correctAnswerText }}</span>
</p> </p>
</div> </div>
</template> </template>
<p v-if="data.hasOwnProperty('get_score')"> <p v-if="data.hasOwnProperty('get_score')">
<span>评分:</span> <span>评分:</span>
<span>{{data.get_score}}分</span> <span>{{ data.get_score }}分</span>
</p> </p>
<div class="analyze" v-if="data.analysis"> <div class="analyze" v-if="data.analysis">
<span>解析:</span> <span>解析:</span>
<div class="analyze-main"> <div class="analyze-main">
<span style="color:blue;cursor:pointer;" @click="showAnalyze = !showAnalyze">查看解析</span> <span style="color: blue; cursor: pointer" @click="showAnalyze = !showAnalyze">查看解析</span>
<div <div v-html="data.analysis" v-if="data.analysis" v-show="showAnalyze" class="analyze-content"></div>
v-html="data.analysis"
v-if="data.analysis"
v-show="showAnalyze"
class="analyze-content"
></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -94,7 +89,8 @@ export default { ...@@ -94,7 +89,8 @@ export default {
} }
}, },
// 是否禁用,提交过的是禁用状态 // 是否禁用,提交过的是禁用状态
disabled: { type: Boolean, default: false } disabled: { type: Boolean, default: false },
showResult: { type: Boolean, default: true }
}, },
data() { data() {
return { return {
...@@ -135,16 +131,12 @@ export default { ...@@ -135,16 +131,12 @@ export default {
item.abc_option = `${this.A_Z[index]}. ${item.option}` item.abc_option = `${this.A_Z[index]}. ${item.option}`
// 提交时的选中状态 // 提交时的选中状态
const value = this.value.user_answer || '' const value = this.value.user_answer || ''
item.selected = Array.isArray(value) item.selected = Array.isArray(value) ? value.includes(item.id) : value === item.id
? value.includes(item.id)
: value === item.id
// 处理正确的选中状态 // 处理正确的选中状态
const hasChecked = Object.prototype.hasOwnProperty.call(item, 'checked') const hasChecked = Object.prototype.hasOwnProperty.call(item, 'checked')
const rightAnswer = this.data.right_answer || '' const rightAnswer = this.data.right_answer || ''
if (!hasChecked && rightAnswer) { if (!hasChecked && rightAnswer) {
item.checked = Array.isArray(rightAnswer) item.checked = Array.isArray(rightAnswer) ? rightAnswer.includes(item.id) : rightAnswer === item.id
? rightAnswer.includes(item.id)
: rightAnswer === item.id
} }
return item return item
}) })
...@@ -179,7 +171,7 @@ export default { ...@@ -179,7 +171,7 @@ export default {
methods: { methods: {
// 生成class // 生成class
genClass(item) { genClass(item) {
if (!this.disabled) { if (!this.disabled || !this.showResult) {
return null return null
} }
return { return {
......
<template> <template>
<component <component :is="currentCompoent" :chapter="chapter" :data="data" v-bind="$attrs" v-on="$listeners" v-if="chapter" />
:is="currentCompoent"
:chapter="chapter"
:data="data"
v-bind="$attrs"
v-on="$listeners"
v-if="chapter"
/>
</template> </template>
<script> <script>
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
:key="pid" :key="pid"
@pptupdate="handlePPTupdate" @pptupdate="handlePPTupdate"
@change-ppt="handleChangePPT(...arguments, false)" @change-ppt="handleChangePPT(...arguments, false)"
@update="getCourse"
/> />
</div> </div>
</div> </div>
......
...@@ -542,7 +542,7 @@ export default { ...@@ -542,7 +542,7 @@ export default {
window.open(data.live.record_url || data.live.join_url) window.open(data.live.record_url || data.live.join_url)
return return
} }
this.$router.push({ name: 'viewerCourseChapter', params: { sid, cid, id: data.id } }) this.$router.push({ name: 'viewerCourseChapter', params: { sid, cid, id: data.id }, query: { offset: data.offset } })
}, },
/** /**
* 开始学习或继续学习 - 跳转到对应音视频播放页 * 开始学习或继续学习 - 跳转到对应音视频播放页
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论