onClassDetail.vue
9.2 KB
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<template>
<div>
<nav-bar class="detailnav">
<div slot="left" class="back" @click="goBack">
<img src="../../assets/img/back.png" alt="" />
</div>
<div slot="center" class="classDetail_title">课程详情</div>
<div slot="right" class="result"></div>
</nav-bar>
<div class="classDetail_img">
<van-image
width="100%"
height="100%"
fit="cover"
:src="images"
/>
</div>
<tabs
:tabs="tabs"
@choose="choose"
class="onclasstabs"
:active="current"
></tabs>
<swiper-list @slideChange="slideChange" :active="current">
<div slot="first" class="tabcontent">
<div>
<div class="class_detail_title">{{ name }}</div>
<div class="class_detail_content" v-html="string"></div>
</div>
</div>
<div
slot="second"
class="tabcontent"
v-for="(item, index) in courseList"
:key="index"
>
<div @click="showlistClick(item, index)">
<img src="../../assets/img/listbg.png" alt="" class="classlist_bg" />
<div class="classlist_biaoti display-flex">
<img style="width: 0.48rem !important;"
src="../../assets/img/video.png"
alt=""
class="classlist_img"
/>
<div class="classlist_title">{{ item.name }}</div>
</div>
</div>
<div v-if="showlist === index">
<div
v-for="(itm, ind) in item.lessonclassdetail"
:key="ind"
class="classlist_one"
>
<router-link :to="{ path: '/video', query: { id: itm.id, train_id: train_id,train_class_id: train_class_id,ifclass:ifclass } }">
<div class="display-flex-between" style="align-items: flex-start">
<div style="color: #c8c9cc">1.1</div>
<div class="display-flex-between" style="flex: 1">
<div class="classlist_one_title">{{ itm.name }}</div>
<div v-if="userclassstatus">
<div class="classlist_one_statue" v-if="Number(itm.is_complete)==1">已完成</div>
<div class="classlist_one_statue" v-else>未完成</div>
</div>
<div style="color: #969799">{{ gettime(itm.video_length) }}</div>
</div>
</div>
</router-link>
</div>
</div>
</div>
</swiper-list>
<model
:ifShow="showmodel"
confirmText="确定"
cancelText="取消"
title="当前未在开班时间内,学习将不会记录课时 ,是否继续学习? "
@confirmFun="confirmFun3"
@cancelFun="goBack"
></model>
<model
:ifShow="showhavepic"
confirmText="确定"
cancelText="取消"
title="您当前还未设置人脸识别的照片,请前去设置"
@confirmFun="confirmFungo"
@cancelFun="goBack"
></model>
<model
:scroll="false"
:ifphoto="true"
:ifShow="showyan"
confirmText="确定"
cancelText="取消"
title="身份信息验证"
content="设置人脸识别照片为本人学习"
@yanpeoplepic="sureyan"
@cancelFun="cancelyan"
></model>
</div>
</template>
<script>
import model from '@/components/model'
import tabs from '@/components/tabs.vue'
import swiperList from '@/components/swiper.vue'
import '@/assets/style/list5.css'
export default {
name: 'onClassDetail',
components: {
tabs,
swiperList,
model
},
// watch: {
// $route: {
// immediate: true,
// deep: true,
// handler (newValue, oldValue) {
// this.id = newValue.query.id
// if (newValue.query.id) {
// this.train_id = newValue.query.train_id
// this.train_class_id = newValue.query.train_class_id
// this.videoDetails()
// }
// }
// }
// },
data () {
return {
showhavepic: false,
showyan: false,
showlist: true, // 控制课节是否展开
current: 1,
classlist: [],
courseList: [], // 课程列表
tabs: ['课程详情', '课程列表'],
string: '',
id: '',
is_finish: 0,
images: '',
name: '',
train_id: '',
train_class_id: '',
showmodel: false,
ifclass: '',
userclassstatus: false
}
},
mounted () {
if (this.$route.query.train_class_id) {
this.userclassstatus = true
} else {
this.userclassstatus = false
}
this.id = this.$route.query.id
this.is_finish = this.$route.query.is_finish
this.ifclass = this.$route.query.ifclass
this.train_class_id = this.$route.query.train_class_id
this.videoDetails()
this.gettime()
},
methods: {
async getinfo () {
const result = await this.api.userinfo()
if (result.code === 1) {
const info = result.data.info
if (Number(info.company_check_face) === 0) {
this.showyan = false
this.showhavepic = false
} else if (Number(info.company_check_face) === 1 && Number(info.is_check_face) === 0) {
this.showhavepic = true
this.showyan = false
} else if (Number(info.company_check_face) === 1 && Number(info.is_check_face) === 1) {
this.showhavepic = false
this.showyan = true
}
}
},
confirmFungo () {
this.$router.push('userinfo')
},
gettime (oldtime) {
const hours = Math.floor(oldtime / 3600)
oldtime = oldtime % 3600
const minutes = Math.floor(oldtime / 60)
oldtime = Math.floor(oldtime % 60)
return (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (oldtime < 10 ? '0' + oldtime : oldtime)
},
confirmFun3 () {
this.showmodel = false
},
slideChange (e) {
this.current = e
},
goBack () {
this.$router.back(-1)
},
choose (e) {
this.current = e
},
// 控制课节是否展开
showlistClick (itm, ind) {
if (this.showlist === ind) {
// 当 showlist 等于点击课节的下标
this.showlist = false
} else {
// 不等于时, 赋值当前点击课节的下标, 让它成立
this.showlist = ind
}
},
// 视频详情
async videoDetails () {
const params = {
id: this.id,
train_class_id: this.train_class_id
}
const reslist = await this.api.videoDetails(params)
if (reslist.code === 1) {
const result = reslist.data.detail.class
result.forEach(item => {
const classlist = item.lessonclassdetail
classlist.forEach(one => {
})
})
this.courseList = reslist.data.class_list
this.name = reslist.data.detail.name
this.string = reslist.data.detail.content
this.images = reslist.data.detail.image
if (Number(reslist.data.detail.is_settle) === 0) {
this.showmodel = true
}
if (!localStorage.getItem('yansuccess') && this.is_finish == 0) {
this.getinfo()
}
} else {
this.$toast(reslist.msg)
}
},
sureyan (res) {
console.log(res)
if (res.code == 1) {
this.$toast('验证成功')
this.showyan = false
localStorage.setItem('yansuccess', true)
} else {
this.$toast('验证失败')
this.goBack()
}
},
cancelyan () {
this.goBack()
}
}
}
</script>
<style scoped lang="scss">
.detailnav {
position: fixed;
top: 0;
background: #fff;
z-index: 8;
}
.back,
.result {
width: 1rem;
}
.back {
font-size: 0.48rem;
}
.back img {
width: 0.48rem !important;
height: 0.48rem;
}
.classDetail_title {
text-align: center;
font-weight: 600;
font-size: 0.34rem;
}
.classDetail_img {
width: 100% !important;
height: 4.2rem;
margin-top: 0.88rem;
}
.classDetail_img img {
width: 100% !important;
height: 4.2rem;
}
.onclasstabs {
height: 0.88rem;
padding: 0rem 0 !important;
/* border: 1px solid red; */
margin-top: rem;
box-shadow: 0px 5px 12px 0px rgba(113, 121, 129, 0.2);
}
.tabcontent {
width: 100%;
height: auto;
padding: 0.32rem;
box-sizing: border-box;
}
.classbg {
width: 100%;
height: 100%;
}
.class_tip {
margin-top: -1.64rem;
padding: 0.16rem;
box-sizing: border-box;
/* border: 0.01rem solid red; */
height: 1.44rem;
}
.train img {
width: 0.4rem !important;
height: 0.4rem;
margin-right: 0.1rem;
}
.train_title {
color: rgba(15.85, 190.19, 137.89, 1);
font-size: 0.28rem;
font-weight: 500;
}
.train_tip {
color: rgba(75.49, 208.25, 168.57, 1);
font-size: 0.24rem;
font-weight: 400;
margin: 0.16rem 0 0 0.5rem;
}
.class_detail_title {
color: rgba(50, 50, 51, 1);
font-size: 0.34rem;
font-weight: 600;
font-family: "PingFang SC";
text-align: left;
line-height: 0.52rem;
}
.class_detail_content {
width: 100%;
color: rgba(50, 50, 51, 1);
font-size: 0.28rem;
font-weight: 400;
font-family: "PingFang SC";
text-align: left;
line-height: 0.48rem;
margin-top: 0.32rem;
}
::v-deep img {
width: 100% !important;
}
.classlist_one_title {
color: #000000;
flex: 1;
text-align: left;
}
.classlist_one_statue{
margin-right: 0.16rem;
color: #000;
}
</style>