lineClass.vue
11.0 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
361
362
363
364
<template>
<div>
<nav-bar class="navbar">
<div slot="left" class="back" @click="goBack">
<img src="../../assets/img/back.png" alt="" class="backimg"/>
</div>
<div slot="center" class="navtitle">
<div>直播列表</div>
</div>
<div slot="right" class="picker display-flex-around" @click="poslist" >
<div>{{infoData?infoData:postname}}</div>
<img src="../../assets/img/xia.png" alt="" :class="isShow?'rotate':''">
</div>
</nav-bar>
<fil-ter :show="isShow" :posts="posts" @infoType="infoType"></fil-ter>
<tabs
:tabs="tabs"
@choose="choose"
class="lineclasstabs"
:active="current"></tabs>
<div class="line"></div>
<swiper-list
class="linelistceont"
@slideChange="choose"
:active="current"
ifthird="true"
>
<div slot="first" class="live_list">
<van-list
@load="scrollEnd">
<div class="noresult" v-if="videoclass.length == 0">暂无直播课程</div>
<div class="list display-flex-between" v-else>
<div class="list_item" @click="todetail(item.playerUrl,item.is_finish)" v-for="(item,index) in videoclass" :key="index">
<div class="list_item_time blue">直播中</div>
<img :src="item.lessonlive.image" mode="widthFix" class="list_item_pic">
<div class="list_item_title p-1">{{item.name}}</div>
<div class="list_item_user display-flex">
<img :src="item.teacherpic" alt="" class="list_item_userpic">
<div style="flex: 1;">
<span class="p-1">{{item.trainclass.teachers.name}}-{{item.trainclass.name}}</span>
</div>
</div>
</div>
</div>
</van-list>
</div>
<div slot="second" class="live_list">
<van-list
@load="scrollEnd">
<div class="noresult" v-if="videoclass.length == 0">暂无直播课程</div>
<div class="list display-flex-between" v-else>
<div class="list_item" @click="todetail(item.lessonlive.id,item.is_finish)" v-for="(item,index) in videoclass" :key="index">
<div class="list_item_time orange">回放</div>
<img :src="item.lessonlive.image" mode="widthFix" class="list_item_pic">
<div class="list_item_title p-1">{{item.name}}</div>
<div class="list_item_user display-flex">
<img :src="item.teacherpic" alt="" class="list_item_userpic">
<div style="flex: 1;">
<span class="p-1">{{item.trainclass.teachers.name}}-{{item.trainclass.name}}</span>
</div>
</div>
</div>
</div>
</van-list>
</div>
<div slot="third" class="live_list">
<van-list
@load="scrollEnd">
<div class="noresult" v-if="videoclass.length == 0">暂无直播课程</div>
<div class="list display-flex-between" v-else>
<div class="list_item" @click="todetail(item.id,item.is_finish)" v-for="(item,index) in videoclass" :key="index">
<div class="list_item_time grey">即将开播</div>
<img :src="item.lessonlive.image" mode="widthFix" class="list_item_pic">
<div class="list_item_title p-1">{{item.name}}</div>
<div class="list_item_user display-flex">
<img :src="item.teacherpic" alt="" class="list_item_userpic">
<div style="flex: 1;">
<span class="p-1">{{item.trainclass.teachers.name}}-{{item.trainclass.name}}</span>
</div>
</div>
</div>
</div>
</van-list>
</div>
</swiper-list>
<model
:ifShow="ifshowmodel"
title="参与打卡后才能记录学习哦"
content="观看直播后,需要确认返回,才会记录学时哦"
cancelText="取消"
confirmText="确定"
@cancelFun="ifshowmodel=false"
></model>
<model
:ifShow="ifshowmodel2"
title="请上传本人头像"
cancelText="取消"
confirmText="拍摄"
@cancelFun="ifshowmodel2=false"
@confirmFun="confirmFun"
></model>
<model
:scroll="false"
:ifphoto="true"
:ifShow="showyan"
confirmText="确定"
cancelText="取消"
title="身份信息验证"
content="设置人脸识别照片为本人学习"
@yanpeoplepic="sureyan"
@cancelFun="cancelyan"
></model>
<model
:ifShow="showhavepic"
confirmText="确定"
cancelText="取消"
title="您当前还未设置人脸识别的照片,请前去设置"
@confirmFun="confirmFungo"
@cancelFun="goBack"
></model>
</div>
</template>
<script>
import filTer from '@/components/filter.vue'
import tabs from '@/components/tabs.vue'
import model from '@/components/model.vue'
import swiperList from '@/components/swiper.vue'
import config from '@/assets/js/config.js'
export default {
name: 'lineClass',
components: {
filTer,
tabs,
model,
swiperList
},
data () {
return {
showhavepic: false,
showyan: false,
height: '',
scrollX: false,
pulldown: false,
ifshowmodel2: false,
ifshowmodel: false,
isShow: false,
posts: [],
videoclass: [],
tabs: ['正在直播', '回放直播', '即将开播'],
current: 0,
page: 1,
pageNum: 20,
infoData: '',
pId: '',
postname: '',
type: 1,
ifmore: false, // 页码数据(第二页是否有数据)
playerurl: config.playerurl,
playerulr: '',
userinfo: ''
}
},
watch: {
current () {
this.type = this.current + 1
this.page = 1
console.log(this.type, this.current, '11111111')
this.videoclass = []
if (this.type === 1) {
this.liveBroadcast()
} else if (this.type === 2) {
this.liveBroadcast()
} else if (this.type === 3) {
this.liveBroadcast()
}
}
},
created () {
this.pId = this.$route.query.id
},
methods: {
confirmFungo () {
this.$router.push('userinfo')
},
sureyan (res) {
if (res.code == 1) {
this.$toast('验证成功')
this.showyan = false
this.todetails()
} else {
this.$toast('验证失败')
this.showyan = false
}
},
cancelyan () {
this.showyan = false
},
goBack () {
this.$router.go(-1)
},
async goon (is_finish) {
const result = await this.api.userinfo()
if (result.code === 1) {
const info = result.data.info
if (Number(info.company_check_face) == 0 || is_finish == 1) {
this.showyan = false
this.showhavepic = false
this.todetails()
} 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
}
}
},
todetails () {
if (this.current == 1) {
this.$router.push({
path: 'card',
query: {
id: this.playerulr
}
})
} else {
this.checkplayer(this.playerulr)
}
},
todetail (playerUrl,is_finish) {
this.playerulr = playerUrl
if (this.current == 2) {
this.$toast('教师未开播')
} else {
this.goon(is_finish)
}
},
async checkplayer (info) {
const infoarr = ''.split.call(info, '?')
console.log(infoarr[0], infoarr[1])
window.open(infoarr[0] + '?' + encodeURIComponent(infoarr[1]), '_self')
},
confirmFun () {
this.$router.push('/card')
},
choose (e) {
console.log(e, '222222')
this.current = e
this.page = 1
this.videoclass = []
},
scrollEnd () {
if (this.ifmore) {
this.page++
this.liveBroadcast()
}
// else {
// this.$toast({ message: '没有更多了', duration: 1000 })
// }
},
infoType (infoType, itemId) {
this.isShow = false
this.infoData = infoType
this.pId = itemId
this.page = 1
this.videoclass = []
this.liveBroadcast()
},
// 直播课程
async liveBroadcast () {
const params = {
type: this.type,
page: this.page,
page_num: this.pageNum
}
const reslist = await this.api.liveBroadcast(params)
if (reslist.code === 1) {
const res = reslist.data.list.data
if (res.length === 0) {
this.ifmore = false
this.videoclass = this.page === 1 ? res : this.videoclass.concat(res) // 合并数组
} else {
this.ifmore = true
this.videoclass = this.page === 1 ? res : this.videoclass.concat(res)
}
} else {
this.$toast(reslist.msg)
}
},
// 工种列表接口
async poslist () {
this.isShow = !this.isShow
}
},
mounted () {
this.height = document.documentElement.clientHeight - 110
if (localStorage.getItem('postname', this.postname)) {
this.postname = localStorage.getItem('postname', this.postname)
this.pId = localStorage.getItem('pId', this.pId)
}
this.userinfo = localStorage.getItem('userinfo', this.userinfo)
console.log(this.userinfo)
this.liveBroadcast()
}
}
</script>
<style scoped lang="scss">
.back,.picker{
width: 1.5rem;
}
.navbar{
background-color: #fff;
}
.lineclasstabs{
width: 100%;
/* height: 0.88rem; */
top: 0.88rem;
box-sizing: border-box;
position: fixed;
z-index: 8;
}
.choose{
position: fixed;
top: 1rem;
}
.scroll{
padding: 0.1rem 0.32rem 0.5rem !important;
box-sizing: border-box;
/* border: 0.01rem solid red; */
margin-top: 0 !important;
}
.live_list {
padding: 0.1rem 0.32rem 0.5rem !important;
width: 100%;
box-sizing: border-box;
}
.list{
flex-wrap: wrap;
box-sizing: border-box;
}
.blue{
background: linear-gradient(180.25deg, rgba(37,202.68,255,1) 0%, rgba(67.52,37,255,1) 100%);
}
.orange{
background: linear-gradient(180.25deg, rgba(255,193.96,37,1) 0%, rgba(255,102.4,37,1) 100%);
}
.grey{
background: rgba(0,0,0,0.5);
}
.linelistceont{
width: 100%;
position: relative;
top: 1.88rem;
left: 0;
}
</style>