1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<template>
<view>
<view class="title">
课程简介
</view>
<view class="u-content">
<u-parse :html="courseInfo.intro"></u-parse>
</view>
<view class="lecturer">
<view class="" v-if="courseInfo.isTeachers">
<view class="" style="font-size: 40rpx;font-weight: bold;margin: 30rpx 0;">
讲师
</view>
<view class="" style="display: flex;">
<image src="../../static/logo.png" mode=""></image>
<view style="font-size: 30rpx;font-weight:1000;margin: 19px 24px;">{{ courseInfo.teacher.name }}</view>
</view>
</view>
<view class="" style="margin: 36rpx 0;">
<view class="" style="font-size: 40rpx;font-weight:1000">
目录
</view>
<view v-for="(item,index) in list">
<view class="chapter">
{{item.name}}
</view>
<view class="video" v-for="(section,key) in item.section" @click=details(section.id)>
<view class="video_1" >
<view class="text" v-text="wareType(section.ware)">
</view>
<text class="texts">{{index+1}}-{{key+1}}</text>
<text class="text2">{{section.name}}</text>
<text class="text3" v-text="section.isLearned==false?'未开始':'完成'"></text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
params:{
course_id:0,
},
list:[],
examId:1,
courseInfo: {
intro: '',
isTeachers: false,
teacher: {}
}
}
},
onLoad(a){
getApp().trackPage('学习课程简介页')
this.params.course_id=a.course_id
this.getCapterDetails()
this.getCourseInfo()
},
methods: {
getCourseInfo() {
let param = {
course_id: this.params.course_id
};
this.$u.api
.CourseList(param)
.then((res) => {
if (res.code == 200) {
if (res.data) {
this.courseInfo.intro = res.data.course.intro;
this.courseInfo.isTeachers = res.data.course.teachers.length > 0;
this.courseInfo.teacher = this.courseInfo.isTeachers ? res.data.course.teachers[0] : {};
}
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
});
},
//获取章节详情
getCapterDetails() {
console.log('获取章节详情')
this.$u.api
.ChapterDetails(this.params)
.then((res) => {
if (res.code == 200) {
if (res.data) {
this.list = this.list.concat(res.data);
console.log(this.list)
if (res.data.length < 5) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true;
this.loadStatus = "nomore";
} else {
this.isLoadMore = false;
}
} else {
this.isLoadMore = true;
this.loadStatus = "nomore";
}
} else {
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none"
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
});
},
//跳转到小节
details(id){
console.log(id)
uni.navigateTo({
url:"./section?section_id=" + id
})
},
wareType(type){
let res = "";
switch (type) {
case "":
res = "图文";
break;
case "0":
case "0,1":
case "0,1,2":
res = "视频";
break;
case "1":
res = "ppt";
break;
case "2":
case "1,2":
res = "pdf";
break;
}
return res;
}
}
}
</script>
<style lang="scss">
.title{
height: 64rpx;
font-size: 40rpx;
font-weight: bold;
margin: 24rpx 34rpx;
}
.lecturer{
height: 264rpx;
padding-left: 30rpx;
}
image{
width: 128rpx;
height: 128rpx;
}
.chapter{
font-size: 37rpx;
font-weight: 700;
}
.video{
width: 100%;
}
.video_1{
display: flex;
margin: 20rpx 0;
position: relative;
width: 100%;
.texts{
border:1px solid #8F8F94;
text-align: center;
line-height: 38rpx;
margin-right: 5rpx;
}
.text{
width: 100rpx;
height: 38rpx;
border:1px solid #8F8F94;
text-align: center;
line-height: 38rpx;
margin-right: 82rpx;
}
.text2{
width: 397rpx;
font-size: 33rpx;
color: #82848A;
margin-right: 0rpx;
}
.text3{
float: right;
position: relative;
right: 0;
}
}
.u-content {
padding: 0rpx 34rpx;
}
</style>