ClassApe.js
26.5 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
//*
// 课堂管理模块
// */
import Loger from "../Loger";
import Ape from "./Ape";
import xdysdk from "libs/xdysdk";
import ClassDataProxy from "proxy/ClassDataProxy";
import $ from "jquery";
import FlashToolComponet from "libs/FlashToolComponet";
import ErrorApe from './ErrorApe';
let loger = Loger.getLoger('PC-ClassApe');
class ClassApe extends Ape {
constructor() {
super();
this.isExit = false;//是否点击了退出或结束课堂
this.curClassStuNum = 0;
this._isEndClass = false; //判断是否点击结束课堂
this._isExitClass = false;//判断是否点击退出课堂
this._isNetwork = false;//判断是否有网络
this.addEvent();
this.init();
this._setClassStatus();
//显示页面信息
this._showPageInfo();
}
init() {
//设置当前版本号
$('#pcVersion').text("v2.58.3.20170823");
//布局,未加入课堂成之前上课界面不显示
//$('.header').hide();
//$(".content ").hide();
$(".loginBg ").show();//登陆框
$(".initParamsOut ").show();//初始化界面
//默认先尝试自动登陆,初始化的按钮先隐藏
//隐藏初始化界面UI
this._hideInitUI();
//隐藏登陆界面UI
this._hideLoginUI();
//header 按钮点击事件
$('.startClass').on("click", this._startClassHandler.bind(this));
$('.pauseClass').on("click", this._pasueClassHandler.bind(this));
$('.closeClass').on("click", this._closeClassHandler.bind(this));//结束课堂(所有人都要退出)
//$('.endClassEnsure').on("click", this._closeClassEnsureHandler.bind(this));
//$('.endClassCancel').on("click", this._closeClassCancelHandler.bind(this));
$('.help').on("click", this._helpHandler.bind(this));
$('.exit').on("click", this._exitClassHandler.bind(this));//退出课堂
$('.exitClassA').on("click", this._exitClassPopupHandler.bind(this));
//$('.exitClassEnsure').on("click", this._exitClassEnsureHandler.bind(this));
//$('.exitClassCancel').on("click", this._exitClassCancelHandler.bind(this));
$(".helpHeadline .iconfont").on("click", this._closeHelpHandler.bind(this));
//$(".setHeadline .iconfont").on("click", this._closeSetHandler.bind(this));
//初始化界面按钮
$('.ensureTeaBtn').show();
$('.ensureStuBtn').show();
$('.ensureTeaBtn').on("click", this._stuInitHandler.bind(this));
$('.ensureStuBtn').on("click", this._teacherInitHandler.bind(this));
//登陆界面按钮
$('.btnLoginLi').on("click", this._loginHandler.bind(this));
let that = this;
$(".passWordInput").on("keydown", function (e) {
let curKey = e.which;
if (curKey == 13) that._loginHandler();
});
}
addEvent() {
xdysdk.on("error_event", this._classErrorHandler.bind(this));
xdysdk.on("class_init_success", this._classInitSuccessHandler.bind(this));
xdysdk.on("class_get_info_success", this._classGetInfoSuccessHandler.bind(this));
xdysdk.on("class_join_success", this._classJoinSuccessHandler.bind(this));
xdysdk.on("class_update_status", this._classUpdateHandler.bind(this));//会议状态更新
xdysdk.on("class_insert_roster", this._classInsertRosterHandler.bind(this));//会议有用户加入
xdysdk.on("class_delete_roster", this._classDeleteRosterHandler.bind(this));//会议有人离开
xdysdk.on("class_update_timer", this._classUpdateTimerHandler.bind(this));//更新会议时间显示
xdysdk.on("class_exit", this._classExitHandler.bind(this));
}
//设置文字显示国际化
_showPageInfo() {
$('#memberNum').text(ClassDataProxy.localConfig.memberNum);
$('.exitText').text(ClassDataProxy.localConfig.exitBtn);
$('.settingText').text(ClassDataProxy.localConfig.setBtn);
$('.helpText').text(ClassDataProxy.localConfig.helpBtn);
$('#endClassroom').text(ClassDataProxy.localConfig.endClassroom);
$('#pauseClassroom').text(ClassDataProxy.localConfig.pauseClassroom);
$('#startClassroom').text(ClassDataProxy.localConfig.startClassroom);
$('.btnPublishVideo').attr('title', ClassDataProxy.localConfig.openVideo);
$('.btnPublishAudio').attr('title', ClassDataProxy.localConfig.openAudio);
$('.btnOpenVideo').attr('title', ClassDataProxy.localConfig.openVideo);
$('.btnOpenAudio').attr('title', ClassDataProxy.localConfig.openAudio);
$('.btnStopPublishVideo').attr('title', ClassDataProxy.localConfig.closeVideo);
$('.btnStopPublishAudio').attr('title', ClassDataProxy.localConfig.closeAudio);
$('.btnStopPublishMedia').attr('title', ClassDataProxy.localConfig.closeMedia);
$('#showColor').attr('title', ClassDataProxy.localConfig.showColor);
$('#controlBrush').attr('title', ClassDataProxy.localConfig.controlBrush);
$('.pencil').attr('title', ClassDataProxy.localConfig.pencil);
$('.rescind').attr('title', ClassDataProxy.localConfig.rescind);
$('.clearContent').attr('title', ClassDataProxy.localConfig.delete);
$('#pptNextStep').attr('title', ClassDataProxy.localConfig.downAnimated);
$('#pptPrevStep').attr('title', ClassDataProxy.localConfig.onAnimated);
$('#fitHeight').attr('title', ClassDataProxy.localConfig.adaptiveHigh);
$('#fitWidth').attr('title', ClassDataProxy.localConfig.adaptiveWidth);
$('#fitNormal').attr('title', ClassDataProxy.localConfig.showAll);
$('#raiseBtn').attr('title', ClassDataProxy.localConfig.raiseBtn);
$('.userNameInput').attr('placeholder', ClassDataProxy.localConfig.enterUserName);
$('.passWordInput').attr('placeholder', ClassDataProxy.localConfig.enterPassword);
$('.classId').attr('placeholder', ClassDataProxy.localConfig.enterClass);
$('.userId').attr('placeholder', ClassDataProxy.localConfig.enterId);
$('#member').text(ClassDataProxy.localConfig.member);
$('#discuss').text(ClassDataProxy.localConfig.discuss);
$('#btn_send').text(ClassDataProxy.localConfig.sendMsg);
$('#docListTitle').text(ClassDataProxy.localConfig.documentList);
$('#mediaListTitle').text(ClassDataProxy.localConfig.mediaShareList);
$('.helpHeadlineTitle').text(ClassDataProxy.localConfig.help);
$('.setHeadlineTitle').text(ClassDataProxy.localConfig.setUp);
$('#camera').text(ClassDataProxy.localConfig.camera);
$('#microphone').text(ClassDataProxy.localConfig.microphone);
$('#volume').text(ClassDataProxy.localConfig.volume);
$('.setSave').text(ClassDataProxy.localConfig.preserve);
$('.setCancel').text(ClassDataProxy.localConfig.cancel);
$('.endClassHeadlineTitle').text(ClassDataProxy.localConfig.endClassroom);
$('.endClassText').text(ClassDataProxy.localConfig.endClassroomCont);
//$('.endClassEnsure').text(ClassDataProxy.localConfig.confirm);
//$('.endClassCancel').text(ClassDataProxy.localConfig.cancel);
$('.exitClassHeadlineTitle').text(ClassDataProxy.localConfig.exitBtn);
$('.exitClassText').text(ClassDataProxy.localConfig.exitCont);
//$('.exitClassEnsure').text(ClassDataProxy.localConfig.confirm);
//$('.exitClassCancel').text(ClassDataProxy.localConfig.cancel);
$('#btnLogin').text(ClassDataProxy.localConfig.register);
$('.ensureTeaBtn').text(ClassDataProxy.localConfig.teacher);
$('.ensureStuBtn').text(ClassDataProxy.localConfig.student);
$('#opening').html(ClassDataProxy.localConfig.opening);
$('#download').html(ClassDataProxy.localConfig.downloadVersion);
$('#downloading').html(ClassDataProxy.localConfig.downloading);
$('#stopShare').html(ClassDataProxy.localConfig.stopSharing);
$('.themeHeadlineTitle,.resultHeadlineTitle,.studentHeadline,.answerText').html(ClassDataProxy.localConfig.answerSheet);
$('.signHeadlineTitle,.signStudentHeadlineTitle,.signText').html(ClassDataProxy.localConfig.rollCall);
$('#docListOut').attr('title', ClassDataProxy.localConfig.selectFile);
$('#screenSharingOut').attr('title', ClassDataProxy.localConfig.screenSharing);
$('#mediaUpLoadOut').attr('title', ClassDataProxy.localConfig.updateMediaFile);
$('#mediaListOut').attr('title', ClassDataProxy.localConfig.selectMediaFile);
$('#uploadAudio').attr('title', ClassDataProxy.localConfig.uploadAudio);
$('.laserPen').attr('title', ClassDataProxy.localConfig.laserPen);
$('.sponsorSign').html(ClassDataProxy.localConfig.startName);
$('.attendance').html(ClassDataProxy.localConfig.attendance);
$('.turnResultBtn').html(ClassDataProxy.localConfig.terminationRollCall);
$('.turnStudentBtn').html(ClassDataProxy.localConfig.signIn);
$('.themeTit').html(ClassDataProxy.localConfig.cardType);
$('.gotIt').html(ClassDataProxy.localConfig.gotIt);
$('.understand').html(ClassDataProxy.localConfig.understand);
$('.yes').html(ClassDataProxy.localConfig.yes);
$('.wrong').html(ClassDataProxy.localConfig.wrong);
$('.yup').html(ClassDataProxy.localConfig.yup);
$('.nothing').html(ClassDataProxy.localConfig.nothing);
$('.answerTime').html(ClassDataProxy.localConfig.answerTime);
$('.dynamicRight').html(ClassDataProxy.localConfig.release);
$('.enterAnswer').html(ClassDataProxy.localConfig.enterAnswer);
$('.answerResult').html(ClassDataProxy.localConfig.answerResult);
$('.share').html(ClassDataProxy.localConfig.share);
$('.participation').html(ClassDataProxy.localConfig.participation);
$('.resultConceal').html(ClassDataProxy.localConfig.hideCount);
$('.resultTermination').html(ClassDataProxy.localConfig.termination);
$('.referBtn').html(ClassDataProxy.localConfig.submitMsg);
$('.abandonBtn').html(ClassDataProxy.localConfig.giveUp);
$('.mediaFileContentTxt').html(ClassDataProxy.localConfig.listedFiles);
$('.mediaFileContentMenuLableTxt').html(ClassDataProxy.localConfig.upload);
$('#musicListTitle').html(ClassDataProxy.localConfig.audioFilelist);
$('.inputCount').html(ClassDataProxy.localConfig.answerIsNotEmpty);
$('.downloadCancel').html(ClassDataProxy.localConfig.cancel);
$('#showForm').attr('title', ClassDataProxy.localConfig.selectShape);//选择形状
$('#curveBrush').attr('title', ClassDataProxy.localConfig.curveStyle);//曲线
$('#straightBrush').attr('title', ClassDataProxy.localConfig.justStyle);//直线
$('#circleBrush').attr('title', ClassDataProxy.localConfig.circleStyle);//圆形
$('#squareBrush').attr('title', ClassDataProxy.localConfig.squareStyle);//方形
//询问弹框中的确定和取消按钮
$('#choiceConfirm').html(ClassDataProxy.localConfig.confirm);
$('#choiceCancel').html(ClassDataProxy.localConfig.cancel);
//提示框
$('#nowLiveVersion').html(ClassDataProxy.localConfig.nowLiveVersion);
$('#nowPlaybackVersion').html(ClassDataProxy.localConfig.nowPlaybackVersion);
$('#browserAreaSettings').html(ClassDataProxy.localConfig.browserAreaSettings);
$('.speed360Recommend').html(ClassDataProxy.localConfig.speed360Recommend);
$('.speed360').html(ClassDataProxy.localConfig.speed360);
$('.security360').html(ClassDataProxy.localConfig.security360);
$('.security360Only').html(ClassDataProxy.localConfig.security360Only);
$('.sogouExplorer').html(ClassDataProxy.localConfig.sogouExplorer);
$('#flashVersionsLow').html(ClassDataProxy.localConfig.flashVersionsLow);
$('#flashDownload').html(ClassDataProxy.localConfig.download);
$('#flashRetry').html(ClassDataProxy.localConfig.retry);
$('.flashForbiddenMsg').html(ClassDataProxy.localConfig.flashForbiddenMsg);
$('#flashMsgContent').html(ClassDataProxy.localConfig.flashMsgContent);
$('#flashDetailSteps').html(ClassDataProxy.localConfig.flashDetailSteps);
$('#flashUpdataVersions').html(ClassDataProxy.localConfig.flashUpdataVersions);
}
_showInitClassInuptBox() {
this._showInitUI();
$(".classId ").val(ClassDataProxy.classId);
$(".userId ").val(ClassDataProxy.userId);
$(".initParamsOut ").show();
}
_showJoinClassInputBox() {
$(".userNameInput ").val(ClassDataProxy.userName);
$(".loginBg ").show();
this._showLoginUI();
if (ClassDataProxy.passwordRequired) {
$(".passWordInput ").val(ClassDataProxy.password);
} else {
$(".passWordLi ").hide();
loger.log("ClassDataProxy.passwordRequired", ClassDataProxy.passwordRequired);
}
}
//EVENT--------------------------------------------------
startClassRun() {
this._initClass();
}
//初始化课堂
_initClass() {
loger.log("initClass", ClassDataProxy.getInitClassData());
loger.log("是否是录制回放->", ClassDataProxy.isRecordPlayBack);
$(".initParams .errorTip").text(ClassDataProxy.localConfig.initClass);
$(".initParams .errorTip").show();
//隐藏初始化和登陆按钮,如果是自动登陆,这些按钮就不用显示了
this._hideInitUI();
$(".classId ").val(ClassDataProxy.classId);
$(".userId ").val(ClassDataProxy.userId);
if (ClassDataProxy.isRecordPlayBack) {
$("#mainContentBox ").css("top", "2px");
xdysdk.api("initRecordPlayback", ClassDataProxy.getInitClassData());
} else {
xdysdk.api("init", ClassDataProxy.getInitClassData());
}
}
//加入课堂
_joinClass() {
loger.log("joinClass", ClassDataProxy.getJoinClassData());
this._hideLoginUI();
$(".btnLoginLi ").hide();
$(".initParamsOut ").hide();
$(".userNameInput ").val(ClassDataProxy.userName);
$(".passWordInput ").val(ClassDataProxy.password);
$(".loginContent .errorTip").text(ClassDataProxy.localConfig.initClass);
xdysdk.api("joinClass", ClassDataProxy.getJoinClassData());
}
_setClassStatus() {
if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) {
//设置状态显示
if (ClassDataProxy.classStatus == 1) {
$('.startClass').hide();
$('.pauseClass').show();
} else {
$('.startClass').show();
$('.pauseClass').hide();
}
}
//录制回放状态
if (ClassDataProxy.isRecordPlayBack) {
$('.classStatus').text(ClassDataProxy.localConfig.playback);
$('.classStatus').css("color", "#d95136");
$('.classStatusIcon').html('');
$('.classStatusIcon').css("color", "#d95136");
return;
}
//正常使用状态
if (ClassDataProxy.classStatus == 1) {
$('.classStatus').text(ClassDataProxy.localConfig.liveBroadcast);
$('.classStatus').css("color", "#d95136");
$('.classStatusIcon').html('');
$('.classStatusIcon').css("color", "#d95136");
} else if (ClassDataProxy.classStatus == 2) {
$('.classStatus').text(ClassDataProxy.localConfig.rest);
$('.classStatusIcon').html('');
$('.classStatusIcon').css("color", "#ccc");
$('.classStatus').css("color", "#ccc");
} else {
$('.classStatus').text(ClassDataProxy.localConfig.notStart);
$('.classStatusIcon').html('');
$('.classStatusIcon').css("color", "#ccc");
$('.classStatus').css("color", "#ccc");
}
}
_hideInitUI() {
loger.log("_hideInitUI");
$(".initParamsClassId ").hide();
$(".initParamsUserId ").hide();
$(".initParamsRoleBtn ").hide();
$('.initParamsBox').css('background', '');
}
_showInitUI() {
loger.log("_showInitUI");
$(".initParamsClassId ").show();
$(".initParamsUserId ").show();
$(".initParamsRoleBtn ").show();
$(".initParams .errorTip").show();
$('.initParamsBox').css('background', '#484646');
}
_hideLoginUI() {
$(".btnLoginLi ").hide();
$(".userNameLi ").hide();
$(".passWordLi ").hide();
$('.loginContentBox').css('background', '');
}
_showLoginUI() {
$(".btnLoginLi ").show();
$(".userNameLi ").show();
$(".passWordLi ").show();
$('.loginContentBox').css('background', '#484646');
}
//xdysdk事件监听处理--------------------------------------
_classErrorHandler(_data) {
loger.warn("_classErrorHandler", _data);
switch (_data.code) {
case 100:
case 101:
case 102:
case 103:
case 105:
case 106:
case 107:
case 301:
this._showInitClassInuptBox();
$(".initParams .errorTip").text("" + _data.reson);
break;
case 200:
case 201:
case 202:
case 203:
case 204:
case 205:
case 207:
this._showJoinClassInputBox();
$(".loginContent .errorTip").text("" + _data.reson);
break;
case 206:
//请输入正确密码
this._showJoinClassInputBox();
$(".loginContent .errorTip").text(ClassDataProxy.localConfig.correctPassword);
break;
case 300:
case 301:
loger.warn(_data);
break;
case 910:
ErrorApe.showWarnError("" + _data.reson)
$(".initParams .errorTip").text("" + _data.reson);
break;
case 911:
ErrorApe.showWarnError("" + _data.reson)
$(".initParams .errorTip").text("" + _data.reson);
break;
case 20000:
//已经退出就不再显示网络端口了
if (this.isExit) {
return;
}
ErrorApe.showWarnError(ClassDataProxy.localConfig.disconnected);
this._emit(ClassApe.CLASS_STOP_MEDIA_PUBLISH);
break;
default:
break;
}
}
_classInitSuccessHandler(_data) {
loger.log("课堂初始化成功", new Date().getTime(), _data);
$(".initParamsOut ").hide();
ClassDataProxy.siteId = _data.siteId;
ClassDataProxy.classType = _data.classType;
ClassDataProxy.userName = _data.userName;
ClassDataProxy.userRole = _data.userRole;//以加入成功之后的为准
ClassDataProxy.passwordRequired = _data.passwordRequired;
this._joinClass();
}
_classGetInfoSuccessHandler(_data) {
loger.log("获取课堂信息完成", new Date().getTime(), _data);
}
_classJoinSuccessHandler(_data) {
loger.log("加入课堂成功", new Date().getTime(), _data);
$(".initParamsOut ").hide();
$(".loginBg ").hide();
this._isNetwork = true;
ClassDataProxy.maxAudioChannels = _data.maxAudioChannels;
ClassDataProxy.maxVideoChannels = _data.maxVideoChannels;
ClassDataProxy.nodeId = _data.nodeId;
ClassDataProxy.classTimestamp = _data.classTimestamp || 0;
ClassDataProxy.recordPlaybackMaxTime = _data.recordPlaybackMaxTime || 0;
ClassDataProxy.classType = _data.classType || 1;
ClassDataProxy.className = _data.className || ClassDataProxy.localConfig.unknown;
ClassDataProxy.siteId = _data.siteId || ClassDataProxy.localConfig.unknown;
ClassDataProxy.userRole = _data.userRole;
ClassDataProxy.classStatus = _data.classStatus;
ClassDataProxy.DOCServerIP = _data.DOCServerIP || "";
ClassDataProxy.DOCServerPort = _data.DOCServerPort || "";
ClassDataProxy.serverTimeDistance = _data.serverAndLoacTimeDistanc;
if (!ClassDataProxy.serverTimeDistance) {
ClassDataProxy.serverTimeDistance = 0;
}
ClassDataProxy.ssTunnelAppURL = _data.ssTunnelAppURL || "";//插件地址
//console.log("ClassDataProxy",ClassDataProxy);
ClassDataProxy.currentSceneTableId = _data.currentSceneTableId || ClassDataProxy.SCENE_DOC;//记录文档区域当前显示的是哪个模块;0=文档模块,1=屏幕共享,2=媒体共享
$('.header').show();
$('.pauseClass').hide();
$(".content ").show();
//$('.classTheme').text(`[${ClassDataProxy.siteId}]-${ClassDataProxy.className}`);//这里不显示,显示在title中
$('.classTheme').hide();
if (ClassDataProxy.classTimestamp > 0) {
$('.classTimestampText').text(ClassDataProxy.timestampToDateTimeFull(ClassDataProxy.classTimestamp));
} else {
$('.classTimestampText').text("");
}
document.title = ClassDataProxy.className || "";
//设置界面元素不可选,如果不设置会影响到canvas的绘制
/* document.body.onselectstart = document.body.oncontextmenu = function () {
if ($('div').is('.message')) {
return true;
}
return false;
};*/
this._setClassStatus();
//如果不是老师,不能操作课堂按钮
if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) {
$(".laserRed").hide();
//老师可以操作不
} else if (ClassDataProxy.userRole == ClassDataProxy.USER_INVISIBLE) {
//监课不能使用的功能 自己的设置面板 绘画区的工具栏 底部工具类 举手
$('.setting').hide();
$('.foldDrawToolOut').hide();
$('.drawTool').remove();
$("#controlBrush").hide();
$('.raiseBtn').hide();
$('.answer').hide();
$('.sign').hide();
$('.startClass').hide();
$('.pauseClass').hide();
$('.closeClass').hide();
$('.left').hide();
} else {
//其他身份按普通人处理
loger.log("隐藏控制按钮");
$('.startClass').hide();
$('.pauseClass').hide();
$('.closeClass').hide();
$('.left').hide();
$('.answer').hide();
$('.sign').hide();
}
//录制回放时的状态设置
if (ClassDataProxy.isRecordPlayBack) {
$('.exit').hide();
$('.startClass').hide();
$('.pauseClass').hide();
$('.closeClass').hide();
$('.left').hide();
$('.curClassUserNum').hide();
$('.classTimestampText').hide();
$('.setting').hide();
$('.userListTitle').hide();
$('#raiseBtn').hide();
}
this._setClassStatus();
/*
//移动端做延迟处理,PC端不做处理
setTimeout(function(){
//延迟消息处理
xdysdk.api("setMessageDelay",{"messageDelay":true});
},3000);
*/
//只有在1v1课堂时,学生可以进行画
if (ClassDataProxy.maxMediaChannels == 2 && ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL) {
$('.foldDrawToolOut').show();
$('.foldDrawTool').show();
$(".drawTool").show();
$(".drawTool").css("height", "160px");
$(".clearContent").hide();
$(".laserPen").hide();
$("#controlBrush").hide();
} else if (ClassDataProxy.maxMediaChannels !== 2 && ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL) {
$('.foldDrawToolOut').hide();
$('.foldDrawTool').hide();
$(".drawTool").hide();
$(".clearContent").hide();
$(".laserPen").hide();
$("#controlBrush").hide();
}
}
_classUpdateHandler(_data) {
loger.log('课堂状态发送改变->', _data);
ClassDataProxy.classStatus = _data.classStatus;
ClassDataProxy.classStartTime = _data.classStartTime;
ClassDataProxy.classStopTime = _data.classStopTime;
ClassDataProxy.classBeginTime = _data.classBeginTime;
ClassDataProxy.classEndTime = _data.classEndTime;
ClassDataProxy.currentSceneTableId = _data.currentSceneTableId || ClassDataProxy.SCENE_DOC;//记录文档区域当前显示的是哪个模块;0=文档模块,1=屏幕共享,2=媒体共享
this._setClassStatus();
}
_classInsertRosterHandler(_data) {
//loger.log(_data);
this.curClassStuNum++;
$(".curClassUserNumTotal").html(this.curClassStuNum);
}
_classDeleteRosterHandler(_data) {
//loger.log(_data);
this.curClassStuNum--;
if (this.curClassStuNum < 0) {
this.curClassStuNum = 0;
}
$(".curClassUserNumTotal").html(this.curClassStuNum);
}
_classUpdateTimerHandler(_data) {
ClassDataProxy.classTimestamp = _data.classTimestamp;
if (!ClassDataProxy.isRecordPlayBack) {
$('.classTimestampText').text(ClassDataProxy.timestampToDateTimeFull(ClassDataProxy.classTimestamp));
}
}
//退出课堂,关闭界面
_classExitHandler() {
loger.log("_classExitHandler");
this.isExit = true;
ClassDataProxy.classStatus = 0;
$('.classStatus').text(ClassDataProxy.localConfig.notStart);
$(".box").hide();
$('.answerAllBox').hide();
$('.signAllBox').hide();
$(".setBox").hide();
ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.quitClass)
$("#h5Music").attr("src", "");
$("#h5MediaShare").attr("src", "");
}
//mouseEvent--------------------------------
_startClassHandler() {
//开始之前需要停止当前的所有音视频
setTimeout(function () {
xdysdk.api("sendStartClass");
}, 200);
}
_pasueClassHandler() {
//暂停的时候停止当前的所有音视频
setTimeout(function () {
xdysdk.api("sendPauseClass");
}, 200)
}
//询问是结束课堂(所有人都要退出)
_closeClassHandler() {
let _this = this;
ErrorApe.showError(ErrorApe.TYPE_20, ClassDataProxy.localConfig.endClassroomCont, function (_value) {
// loger.log("_closeClassHandler================",_value);
if (_value == true) {
loger.warn("确定结束课堂", _value);
_this._closeClassEnsureHandler();
} else {
loger.warn("取消结束课堂", _value);
}
ErrorApe.hide();
})
}
_closeClassEnsureHandler() {
this.isExit = true;
xdysdk.api("sendCloseClass");
}
_closeClassCancelHandler() {
ErrorApe.hide();
}
//询问是否退出课堂(自己)
_exitClassHandler() {
let _this = this;
ErrorApe.showError(ErrorApe.TYPE_20, ClassDataProxy.localConfig.exitCont, function (_value) {
if (_value == true) {
loger.warn("确定退出课堂", _value);
_this._exitClassEnsureHandler();
} else {
loger.warn("取消退出课堂", _value);
}
ErrorApe.hide();
});
}
_exitClassPopupHandler() {
ErrorApe.hide();
}
_exitClassEnsureHandler() {
// ErrorApe.hide();
this.isExit = true;
xdysdk.api("leaveClass");
this._classExitHandler();
}
_exitClassCancelHandler() {
ErrorApe.hide();
}
_helpHandler() {
$(".helpBox").show();
$(".masker").show();
}
_closeHelpHandler() {
$(".helpBox").hide();
$(".masker").hide();
}
_stuInitHandler() {
ClassDataProxy.userRole = ClassDataProxy.USER_NOTMAL;
ClassDataProxy.classId = parseInt($(".classId ")[0].value);
ClassDataProxy.userId = $(".userId ")[0].value;
this._initClass();
}
_teacherInitHandler() {
ClassDataProxy.userRole = ClassDataProxy.USER_HOST;
ClassDataProxy.classId = parseInt($(".classId ")[0].value);
ClassDataProxy.userId = $(".userId ")[0].value;
this._initClass();
}
_loginHandler() {
let userName = $('.userNameInput').val();
let userPwd = $('.passWordInput').val();
let errMsg = $(".errorTip");
if (userPwd) {
$(".loginSpinner").show();
}
if (!userName) {
errMsg.html('请输入用户名').addClass('showErr');
return false;
}
if (ClassDataProxy.passwordRequired && !userPwd) {
errMsg.html('请输入密码').addClass('showErr');
return false;
}
ClassDataProxy.userName = $(".userNameInput ")[0].value || '';
ClassDataProxy.password = $(".passWordInput ")[0].value;
this._joinClass();
}
}
ClassApe.prototype.CLASS_STOP_MEDIA_PUBLISH = ClassApe.CLASS_STOP_MEDIA_PUBLISH = "class_stop_media_publish";//停止所有媒体推流
export default ClassApe;