提交 9d929bb5 authored 作者: lihuihui's avatar lihuihui
......@@ -21,8 +21,14 @@ export default {
},
methods: {
getCourseList() {
this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true
})
api.getCourseList().then(response => {
this.courseList = response
this.$toast.clear()
})
}
},
......
<template>
<div class="main-container">
<div class="main-container" v-show="loaded">
<div class="course-title">{{detail.course_name}}</div>
<van-tabs
class="main-tabs"
v-model="tabActive"
color="#2b7ce9"
:sticky="true"
:line-height="2"
@click="onTabClick"
>
......@@ -13,10 +12,9 @@
<course-chapter :courseId="courseId" :data="detail.chapters"></course-chapter>
</van-tab>
<van-tab title="知识点速学" name="1">
<course-tag
:courseId="courseId"
style="margin-left:-0.4rem;margin-right:-0.4rem;min-height:100vh;background:#eee;"
></course-tag>
<div class="tab-content">
<course-tag :courseId="courseId"></course-tag>
</div>
</van-tab>
</van-tabs>
</div>
......@@ -35,6 +33,7 @@ export default {
data() {
return {
tabActive: '0',
loaded: false,
detail: {}
}
},
......@@ -42,7 +41,7 @@ export default {
$route: {
immediate: true,
handler(route) {
this.tabActive = route.query.tab || '1'
this.tabActive = route.query.tab || '0'
}
}
},
......@@ -57,12 +56,20 @@ export default {
},
// 课程学习
getCourse() {
this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true
})
this.loaded = false
api.getCourse(this.courseId).then(response => {
this.loaded = true
response.chapters = response.chapters.filter(item => {
item.children = item.children.filter(child => child.type === 2)
return item.children.length
})
this.detail = response
this.$toast.clear()
})
}
},
......@@ -77,6 +84,13 @@ export default {
font-size: 15px;
font-weight: 600;
color: #222;
padding: 20px 0 10px;
padding: 20px 20px 10px;
}
.tab-content {
margin-left: -0.4rem;
margin-right: -0.4rem;
min-height: 100vh;
background: #eee;
padding: 0.4rem;
}
</style>
......@@ -69,7 +69,11 @@ export default {
viewMore() {
this.$router.push({
name: 'courseTag',
params: { courseId: this.courseId, chapterId: this.data.id }
params: {
courseId: this.courseId,
chapterId: this.data.id
},
query: { is_test: this.isTest ? '1' : '0' }
})
}
},
......
......@@ -60,6 +60,11 @@ export default {
methods: {
// 获取知识点列表
getCourseTagList() {
this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true
})
api.getCourseTagList(this.courseId).then(response => {
this.$emit('ready', response)
this.detail = response
......@@ -71,6 +76,7 @@ export default {
payload: item
}
})
this.$toast.clear()
})
},
// 输入搜索
......@@ -152,6 +158,7 @@ export default {
}
.send {
height: 50px;
padding-bottom: env(safe-area-inset-bottom);
.inner {
position: fixed;
left: 0;
......
<template>
<div class="course-tag-wrapper">
<div class="course-tag-wrapper" v-show="loaded">
<div class="course-tag-hd">
<h1 class="tag-title">{{detail.title}}</h1>
</div>
......@@ -17,6 +17,7 @@ export default {
name: 'CourseTagItem',
data() {
return {
loaded: false,
detail: {}
}
},
......@@ -33,8 +34,16 @@ export default {
methods: {
// 获取知识点详情
getCourseTag() {
this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true
})
this.loaded = false
api.getCourseTag(this.tagId).then(response => {
this.loaded = true
this.detail = response
this.$toast.clear()
})
}
},
......@@ -51,8 +60,11 @@ export default {
box-sizing: border-box;
}
.course-tag-hd {
position: sticky;
top: 0;
padding: 0.4rem;
background-color: #fff;
z-index: 10;
}
.course-tag-bd {
padding: 0.4rem;
......
<template>
<div class="course-tag-wrapper">
<div class="course-tag-wrapper" v-show="loaded">
<div class="course-tag-hd">
<h1 class="course-title">{{detail.course_name}}</h1>
</div>
......@@ -22,6 +22,7 @@ export default {
name: 'CourseTagList',
data() {
return {
loaded: false,
detail: { chapters: [] }
}
},
......@@ -40,16 +41,36 @@ export default {
},
tagList() {
return this.chapter.tag || []
},
isTest() {
return this.$route.query.is_test === '1'
}
},
methods: {
// 获取知识点列表
getCourseTagList() {
this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true
})
this.loaded = false
api.getCourseTagList(this.courseId).then(response => {
this.loaded = true
this.detail = response
this.$toast.clear()
})
},
onClick({ id }) {
if (this.isTest) {
const query = {
type: 2,
tag_id: id,
papersUrl: 'zy/v2/examination/course-papers'
}
this.$router.push({ path: '/exam/answer', query })
return
}
this.$router.push({ name: 'courseTagItem', params: { id } })
}
},
......@@ -65,8 +86,11 @@ export default {
box-sizing: border-box;
}
.course-tag-hd {
position: sticky;
top: 0;
padding: 0.4rem;
background-color: #fff;
z-index: 10;
}
.course-tag-bd {
padding: 0.4rem;
......
......@@ -51,8 +51,14 @@ export default {
methods: {
// 获取课程试听列表
getCourseList() {
this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true
})
api.getFreeCourseList().then(response => {
this.courseList = response
this.$toast.clear()
})
},
// 搜索
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论