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

修改课程考试模块

上级 7854fc18
...@@ -164,7 +164,8 @@ export default class PlayerAction extends BaseACTION { ...@@ -164,7 +164,8 @@ export default class PlayerAction extends BaseACTION {
json: json, json: json,
courseInfo: _res.files || [], courseInfo: _res.files || [],
courseWork: _res.curriculum || {}, courseWork: _res.curriculum || {},
curJson: curJson curJson: curJson,
rawResponse: _res
} }
}) })
} }
...@@ -291,51 +292,51 @@ export default class PlayerAction extends BaseACTION { ...@@ -291,51 +292,51 @@ export default class PlayerAction extends BaseACTION {
exam.id = _res.id exam.id = _res.id
exam.title = _res.title exam.title = _res.title
exam.score = {} exam.score = {}
exam.radioList = _res.examination.radioList exam.examination = _res.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 = ''
exam.radioList[i].get_score = -1 exam.radioList[i].get_score = -1
}
exam.checkboxList = _res.examination.checkboxList
for (let i = 0; i < exam.checkboxList.length; i++) {
exam.checkboxList[i].user_answer = []
exam.checkboxList[i].right_answer = []
exam.checkboxList[i].get_score = -1
}
exam.shortAnswerList = _res.examination.shortAnswerList
for (let i = 0; i < exam.shortAnswerList.length; i++) {
exam.shortAnswerList[i].user_answer = ''
exam.shortAnswerList[i].get_score = -1
exam.shortAnswerList[i].attachments = []
exam.shortAnswerList[i].upload = {
type: 'upload-form',
label: '附件上传:',
model: 'attachments',
action: webConf.apiBaseURL + '/util/upload-file',
data: {
special: 'exam'
},
attrs: {
multiple: true,
headers: {
tenant: 'sofia'
}
},
html: `
<div style="color: #72818c; font-size: 14px;">
<p style="margin: 0;">支持doc,docx,ppt,xls,txt,rar,zip,pdf,jpg,pic,png格式的文件,文件小于30M。</p>
</div>
`
} }
} for (let i = 0; i < exam.checkboxList.length; i++) {
exam.checkboxList[i].user_answer = []
exam.checkboxList[i].right_answer = []
exam.checkboxList[i].get_score = -1
}
for (let i = 0; i < exam.shortAnswerList.length; i++) {
exam.shortAnswerList[i].user_answer = ''
exam.shortAnswerList[i].get_score = -1
exam.shortAnswerList[i].attachments = []
exam.shortAnswerList[i].upload = {
type: 'upload-form',
label: '附件上传:',
model: 'attachments',
action: webConf.apiBaseURL + '/util/upload-file',
data: {
special: 'exam'
},
attrs: {
multiple: true,
headers: {
tenant: 'sofia'
}
},
html: `
<div style="color: #72818c; font-size: 14px;">
<p style="margin: 0;">支持doc,docx,ppt,xls,txt,rar,zip,pdf,jpg,pic,png格式的文件,文件小于30M。</p>
</div>
`
}
}
return exam
})
return exam return exam
}) })
} }
/* 获取考卷结果 */ /* 获取考卷结果 */
getExamAnswer (cid, sid, eid) { getExamAnswer (cid, sid, eid, obj) {
return Player.getExamAnswer(cid, sid, eid).then(_res => { return Player.getExamAnswer(cid, sid, eid, obj).then(_res => {
if (_res.code) { return _res } if (_res.code) { return _res }
const exam = {} const exam = {}
let tmp = null let tmp = null
...@@ -345,46 +346,50 @@ export default class PlayerAction extends BaseACTION { ...@@ -345,46 +346,50 @@ export default class PlayerAction extends BaseACTION {
exam.score = _res.score exam.score = _res.score
exam.isPublished = _res.is_published || '' exam.isPublished = _res.is_published || ''
exam.submitted_time = _res.submitted_time exam.submitted_time = _res.submitted_time
exam.radioList = _res.sheet.radioList exam.examination = _res.sheet.map(exam => {
for (let i = 0; i < exam.radioList.length; i++) { exam.radioList = exam.radioList || []
tmp = exam.radioList[i] for (let i = 0; i < exam.radioList.length; i++) {
if (!tmp.user_answer) tmp.user_answer = '' tmp = exam.radioList[i]
if (!tmp.right_answer) tmp.right_answer = '' if (!tmp.user_answer) tmp.user_answer = ''
if (!tmp.get_score) tmp.get_score = -1 if (!tmp.right_answer) tmp.right_answer = ''
} if (!tmp.get_score) tmp.get_score = -1
exam.checkboxList = _res.sheet.checkboxList
for (let i = 0; i < exam.checkboxList.length; i++) {
tmp = exam.checkboxList[i]
if (!tmp.user_answer || !tmp.user_answer.length) tmp.user_answer = []
if (!tmp.right_answer || !tmp.right_answer.length) tmp.right_answer = []
if (!tmp.get_score) tmp.get_score = -1
}
exam.shortAnswerList = _res.sheet.shortAnswerList
for (let i = 0; i < exam.shortAnswerList.length; i++) {
tmp = exam.shortAnswerList[i]
tmp.user_answer = Base64.decode(tmp.user_answer.replace(/ /gi, '+'))
if (!tmp.attachments || !tmp.attachments.length) tmp.attachments = []
tmp.upload = {
type: 'upload-form',
label: '附件上传:',
model: 'attachments',
action: webConf.apiBaseURL + '/util/upload-file',
data: {
special: 'exam'
},
attrs: {
multiple: true,
headers: {
tenant: 'sofia'
}
},
html: `
<div style="color: #72818c; font-size: 14px;">
<p style="margin: 0;">支持doc,docx,ppt,xls,txt,rar,zip,pdf,jpg,pic,png格式的文件,文件小于30M。</p>
</div>
`
} }
} exam.checkboxList = exam.checkboxList || []
for (let i = 0; i < exam.checkboxList.length; i++) {
tmp = exam.checkboxList[i]
if (!tmp.user_answer || !tmp.user_answer.length) tmp.user_answer = []
// if (!tmp.right_answer || !tmp.right_answer.length) tmp.right_answer = []
tmp.right_answer = tmp.right_answer || []
if (!tmp.get_score) tmp.get_score = -1
}
exam.shortAnswerList = exam.shortAnswerList || []
for (let i = 0; i < exam.shortAnswerList.length; i++) {
tmp = exam.shortAnswerList[i]
tmp.user_answer = tmp.user_answer ? Base64.decode(tmp.user_answer.replace(/ /gi, '+')) : ''
if (!tmp.attachments || !tmp.attachments.length) tmp.attachments = []
tmp.upload = {
type: 'upload-form',
label: '附件上传:',
model: 'attachments',
action: webConf.apiBaseURL + '/util/upload-file',
data: {
special: 'exam'
},
attrs: {
multiple: true,
headers: {
tenant: 'sofia'
}
},
html: `
<div style="color: #72818c; font-size: 14px;">
<p style="margin: 0;">支持doc,docx,ppt,xls,txt,rar,zip,pdf,jpg,pic,png格式的文件,文件小于30M。</p>
</div>
`
}
}
return exam
})
return exam return exam
}) })
} }
......
...@@ -113,7 +113,7 @@ export default class PlayerAPI extends BaseAPI { ...@@ -113,7 +113,7 @@ export default class PlayerAPI extends BaseAPI {
* @param {[string]} semester_id -> sid * @param {[string]} semester_id -> sid
* @param {[string]} exam_id -> eid * @param {[string]} exam_id -> eid
*/ */
getExamAnswer = (cid, sid, eid) => this.get(`/v2/education/${sid}/${cid}/examination/${eid}/sheet`, {}) getExamAnswer = (cid, sid, eid, obj = {}) => this.get(`/v2/education/${sid}/${cid}/examination/${eid}/sheet`, obj)
/** /**
* 获取考试状态 * 获取考试状态
* @param {[string]} course_id -> cid * @param {[string]} course_id -> cid
......
...@@ -618,6 +618,8 @@ export default { ...@@ -618,6 +618,8 @@ export default {
} else { } else {
this.$router.push({ path: `/player/${sid}/${cid}/live/${_id}` }) this.$router.push({ path: `/player/${sid}/${cid}/live/${_id}` })
} }
} else if (_course.chapters[i2].type === 9) {
this.$router.push({ path: `/player/${sid}/${cid}/chapter-exam2/${_course.chapters[i2].id}` })
} }
return return
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<div class="play-content"> <div class="play-content">
<router-view <router-view
ref="comTotalChapter" ref="comTotalChapter"
:chapters="rawResponse.chapters"
:chapterName="curChapterName" :chapterName="curChapterName"
:chapterId="chapterId" :chapterId="chapterId"
:courseInfo="courseInfo" :courseInfo="courseInfo"
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
@updateProgress="updateProgress" @updateProgress="updateProgress"
@changeSideBar="changeSideBar" @changeSideBar="changeSideBar"
:key="id" :key="id"
v-if="rawResponse.chapters"
></router-view> ></router-view>
</div> </div>
</div> </div>
...@@ -151,7 +153,8 @@ export default { ...@@ -151,7 +153,8 @@ export default {
chapterExam: {}, chapterExam: {},
/* 章节视频 */ /* 章节视频 */
chapterVideo: {}, chapterVideo: {},
chapterPpts: [] chapterPpts: [],
rawResponse: {} // 接口返回的数据
} }
}, },
beforeRouteUpdate (to, from, next) { beforeRouteUpdate (to, from, next) {
...@@ -178,6 +181,7 @@ export default { ...@@ -178,6 +181,7 @@ export default {
return return
} }
cAction.Player.getChapterList(to.params.cid, to.params.sid, to.params.id).then(json => { cAction.Player.getChapterList(to.params.cid, to.params.sid, to.params.id).then(json => {
this.rawResponse = json.rawResponse
this.chapterList = json.json this.chapterList = json.json
this.courseInfo = json.courseInfo this.courseInfo = json.courseInfo
this.courseWork = json.courseWork this.courseWork = json.courseWork
...@@ -219,6 +223,7 @@ export default { ...@@ -219,6 +223,7 @@ export default {
return return
} }
cAction.Player.getChapterList(this.cid, this.sid, this.id).then(json => { cAction.Player.getChapterList(this.cid, this.sid, this.id).then(json => {
this.rawResponse = json.rawResponse
this.chapterList = json.json this.chapterList = json.json
this.courseInfo = json.courseInfo this.courseInfo = json.courseInfo
this.courseWork = json.courseWork this.courseWork = json.courseWork
......
...@@ -80,6 +80,8 @@ export default { ...@@ -80,6 +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) {
this.$router.push({ path: `/player/${sid}/${cid}/chapter-exam2/${_course.chapters[i2].id}` })
} }
return return
} }
......
...@@ -201,6 +201,12 @@ export default [ ...@@ -201,6 +201,12 @@ export default [
component: () => import('@/pages/player/chapterExam/chapterExam.vue'), component: () => import('@/pages/player/chapterExam/chapterExam.vue'),
props: true props: true
}, },
{
path: 'chapter-exam2/:id',
name: 'chapterExam2',
component: () => import('@/pages/player/chapterExam/chapterExam2.vue'),
props: true
},
{ {
path: 'chapter-read/:id', path: 'chapter-read/:id',
name: 'chapterRead', name: 'chapterRead',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论