MyCenterApe.js
35.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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
//*
// 首页模块
// */
import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import ErrorApe from "./ErrorApe";
import MessageTypes from "../MessageTypes";
const classifyList = `<div class="courseMinuteListTimeTit" style="display: {_isShowTitle}">
<span class="courseMinuteListTime">{_liveTimer}</span>
<span class="courseMinuteListWire"></span>
</div>
<div class="classifyListMyCenter {_classifyListR}" data="{_id}">
<div class="myCenterContentMask accessLearningBtn">
<button class="myCenterContentMaskBtn btnHover" data="{_meetingNumber}" value="{_studyMsg}">{_studyMsg}</button>
</div>
<div class="myCenterContentMask cancelReservation">
<button class="myCenterContentMaskBtn btnHover" data="{_studentMeetingId}">取消预约</button>
</div>
<img class="myCenterContentListImg" src="{_msgImg}" alt="">
<p class="myCenterContentListTit">{_meetingName}</p>
<p class="myCenterContentListTit1">主讲人:{_create_user}</p>
<p class="myCenterContentMin">45min</p>
<span class="myCenterContentTimer">{_liveTimer}</span>
</div>`;
const curriculumList = `<li class="teacherTodayCourseList">
<span class="courseDetailInfo">{_infoTit}</span>
<span class="courseDetailInfo1">距开始还有:<i class="teacherStartContent">{_countDown}</i></span>
<button class="teacherEnterClass btnHover" data="{_meetingNumber}" style="display: {_isShow}">立即进入</button>
</li>`;
const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" class="t_box">
<tbody>
<tr align="center" height="44" class="tr_center" bgcolor="#fff" bordercolor="#e6e6e6">
<th width="7%" class="tr_center">
课堂主题
</th>
<th width="7%" class="tr_center">
课堂号
</th>
<th width="7%" class="tr_center">
老师
</th>
<th width="7%" class="tr_center">
课堂状态
</th>
<th width="15%" class="tr_center">
课堂时间
</th>
<th width="7%" class="tr_center">
在线人数
</th>
<th width="10%" class="tr_center">
操作
</th>
</tr>
`;
//管理首页
const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor="#e6e6e6">
<td width="7%" class="tr_main tr_mainLeft">{_meetingName}</td>
<td width="7%" class="tr_main">{_meetingNumber}</td>
<td width="7%" class="tr_main">{_create_user}</td>
<td width="7%" class="tr_main">{_state}</td>
<td width="15%" class="tr_main">{_timer}</td>
<td width="7%" class="tr_main">{_num}</td>
<td width="10%" class="tr_main tr_mainRight" align="center">
<a class="classHandlePort deleteClass" data="{_aboutMsg}" href="javascript:void(0);">文档</a>
<a class="classHandlePort deleteClass" data="{_aboutMsg}" href="javascript:void(0);">多媒体</a>
<a class="classHandlePort resolveBtn" href="javascript:void(0);" data="{_aboutMsg}">伴音</a>
</td>
</tr>
`;
const adminListEnd = `</tbody></table>`;
let loger = Loger.getLoger('PC-MyCenterApe');
class MyCenterApe extends Ape {
constructor() {
super();
this.isLocalStorage();
this.data = 0;
this.dataList = {};
this.teacherList = {};
this.presentInd = 1;//点击翻页默认为第一页
this.pageNo = 0; //首页老师端 直播默认页码
this.pageNo1 = 1; //首页老师端 课程默认页码
this._judgeListPlace();
this.addEvent();
this.init();
}
init() {
$('#personageInfo').on('click',this._myCenterBoxHandler.bind(this));//个人中心
$('#teacherUI li').on('click',this._recordLiHandler.bind(this));//课堂分类
$('#teacherInfoList li').on('click',this._teacherInfoListHandler.bind(this));//首页 老师 直播分类 正在直播 未开始 已结束
$('#studentInfoList li').on('click',this._studentInfoListHandler.bind(this));//首页 学生 待学习 已学完 收藏
$('#teacherMyCerterHomePage0').on('click',this._homePageHandler.bind(this));//首页
$('#teacherMyCerterUpPage0').on('click',this._upPageHandler.bind(this));//上页
$('#teacherMyCerterDownPage0').on('click',this._downPageHandler.bind(this));//下页
$('#teacherMyCerterEndPage0').on('click',this._endPageHandler.bind(this));//尾页
$('#teacherMyCerterSpecificPage0').on('click',this._assignPageHandler.bind(this));//指定页
$('#teacherMyCerterHomePage1').on('click',this._homePageHandler.bind(this));//首页
$('#teacherMyCerterUpPage1').on('click',this._upPageHandler.bind(this));//上页
$('#teacherMyCerterDownPage1').on('click',this._downPageHandler.bind(this));//下页
$('#teacherMyCerterEndPage1').on('click',this._endPageHandler.bind(this));//尾页
$('#teacherMyCerterSpecificPage1').on('click',this._assignPageHandler.bind(this));//指定页
$('#teacherMyCerterHomePage2').on('click',this._homePageHandler.bind(this));//首页
$('#teacherMyCerterUpPage2').on('click',this._upPageHandler.bind(this));//上页
$('#teacherMyCerterDownPage2').on('click',this._downPageHandler.bind(this));//下页
$('#teacherMyCerterEndPage2').on('click',this._endPageHandler.bind(this));//尾页
$('#teacherMyCerterSpecificPage2').on('click',this._assignPageHandler.bind(this));//指定页
}
addEvent() {
}
defaultDateList(){
let studentInfoList = $('#studentInfoList');
this._anewLoad(studentInfoList)//默认显示第一个列表
}
//首页
_homePageHandler(){
this.presentInd = 1;
let ind = $('#teacherMyCerterPage').attr('data');
switch (parseInt(ind)){
case 1:
this._teacherLiveModule(this.presentInd);
break;
case 2:
this._teacherNoneLiveModule(this.presentInd);
break;
case 4:
this._teacherEndLiveModule(this.presentInd);
break;
default:
return;
}
}
//上页
_upPageHandler(){
if(this.presentInd > 1){
this.presentInd--;
let ind = $('#teacherMyCerterPage').attr('data');
switch (parseInt(ind)){
case 1:
this._teacherLiveModule(this.presentInd);
break;
case 2:
this._teacherNoneLiveModule(this.presentInd);
break;
case 4:
this._teacherEndLiveModule(this.presentInd);
break;
default:
return;
}
}
}
//下页
_downPageHandler(){
if(this.presentInd < this.pageNo){
this.presentInd++;
let ind = $('#teacherMyCerterPage').attr('data');
switch (parseInt(ind)){
case 1:
this._teacherLiveModule(this.presentInd);
break;
case 2:
this._teacherNoneLiveModule(this.presentInd);
break;
case 4:
this._teacherEndLiveModule(this.presentInd);
break;
default:
return;
}
}
}
//尾页
_endPageHandler(){
this.presentInd = this.pageNo;
let ind = $('#teacherMyCerterPage').attr('data');
switch (parseInt(ind)){
case 1:
this._teacherLiveModule(this.presentInd);
break;
case 2:
this._teacherNoneLiveModule(this.presentInd);
break;
case 4:
this._teacherEndLiveModule(this.presentInd);
break;
default:
return;
}
}
//指定页
_assignPageHandler(){
let val;
let ind = $('#teacherMyCerterPage').attr('data');
let card = $('#teacherInfoList .liveInfoLeftLiCheck').index();
let inputVal = $('#teacherMyCerterPageInfoInput'+card).val();
if(parseInt(inputVal) > this.pageNo ){
val = this.pageNo;
}else if(parseInt(inputVal) < 1){
val = 1;
}else{
val = parseInt(inputVal)
}
switch (parseInt(ind)){
case 1:
this._teacherLiveModule(val);
break;
case 2:
this._teacherNoneLiveModule(val);
break;
case 4:
this._teacherEndLiveModule(val);
break;
default:
return;
}
$('#teacherMyCerterPageInfoInput'+card).val('')
}
detailpage(){
this._showStatus();
this.defaultDateList();
}
loadMeeting(meeting){
let status = meeting["meetingStatus"];
if(status != ''){
if (status == "1" || status == "2") {
return '已开始';
}else{
if (status == "2") {
// alert("会议已经开始!");
return '已开始';
} else if (status == "3") {
return '未开始';
// alert("未到开始时间!");
} else if (status == "4") {
// alert("会议已经结束!");
return '已结束';
}
}
}
}
//老师端数据请求
_teacherCurriculumInfo(data,num,ind,callback){
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
let that = this;
$.ajax({
type: "POST",
url: _url,
timeout:5000,
data : data,
headers: {siteId:ClassDataProxy.siteId,pageno:num, page:ind,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
_studentCurriculumInfo(num,_data,callback){
if(ClassDataProxy.id == ''){
return;
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/getStudentMeetingByStudentId/'+ClassDataProxy.id;
let that = this;
$.ajax({
type: "POST",
url: _url,
timeout:5000,
data:_data,
headers: {siteId:ClassDataProxy.siteId,pageno:num,id:ClassDataProxy.id,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
//老师端首页默认数据
detailPageTeacher(){
//首页课程
this._teacherCourseModule();
//首页直播信息
this.teacherListSwitch();
}
studentListSwitch(){
//首页课程
let ind = $('#studentInfoList .liveInfoLeftLiCheck').attr('data');
switch (parseInt(ind)){
case 0:
//待学习
this._studentStudyModule();
break;
case 1:
//已学完
this._studentStudyOverModule();
break;
case 2:
//收藏
this._studenTcollectModule();
break;
default:
return;
}
}
//学生端首页默认数据
detailPageStudent(){
//首页课程
this._studentCourseModule();
//首页直播信息
this.studentListSwitch();
}
_anewLoad(ele){
ele.find('.liveInfoLeftLi').eq(0).addClass('liveInfoLeftLiCheck').siblings().removeClass('liveInfoLeftLiCheck')
}
_showStatus(){
let newDate = new Date();
let newHours = newDate.getHours();
let text = newHours>12?'下午好,':'上午好,'
$('#teacherMyCenterTime').text(text);
$('#teacherMyCenterName').text(ClassDataProxy.loginName);
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
$('#teacherMyCenterStatus').text('老师');
$('#teacherMyCerter').show();
$('#studentMyCerter').hide();
$('#teacherUI .recordLi').eq(2).hide();
this.detailPageTeacher();
$('#myCenterBox').show();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
$('#teacherMyCenterStatus').text('同学');
$('#teacherMyCerter').hide();
$('#studentMyCerter').show();
$('#teacherUI .recordLi').eq(2).show();
this.detailPageStudent();
}
}
isLocalStorage(){
this.detailpage();
$('#lanclassBox').hide();
if(ClassDataProxy.userPhoto == null || ClassDataProxy.userPhoto == ''){
$('#myCenterImg').attr('src',ClassDataProxy.userPhoto)//个人信息首页
$('#personagePortrait').attr('src',ClassDataProxy.userPhoto)//个人信息
}else{
$('#myCenterImg').attr('src','../images/u373.png')//个人信息首页
$('#personagePortrait').attr('src','../images/u373.png')//个人信息
}
$('#oneselfInfoLoginName').val( ClassDataProxy.loginName);//登录名
$('#oneselfInfoUserName').val(ClassDataProxy.monicker);//用户名
let setMail = $('#setMail');//邮箱
let setPhone = $('#setPhone');//手机号
let userEmail = this.updateEmail(ClassDataProxy.userEmail);
let userMobile = this.updateMobile(ClassDataProxy.userMobile);
setMail.attr('data',ClassDataProxy.userEmail);
setPhone.attr('data',ClassDataProxy.userMobile);
setMail.html(userEmail)
setPhone.html(userMobile)
}
_recordLiHandler(evt){
let ind = $(evt.currentTarget).attr('data');
$(evt.currentTarget).addClass('recordLiCheck').siblings().removeClass('recordLiCheck');
$('.myCenterContentBox').eq(ind).show().siblings().hide();
switch (parseInt(ind)){
case 0:
//首页
this.detailpage();
break;
case 1:
//我的课程
this._emit(MessageTypes.MY_COURSES);
break;
case 2:
//我的预约
this._emit(MessageTypes.MY_BOOKINGS);
break;
case 3:
//个人信息
this._emit(MessageTypes.ROLE_MESSAGE);
break;
default:
return;
}
}
/*-------------------老师-------------------*/
teacherListSwitch(){
let ind = $('#teacherInfoList .liveInfoLeftLiCheck').attr('data');
let card = $('#teacherInfoList .liveInfoLeftLiCheck').index();
$('#teacherMyCerterPage').attr('data',ind)
let status = parseInt(ind);
$('#teacherMyCerterPageBox'+card).show().siblings().hide();
this.presentInd = 1;
switch (status){
case 1:
//正在直播
this._teacherLiveModule(1);
break;
case 2:
//未开始
this._teacherNoneLiveModule(1);
break;
case 4:
//已结束
this._teacherEndLiveModule(1);
break;
default:
return;
}
}
//老师端首页课程显示
_teacherCourseModule(){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName};
let that = this;
this._teacherCurriculumInfo(data,3,1,function(_data){
//首页今日课程渲染
if(_data){
that._teacherCourseCourse(_data.returnData.data.meetingInfo);
}
})
}
//老师端首页课程数据渲染
_teacherCourseCourse(_data){
let myCurriculumInfo = $('#myCurriculumInfo');
if(_data){
let that = this;
let timerNew = null;
let newTimeDateList = [];
for(let j = 0;j<_data.length; j++){
if (ClassDataProxy.getTimeDay(_data[j].meetingEndTime)) {
newTimeDateList.push(_data[j])
}
}
if(newTimeDateList.length > 0){
setInterval(function () {
myCurriculumInfo.empty();
for (let i = 0; i < _data.length; i++) {
let item = _data[i];
if (item) {
let lastTimer = 0;
let timer = ClassDataProxy.getTimeCountDown(item.meetingBeginTime, item.meetingEndTime)
if(timer.indexOf('|') !=-1){
timer = timer.substr(0,timer.length-1);
lastTimer = 1;
}else if(timer.indexOf('.') !=-1){
timer = timer.substr(0,timer.length-1);
lastTimer = 0;
}
let curInfo = that._format(curriculumList, {
_infoTit: item.meetingName,
_meetingNumber: item.meetingId,
_countDown: timer,
_isShow: (lastTimer == 1) ? 'none' : 'block'
})
myCurriculumInfo.append(curInfo);
} else {
console.error('_gainClassData没数据')
}
}
},1000)
}else{
clearInterval(timerNew);
let _classifyList = '<div class="myCenterErrorTitle">暂无数据~</div>';
myCurriculumInfo.empty();
myCurriculumInfo.append(_classifyList)
}
}
}
//老师端首页直播数据
_teacherLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:1};
let that = this;
this._teacherCurriculumInfo(data,4,ind,function(_data){
//首页直播信息渲染 正在直播
if(_data){
that._teacherLivePage(_data.returnData.data);
that._teacherLiveCourse(_data.returnData.data);
}
})
}
_teacherNoneLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:2};
let that = this;
this._teacherCurriculumInfo(data,4,ind,function(_data){
//首页直播信息渲染 未开始
if(_data){
that._teacherNotPage(_data.returnData.data);
that._teacherLiveCourse(_data.returnData.data);
}
})
}
_teacherEndLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:4};
let that = this;
this._teacherCurriculumInfo(data,4,ind,function(_data){
//首页直播信息渲染 结束
if(_data){
that._teacherOverPage(_data.returnData.data);
that._teacherLiveCourse(_data.returnData.data);
}
})
}
_teacherLiveCourse(_data){
let teacherMyCenterContentList = $('#teacherMyCenterContentList');
teacherMyCenterContentList.empty();
if(_data){
let _dataList = _data.meetingInfo;
if(_dataList.length > 0){
teacherMyCenterContentList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
// _state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_state : "准备",
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
teacherMyCenterContentList.append(_adminList)
}
teacherMyCenterContentList.append(adminListEnd)
}else{
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>';
teacherMyCenterContentList.append(_classifyList)
}
}else{
loger.log('没有直播数据')
}
}
_teacherLivePage(_data){
if(_data){
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg0').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <=4){
$('#teacherMyCerterPageBox0').hide();
}
}
}
_teacherNotPage(_data){
if(_data){
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg1').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <=4){
$('#teacherMyCerterPageBox1').hide();
}
}
}
_teacherOverPage(_data){
if(_data){
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg2').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <=4){
$('#teacherMyCerterPageBox2').hide();
}
}
}
/*---------------------------学生-----------------------*/
//学生端首页課程显示
_studentCourseModule(){
let that = this;
let data = {siteId:ClassDataProxy.siteId};
this._studentCurriculumInfo(3,data,function(_data){
if(_data){
that.studentCourseList(_data.returnData.data);
}
})
}
studentCourseList(_data){
let myCurriculumInfo = $('#myCurriculumInfo');
if(_data){
let that = this;
let timerNew = null;
let newTimeDateList = [];
for(let j = 0;j<_data.length; j++){
if (ClassDataProxy.getTimeDay(_data[j].meetingEndTime)) {
newTimeDateList.push(_data[j])
}
}
if(newTimeDateList.length > 0){
timerNew = setInterval(function () {
myCurriculumInfo.empty();
for (let i = 0; i < newTimeDateList.length; i++) {
let item = newTimeDateList[i];
if (item) {
let lastTimer = 0;
let timer = ClassDataProxy.getTimeCountDown(item.meetingBeginTime, item.meetingEndTime)
if(timer.indexOf('|') !=-1){
timer = timer.substr(0,timer.length-1);
lastTimer = 1;
}else if(timer.indexOf('.') !=-1){
timer = timer.substr(0,timer.length-1);
lastTimer = 0;
}
let curInfo = that._format(curriculumList, {
_infoTit: item.meeting_name,
_meetingNumber: item.meetingId,
_countDown: timer,
_isShow: (lastTimer == 1) ? 'none' : 'block'
})
myCurriculumInfo.append(curInfo);
} else {
console.error('_gainClassData没数据')
}
}
},1000)
}else{
clearInterval(timerNew);
let _classifyList = '<div class="myCenterErrorTitle">暂无数据~</div>';
myCurriculumInfo.empty();
myCurriculumInfo.append(_classifyList)
}
}
}
//学生端首页 待学习数据
_studentStudyModule(){
let studentMyCenterContentList = $('#studentMyCenterContentList');
let that = this;
let data = {siteId:ClassDataProxy.siteId};
this._studentCurriculumInfo(4,data,function(_data){
if(_data){
that.studentStudyList(studentMyCenterContentList,_data.returnData.data);
}
})
}
studentStudyList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
let recordData = 0;
if(_data){
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let defaultImg = '../images/u373.png';
let _img = _data[i].meetingPhoto;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_id:_data[i].meetingId,
_studyMsg:'进入学习',
_meetingNumber : _data[i].meetingId,
_msgImg : _img?_img:defaultImg,
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
recordData = 1;
}
}else{
console.error('_gainClassData没数据')
}
}
}
if(recordData == 0){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>';
studentMyCenterContentList.append(_classifyList)
}
}
//已学完
_studentStudyOverModule(){
let studentMyCenterContentList = $('#studentMyCenterContentList');
let that = this;
let data = {siteId:ClassDataProxy.siteId};
this._studentCurriculumInfo(4,data,function(_data){
if(_data){
that.studentStudyOverList(studentMyCenterContentList,_data.returnData.data);
}
})
}
studentStudyOverList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
let recordData = 0;
if(_data){
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(!ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let defaultImg = '../images/u373.png';
let _img = _data[i].meetingPhoto;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_id:_data[i].meetingId,
_studyMsg:'继续学习',
_meetingNumber : _data[i].meetingId,
_msgImg : _img?_img:defaultImg,
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
recordData = 1;
}
}else{
console.error('_gainClassData没数据')
}
}
}
if(recordData == 0){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>';
studentMyCenterContentList.append(_classifyList)
}
}
//收藏
_studenTcollectModule(){
let meetingId = $('#lanclassBox').attr('data');
let studentMyCenterContentList = $('#studentMyCenterContentList');
let that = this;
let data = {status:7,siteId:ClassDataProxy.siteId,id:ClassDataProxy.id,meetingId:meetingId};
this._studentCurriculumInfo(4,data,function(_data){
if(_data){
that.studentTcollectList(studentMyCenterContentList,_data.returnData.data);
}
})
}
studentTcollectList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
let recordData = 0;
if(_data){
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(!ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let defaultImg = '../images/u373.png';
let _img = _data[i].meetingPhoto;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_studyMsg:'取消收藏',
_id:_data[i].meetingId,
_meetingNumber : _data[i].meetingNumber,
_msgImg : _img?_img:defaultImg,
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
recordData = 1;
}
}else{
console.error('_gainClassData没数据')
}
}
}
if(recordData == 0){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>';
studentMyCenterContentList.append(_classifyList)
}
}
clearLocalStorage(){
window.localStorage.clear();
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
ClassDataProxy.loginName ="";
ClassDataProxy.password =""
ClassDataProxy.token ="";
ClassDataProxy.status = false;
}
//学生端 我的课程 切换
_myCenterBoxHandler(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){
return;
}
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#classifyListBox').hide();
$('#lanclassBox').hide();
$('#liveContentAllBox').hide();
$('#lanclassAllBox').hide();
$('#teacherIntroAllBox').hide();
$('#teacherDetailBox').hide();
$('#teacherUI .recordLi').eq(2).show();
$('#myCenterBox').show();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
$('#myCenterBox').show();
}
}
updateEmail(userEmail){
return userEmail.replace(/(\d{2})\d{2}(\d{1})/, '$1****$2')
}
updateMobile(userMobile){
return userMobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
_judgeListPlace(){
let i;
let curriculumList = document.getElementsByClassName('classifyListMyCenter');
for(i=0;i<curriculumList.length;i++){
if((i%4) == 3){
$(curriculumList[i]).addClass('classifyListR');
}
}
}
//切换类的公用样式
commonality(evt){
$(evt.currentTarget).addClass('liveInfoLeftLiCheck').siblings().removeClass('liveInfoLeftLiCheck');
}
_teacherInfoListHandler(evt){
this.commonality(evt);
this.teacherListSwitch();
}
//学生端 首页
_studentInfoListHandler(evt){
this.commonality(evt);
this.studentListSwitch();
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
return obj[group];
});
};
}
export default MyCenterApe;