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

章节增加考试

上级 c2f07248
...@@ -19,10 +19,10 @@ export function getCourseList() { ...@@ -19,10 +19,10 @@ export function getCourseList() {
*/ */
export function getCourse(courseId) { export function getCourse(courseId) {
return httpRequest.get(`/api/zy/v2/education/courses/${courseId}`).then(response => { return httpRequest.get(`/api/zy/v2/education/courses/${courseId}`).then(response => {
response.chapters = response.chapters.filter(item => { // response.chapters = response.chapters.filter(item => {
item.children = item.children.filter(child => child.type === 2) // item.children = item.children.filter(child => child.type === 2)
return item.children.length // return item.children.length
}) // })
return response return response
}) })
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
:index="item.path" :index="item.path"
:key="item.title" :key="item.title"
v-for="item in item.children" v-for="item in item.children"
@click="handleClick(item.path)" @click="handleClick(item.path, item)"
> >
<template #title> <template #title>
<template v-if="item.href"> <template v-if="item.href">
...@@ -69,7 +69,9 @@ export default { ...@@ -69,7 +69,9 @@ export default {
{ {
title: '实训练习', title: '实训练习',
icon: 'icon-kaoshihong', icon: 'icon-kaoshihong',
children: [{ title: '实训案例练习', href: 'https://xtraining.ezijing.com/' }] children: [
{ title: '实训案例练习', path: 'https://xtraining.ezijing.com/', href: 'https://xtraining.ezijing.com/' }
]
}, },
{ {
title: '个人中心', title: '个人中心',
...@@ -125,7 +127,8 @@ export default { ...@@ -125,7 +127,8 @@ export default {
window.location.href = webConf.others.loginUrl window.location.href = webConf.others.loginUrl
}) })
}, },
handleClick(path) { handleClick(path, item) {
if (item.href) return
path && this.$router.push(path) path && this.$router.push(path)
} }
} }
......
...@@ -5,7 +5,21 @@ ...@@ -5,7 +5,21 @@
<li v-for="subItem in item.children" :key="subItem.id" @click="handleClick(subItem)"> <li v-for="subItem in item.children" :key="subItem.id" @click="handleClick(subItem)">
<div class="name">{{ subItem.name }}</div> <div class="name">{{ subItem.name }}</div>
<div class="duration">{{ subItem.duration }}</div> <div class="duration">{{ subItem.duration }}</div>
<div class="progress" v-if="showProgress">{{ progressText(subItem.video_progress) }}</div> <div class="progress" v-if="showProgress && subItem.type === 2">
{{ progressText(subItem.video_progress) }}
</div>
<div class="buttons" v-if="subItem.type === 9">
<el-button round size="mini" v-if="subItem.status === 100" @click="toExamPage(subItem, 1)">
测试
</el-button>
<el-button round size="mini" v-if="[0, 3].includes(subItem.status)" @click="toExamPage(subItem, 2)">
继续测试
</el-button>
<template v-if="[1, 2].includes(subItem.status)">
<el-button round size="mini" @click="toExamPage(subItem, 1)">重新测试</el-button>
<el-button round size="mini" @click="toExamPage(subItem, 3)">报告</el-button>
</template>
</div>
</li> </li>
</ul> </ul>
</el-collapse-item> </el-collapse-item>
...@@ -36,7 +50,16 @@ export default { ...@@ -36,7 +50,16 @@ export default {
return `已学${value}%` return `已学${value}%`
}, },
handleClick(data) { handleClick(data) {
this.$router.push({ name: 'viewerCourseChapter', params: { cid: this.courseId, id: data.id } }) if (data.type === 2) {
this.$router.push({ name: 'viewerCourseChapter', params: { cid: this.courseId, id: data.id } })
}
},
toExamPage(data, type) {
const path = type === 3 ? '/course/chapter/result' : '/course/exam/chapter'
this.$router.push({
path: path,
query: { course_id: this.courseId, chapter_id: data.id, type }
})
} }
} }
} }
......
...@@ -28,12 +28,7 @@ ...@@ -28,12 +28,7 @@
<!-- @click="confirmBtn" --> <!-- @click="confirmBtn" -->
<div class="foot" id="foot-h"> <div class="foot" id="foot-h">
<div class="exam-btn"> <div class="exam-btn">
<div class="confirm" <div class="confirm" @click="confirmBtn">查看解析</div>
@click="confirmBtn"
v-if="$rou"
>
查看解析
</div>
<div <div
@click="changeIndex('prev')" @click="changeIndex('prev')"
:class="this.questionParams.questionIndex !== 0 ? 'active' : ''" :class="this.questionParams.questionIndex !== 0 ? 'active' : ''"
......
...@@ -30,7 +30,7 @@ httpRequest.interceptors.response.use( ...@@ -30,7 +30,7 @@ httpRequest.interceptors.response.use(
function(response) { function(response) {
const { data } = response const { data } = response
if (data.code) { if (data.code) {
Message.error(data.msg) Message.error(data.msg || data.message)
return Promise.reject(data) return Promise.reject(data)
} }
return data return data
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论