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