正在显示
6 个修改的文件
包含
236 行增加
和
44 行删除
此 diff 太大无法显示。
| @@ -33,7 +33,7 @@ import QuestionApe from 'apes/QuestionApe'; | @@ -33,7 +33,7 @@ import QuestionApe from 'apes/QuestionApe'; | ||
| 33 | import UTF8 from 'utf-8'; | 33 | import UTF8 from 'utf-8'; |
| 34 | 34 | ||
| 35 | let loger = Loger.getLoger('McuClient'); | 35 | let loger = Loger.getLoger('McuClient'); |
| 36 | -let _sdkInfo = { "version": "v1.36.1.20170619", "author": "www.3mang.com" }; | 36 | +let _sdkInfo = { "version": "v1.36.8.20170620", "author": "www.3mang.com" }; |
| 37 | 37 | ||
| 38 | //APE | 38 | //APE |
| 39 | let _sass; | 39 | let _sass; |
| @@ -1233,12 +1233,181 @@ export default class MessageEntrance extends Emiter { | @@ -1233,12 +1233,181 @@ export default class MessageEntrance extends Emiter { | ||
| 1233 | } | 1233 | } |
| 1234 | } | 1234 | } |
| 1235 | 1235 | ||
| 1236 | + << << << < HEAD | ||
| 1236 | //ChatApe | 1237 | //ChatApe |
| 1237 | // 发送聊天消息 | 1238 | // 发送聊天消息 |
| 1238 | _sendChatMsg(_messageInfo) { | 1239 | _sendChatMsg(_messageInfo) { |
| 1239 | if (!_mcu.connected) { | 1240 | if (!_mcu.connected) { |
| 1240 | loger.warn(GlobalConfig.getCurrentStatus()); | 1241 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1241 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | 1242 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; === === = |
| 1243 | + //获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do | ||
| 1244 | + _sassGetClassParamSuccessHandler(_data) { | ||
| 1245 | + loger.log('获取课堂课堂信息完成.'); | ||
| 1246 | + //包含整个课堂最全的信息,储存数据 | ||
| 1247 | + if (_data) { | ||
| 1248 | + GlobalConfig.mcuDelay = _data.h5Delay || 0; //mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 | ||
| 1249 | + GlobalConfig.className = _data.meetingName || ""; | ||
| 1250 | + GlobalConfig.classBeginTime = _data.beginTime || ""; | ||
| 1251 | + GlobalConfig.classEndTime = _data.endTime || ""; | ||
| 1252 | + GlobalConfig.userIp = _data.userIp || ""; | ||
| 1253 | + | ||
| 1254 | + GlobalConfig.maxVideoChannels = _data.maxVideoChannels; | ||
| 1255 | + GlobalConfig.maxAudioChannels = _data.maxAudioChannels; | ||
| 1256 | + GlobalConfig.maxMediaChannels = Math.max(GlobalConfig.maxVideoChannels, GlobalConfig.maxAudioChannels); | ||
| 1257 | + | ||
| 1258 | + GlobalConfig.ssTunnelAppURL = _data.ssTunnelAppURL || ''; //屏幕共享插件的地址 | ||
| 1259 | + | ||
| 1260 | + //视频质量相关设置,每次加入课堂都按最新的获取设置 | ||
| 1261 | + GlobalConfig.fps = _data.fps || 15; | ||
| 1262 | + GlobalConfig.gop = _data.gop || 3; | ||
| 1263 | + GlobalConfig.videoQuality = parseInt(_data.videoQuality); | ||
| 1264 | + GlobalConfig.curVideoQuality = GlobalConfig.videoQuality; | ||
| 1265 | + | ||
| 1266 | + //是否自动开始(身份是host的时候才用到的) | ||
| 1267 | + GlobalConfig.isAutoStartClass = _data.autoRecord || 0; | ||
| 1268 | + | ||
| 1269 | + GlobalConfig.serverTime = _data.serverTime || new Date().getTime(); //获取服务器时间戳 | ||
| 1270 | + GlobalConfig.serverAndLoacTimeDistanc = (new Date().getTime() - GlobalConfig.serverTime) / 1000; //当前系统时间和服务器时间的差值 (秒) | ||
| 1271 | + loger.warn("服务器时间:" + GlobalConfig.serverTime + " 系统时间:" + new Date().getTime() + " 时间差:" + GlobalConfig.serverAndLoacTimeDistanc); | ||
| 1272 | + | ||
| 1273 | + GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 | ||
| 1274 | + GlobalConfig.setRecordList(_data.recordList); //录制回放地址 | ||
| 1275 | + GlobalConfig.setDocList(_data.docList); //文档地址 | ||
| 1276 | + GlobalConfig.setMsList(_data.msList); //推流播流服务器地址(需要对列表中的地址进行分类,里面包含了推流和拉流的地址,目前主要是乐视的需要区分开) | ||
| 1277 | + GlobalConfig.setRsList(_data.rsList); //播放m3u8格式的地址(录制回放时使用) | ||
| 1278 | + GlobalConfig.setMcuList(_data.mcuList); //mcu | ||
| 1279 | + GlobalConfig.setMusicList(_data.musicList); // | ||
| 1280 | + GlobalConfig.setMusicListPrepare(_data.musicListPrepare); //提前上传的声音文件列表 | ||
| 1281 | + GlobalConfig.setVideoCDNAddr(_data.videoCDNAddr); //cdn加速的拉流地址,直播的时候才使用 | ||
| 1282 | + GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表 | ||
| 1283 | + | ||
| 1284 | + //MCU地址 | ||
| 1285 | + if (_data.mcuList && _data.mcuList.length > 0) { | ||
| 1286 | + //随机选择一个 | ||
| 1287 | + let index = parseInt(Math.random() * _data.mcuList.length); | ||
| 1288 | + GlobalConfig.MCUServerIP = _data.mcuList[index].ip || ""; | ||
| 1289 | + GlobalConfig.MCUServerPort = _data.mcuList[index].port || ""; | ||
| 1290 | + loger.log('初始->MCU->.', GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort); | ||
| 1291 | + } | ||
| 1292 | + | ||
| 1293 | + //录制回放时m3u8播流地址 | ||
| 1294 | + if (_data.rsList && _data.rsList.length > 0) { | ||
| 1295 | + let index = parseInt(Math.random() * _data.rsList.length); | ||
| 1296 | + GlobalConfig.RS_RECORD_PLAY_IP = _data.rsList[index].ip || ""; | ||
| 1297 | + GlobalConfig.RS_RECORD_PLAY_PORT = _data.rsList[index].port || ""; | ||
| 1298 | + loger.log('初始->RS->.', GlobalConfig.RS_RECORD_PLAY_IP, GlobalConfig.RS_RECORD_PLAY_PORT); | ||
| 1299 | + } | ||
| 1300 | + | ||
| 1301 | + //上课中音视频推流地址 | ||
| 1302 | + if (GlobalConfig.msList && GlobalConfig.msList.length > 0) { | ||
| 1303 | + let index = parseInt(Math.random() * GlobalConfig.msList.length); | ||
| 1304 | + GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msList[index].ip || ""; | ||
| 1305 | + GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msList[index].port || ""; | ||
| 1306 | + } | ||
| 1307 | + loger.log('初始->MS->.', GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); | ||
| 1308 | + | ||
| 1309 | + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 rtmp(目前乐视使用) | ||
| 1310 | + if (GlobalConfig.pullRtmpList && GlobalConfig.pullRtmpList.length > 0) { | ||
| 1311 | + //有单独的rtmp拉流地址 | ||
| 1312 | + let index = parseInt(Math.random() * GlobalConfig.pullRtmpList.length); | ||
| 1313 | + GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.pullRtmpList[index].ip || ""; | ||
| 1314 | + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.pullRtmpList[index].port || ""; | ||
| 1315 | + } else { | ||
| 1316 | + //如果没有单独的rtmp拉流地址,和推流地址一样即可 | ||
| 1317 | + GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.MS_PUBLISH_IP; | ||
| 1318 | + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.MS_PUBLISH_PORT; | ||
| 1319 | + } | ||
| 1320 | + | ||
| 1321 | + loger.log('初始->MSPull->.', GlobalConfig.MS_PLAY_RTMP_IP, GlobalConfig.MS_PLAY_RTMP_PORT); | ||
| 1322 | + | ||
| 1323 | + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 hls(目前乐视使用) | ||
| 1324 | + if (GlobalConfig.hlsList && GlobalConfig.hlsList.length > 0) { | ||
| 1325 | + //有单独的hls拉流地址 | ||
| 1326 | + let index = parseInt(Math.random() * GlobalConfig.hlsList.length); | ||
| 1327 | + GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsList[index].ip || ""; | ||
| 1328 | + GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsList[index].port || ""; | ||
| 1329 | + } else { | ||
| 1330 | + //没有单独的hls拉流地址,和录制回放地址一样即可 | ||
| 1331 | + GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.RS_RECORD_PLAY_IP; | ||
| 1332 | + GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.RS_RECORD_PLAY_PORT; | ||
| 1333 | + } | ||
| 1334 | + loger.log('初始->MSHls->.', GlobalConfig.MS_PLAY_HLS_IP, GlobalConfig.MS_PLAY_HLS_PORT); | ||
| 1335 | + | ||
| 1336 | + //直播的时候,拉流(rtmp和hls)需要从 videoCDNAddr中获取 | ||
| 1337 | + //20170531-新规则,所有课堂类型都支持加速 | ||
| 1338 | + // if(GlobalConfig.classType==ApeConsts.CLASS_TYPE_2&&GlobalConfig.videoCDNAddrList.length>0){ | ||
| 1339 | + if (GlobalConfig.videoCDNAddrList.length > 0) { | ||
| 1340 | + //videoCDNAddrList中rtmppush和hls是混在一起的,需要分离开; | ||
| 1341 | + let listLen = GlobalConfig.videoCDNAddrList.length; | ||
| 1342 | + for (let i = 0; i < listLen; i++) { | ||
| 1343 | + let ipItem = GlobalConfig.videoCDNAddrList[i]; | ||
| 1344 | + if (ipItem) { | ||
| 1345 | + if (ipItem.indexOf('hls') >= 0) { | ||
| 1346 | + //直播的时候m3u8拉流地址 | ||
| 1347 | + GlobalConfig.MS_PLAY_HLS_IP = ipItem; //ip包含了端口 | ||
| 1348 | + GlobalConfig.MS_PLAY_HLS_PORT = ""; | ||
| 1349 | + loger.log('videoCDNAddr>初始->MSHls', GlobalConfig.MS_PLAY_HLS_IP); | ||
| 1350 | + } else if (ipItem.indexOf('rtmppull') >= 0) { | ||
| 1351 | + //直播的时候rtmp拉流地址 | ||
| 1352 | + GlobalConfig.MS_PLAY_RTMP_IP = ipItem; //ip包含了端口 | ||
| 1353 | + GlobalConfig.MS_PLAY_RTMP_PORT = ''; | ||
| 1354 | + loger.log('videoCDNAddr->初始->MSPull', GlobalConfig.MS_PLAY_RTMP_IP); | ||
| 1355 | + } | ||
| 1356 | + } | ||
| 1357 | + } | ||
| 1358 | + | ||
| 1359 | + } else { | ||
| 1360 | + loger.log('不需要videoCDNAddr->'); | ||
| 1361 | + } | ||
| 1362 | + | ||
| 1363 | + //文档地址 | ||
| 1364 | + if (_data.docList && _data.docList.length > 0) { | ||
| 1365 | + //doc上传地址,随机获取一个 | ||
| 1366 | + let index = parseInt(Math.random() * _data.docList.length); | ||
| 1367 | + loger.log("docServer->", _data.docList[index]); | ||
| 1368 | + GlobalConfig.DOCServerIP = _data.docList[index].ip || ""; | ||
| 1369 | + GlobalConfig.DOCServerPort = _data.docList[index].port || ""; | ||
| 1370 | + loger.log('初始->DOC->.', GlobalConfig.DOCServerIP, GlobalConfig.DOCServerPort); | ||
| 1371 | + } | ||
| 1372 | + | ||
| 1373 | + //record | ||
| 1374 | + if (_data.recordList && _data.recordList.length > 0) { | ||
| 1375 | + let index = parseInt(Math.random() * _data.recordList.length); | ||
| 1376 | + GlobalConfig.RecordServerIP = _data.recordList[index].ip || ""; | ||
| 1377 | + GlobalConfig.RecordServerPort = _data.recordList[index].port || ""; | ||
| 1378 | + loger.log('初始->RECORD->.', GlobalConfig.RecordServerIP, GlobalConfig.RecordServerPort); | ||
| 1379 | + } | ||
| 1380 | + | ||
| 1381 | + } | ||
| 1382 | + //这里需要考虑是否加延迟处理,课堂信息刚获取完成,客户端需要根据数据创建界面UI,等创建完成后再加入课堂是最合适的(目前没有加延迟) | ||
| 1383 | + this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1384 | + | ||
| 1385 | + if (_data.currentInfo) { | ||
| 1386 | + //根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息 | ||
| 1387 | + loger.log("本地同步最后一次保存过的课堂状态信息"); | ||
| 1388 | + try { | ||
| 1389 | + GlobalConfig.setClassStatusInfo(JSON.parse(_data.currentInfo)); | ||
| 1390 | + } catch (err) { | ||
| 1391 | + GlobalConfig.setClassStatusInfo(_data.currentInfo); | ||
| 1392 | + } | ||
| 1393 | + loger.log(GlobalConfig.classStatusInfo); | ||
| 1394 | + } else { | ||
| 1395 | + loger.log("还没有保存过课堂状信息"); | ||
| 1396 | + } | ||
| 1397 | + | ||
| 1398 | + //录制回放不需要获取ip信息和选点 | ||
| 1399 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 1400 | + if (_recordPlayback) { | ||
| 1401 | + //开启录制回放流程 | ||
| 1402 | + loger.log("开启录制回放流程"); | ||
| 1403 | + _recordPlayback.readyRecordPlay(); | ||
| 1404 | + } else { | ||
| 1405 | + loger.warn("开启录制回放流程失败->还未创建模块"); | ||
| 1406 | + } | ||
| 1407 | + } else { | ||
| 1408 | + //根据用户的userIp获取信息,选点 | ||
| 1409 | + this.getUserIpInfo(); | ||
| 1410 | + } >>> >>> > 51e886 c5e7fcd06f9e4a662071aaec162c455e1d | ||
| 1242 | } | 1411 | } |
| 1243 | if (_messageInfo === null || EngineUtils.isEmptyObject(_messageInfo)) { | 1412 | if (_messageInfo === null || EngineUtils.isEmptyObject(_messageInfo)) { |
| 1244 | loger.log('发送聊天消息失败->参数错误', _messageInfo); | 1413 | loger.log('发送聊天消息失败->参数错误', _messageInfo); |
| @@ -1879,5 +2048,5 @@ export default class MessageEntrance extends Emiter { | @@ -1879,5 +2048,5 @@ export default class MessageEntrance extends Emiter { | ||
| 1879 | } | 2048 | } |
| 1880 | } | 2049 | } |
| 1881 | 2050 | ||
| 1882 | -} | 2051 | + } |
| 1883 | 2052 |
| @@ -37,7 +37,7 @@ class EngineUtils{ | @@ -37,7 +37,7 @@ class EngineUtils{ | ||
| 37 | 37 | ||
| 38 | //生成时间戳毫秒 | 38 | //生成时间戳毫秒 |
| 39 | static creatTimestamp(){ | 39 | static creatTimestamp(){ |
| 40 | - let time = parseInt(new Date().getTime()/1000);//精确到毫秒 | 40 | + let time = parseInt(new Date().getTime()/1000);//精确到秒 |
| 41 | return time; | 41 | return time; |
| 42 | } | 42 | } |
| 43 | //生成时间戳 string | 43 | //生成时间戳 string |
| @@ -460,6 +460,7 @@ GlobalConfig.allowRecordMaxTime = 14400; //(秒)允许录制的最长时间, | @@ -460,6 +460,7 @@ GlobalConfig.allowRecordMaxTime = 14400; //(秒)允许录制的最长时间, | ||
| 460 | 460 | ||
| 461 | GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点 | 461 | GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点 |
| 462 | GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址 | 462 | GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址 |
| 463 | - | 463 | +GlobalConfig.serverTime = 0; //服务器当前时间戳 |
| 464 | +GlobalConfig.serverAndLoacTimeDistanc = 0; //本地时间和服务器时间错的差值; | ||
| 464 | export default GlobalConfig; | 465 | export default GlobalConfig; |
| 465 | 466 |
| @@ -89,15 +89,11 @@ MessageTypes.DOC_BROADCAST = "doc_broadcast"; // | @@ -89,15 +89,11 @@ MessageTypes.DOC_BROADCAST = "doc_broadcast"; // | ||
| 89 | MessageTypes.MEDIA_SHARED_DELETE = "media_shared_delete"; //删除媒体文件 | 89 | MessageTypes.MEDIA_SHARED_DELETE = "media_shared_delete"; //删除媒体文件 |
| 90 | MessageTypes.MEDIA_SHARED_UPDATE = "media_shared_update"; //更新媒体文件(添加、变更) | 90 | MessageTypes.MEDIA_SHARED_UPDATE = "media_shared_update"; //更新媒体文件(添加、变更) |
| 91 | 91 | ||
| 92 | -//答题卡 | 92 | +//答题卡和点名共用 |
| 93 | MessageTypes.START_ANSWER_QUESTION = "start_answer_question"; //开始答题 | 93 | MessageTypes.START_ANSWER_QUESTION = "start_answer_question"; //开始答题 |
| 94 | MessageTypes.UPDATE_ANSWER_QUESTION = "update_answer_question"; //更新答题数据 | 94 | MessageTypes.UPDATE_ANSWER_QUESTION = "update_answer_question"; //更新答题数据 |
| 95 | MessageTypes.STOP_ANSWER_QUESTION = "stop_answer_question"; //停止答题 | 95 | MessageTypes.STOP_ANSWER_QUESTION = "stop_answer_question"; //停止答题 |
| 96 | - | ||
| 97 | -//点名 | ||
| 98 | -MessageTypes.START_CALL_THE_ROLL = "start_call_the_roll"; //开始点名 | ||
| 99 | -MessageTypes.UPDATE_CALL_THE_ROLL = "update_call_the_roll"; //更新点名数据 | ||
| 100 | -MessageTypes.STOP_CALL_THE_ROLL = "stop_call_the_roll"; //停止点名 | 96 | +MessageTypes.UPDATE_QUESTION_TIME = "update_question_time"; //更新答题时间 |
| 101 | 97 | ||
| 102 | //白板笔记事件定义 | 98 | //白板笔记事件定义 |
| 103 | MessageTypes.WHITEBOARD_ANNOTATION_UPDATE = "whiteboard_annotation_update"; // 'whiteboard.annotation.update'; | 99 | MessageTypes.WHITEBOARD_ANNOTATION_UPDATE = "whiteboard_annotation_update"; // 'whiteboard.annotation.update'; |
| @@ -23,8 +23,10 @@ class QuestionApe extends Ape { | @@ -23,8 +23,10 @@ class QuestionApe extends Ape { | ||
| 23 | ApeConsts.QUESTION_SESSION_NAME, | 23 | ApeConsts.QUESTION_SESSION_NAME, |
| 24 | ApeConsts.QUESTION_SESSION_TAG | 24 | ApeConsts.QUESTION_SESSION_TAG |
| 25 | ); | 25 | ); |
| 26 | + | ||
| 26 | this.questionList={};//MCU同步的题目数据 | 27 | this.questionList={};//MCU同步的题目数据 |
| 27 | - this.questionDataList={};//Sass保存的题目内容数据 | 28 | + this.questionTimer=new TimerCounter();//答题卡计时器 |
| 29 | + this.questionTimer.addTimerCallBack(this.questionTimerCounterUptate.bind(this), 1);//计时器监听 | ||
| 28 | 30 | ||
| 29 | //监听Sass事件 | 31 | //监听Sass事件 |
| 30 | this._sass=Sass; | 32 | this._sass=Sass; |
| @@ -47,6 +49,34 @@ class QuestionApe extends Ape { | @@ -47,6 +49,34 @@ class QuestionApe extends Ape { | ||
| 47 | this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_QUESTION_ID, | 49 | this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_QUESTION_ID, |
| 48 | ApeConsts.CONFERENCE_OBJ_QUESTION_NAME, ApeConsts.CONFERENCE_OBJ_QUESTION_TAG, 0, new ArrayBuffer); | 50 | ApeConsts.CONFERENCE_OBJ_QUESTION_NAME, ApeConsts.CONFERENCE_OBJ_QUESTION_TAG, 0, new ArrayBuffer); |
| 49 | } | 51 | } |
| 52 | + //答题卡计时器 | ||
| 53 | + questionTimerCounterUptate() { | ||
| 54 | + if (!this.mcu.connected) { | ||
| 55 | + loger.warn('MCU 连接已经断开'); | ||
| 56 | + if(this.questionTimer){ | ||
| 57 | + this.questionTimer.stopTimer(); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + //console.log("时间差:"+GlobalConfig.serverAndLoacTimeDistanc+' questionTimerCounterUptate',this.questionList); | ||
| 61 | + for(let key in this.questionList){ | ||
| 62 | + let question=this.questionList[key]; | ||
| 63 | + if(question){ | ||
| 64 | + let currentTime=EngineUtils.creatTimestamp()-GlobalConfig.serverAndLoacTimeDistanc;//将当的时间减去服务器时间差 | ||
| 65 | + | ||
| 66 | + let timestamp=parseInt(question.timeLimit-(currentTime-question.timestamp)); | ||
| 67 | + if(timestamp>=0){ | ||
| 68 | + loger.log("question->type:"+question.type,"倒计时:"+timestamp); | ||
| 69 | + this._emit(MessageTypes.UPDATE_QUESTION_TIME,{type:question.type,itemIdx:question.itemIdx,timestamp:timestamp}); | ||
| 70 | + }else { | ||
| 71 | + this.stopQuestion({itemIdx:question.itemIdx}); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + if( this.questionTimer&&Object.keys(this.questionList).length<1){ | ||
| 77 | + this.questionTimer.stopTimer(); | ||
| 78 | + } | ||
| 79 | + } | ||
| 50 | 80 | ||
| 51 | //更新信息 | 81 | //更新信息 |
| 52 | sendUpdaterTable(_param) { | 82 | sendUpdaterTable(_param) { |
| @@ -140,34 +170,33 @@ class QuestionApe extends Ape { | @@ -140,34 +170,33 @@ class QuestionApe extends Ape { | ||
| 140 | //停止答题 | 170 | //停止答题 |
| 141 | loger.log("更新答题数据"); | 171 | loger.log("更新答题数据"); |
| 142 | if(GlobalConfig.isHost){ | 172 | if(GlobalConfig.isHost){ |
| 143 | - //老师,只统计数据,不答题 | ||
| 144 | - //先判断时间是否超时 | ||
| 145 | - let timeDistance=EngineUtils.creatTimestamp()-model.timestamp; | ||
| 146 | - loger.log("答题卡显示倒计时->timeDistance:"+timeDistance); | ||
| 147 | - timeDistance=model.timeLimit-timeDistance; | ||
| 148 | - if(timeDistance<=0){ | ||
| 149 | - //答题卡时间到,需要停止 | ||
| 150 | - loger.log("答题卡时间到->需要停止"); | ||
| 151 | - this.stopQuestion(model); | ||
| 152 | - }else { | 173 | + ////老师,只统计数据,不答题 |
| 174 | + ////先判断时间是否超时 | ||
| 175 | + //let timeDistance=EngineUtils.creatTimestamp()-model.timestamp; | ||
| 176 | + //loger.log("答题卡显示倒计时->timeDistance:"+timeDistance); | ||
| 177 | + //timeDistance=model.timeLimit-timeDistance; | ||
| 178 | + //if(timeDistance<=0){ | ||
| 179 | + // //答题卡时间到,需要停止 | ||
| 180 | + // loger.log("答题卡时间到->需要停止"); | ||
| 181 | + // this.stopQuestion(model); | ||
| 182 | + //}else { | ||
| 183 | + // this.getQuestionResult(model); | ||
| 184 | + //} | ||
| 153 | this.getQuestionResult(model); | 185 | this.getQuestionResult(model); |
| 154 | - } | ||
| 155 | - | ||
| 156 | }else if(GlobalConfig.isNormal) { | 186 | }else if(GlobalConfig.isNormal) { |
| 157 | //学生->如果自己已经提交过答案就不需要再显示 | 187 | //学生->如果自己已经提交过答案就不需要再显示 |
| 158 | if(model.totalUserList.indexOf(GlobalConfig.userId)>=0){ | 188 | if(model.totalUserList.indexOf(GlobalConfig.userId)>=0){ |
| 159 | loger.log("已经提交过答案-不需要显示答题卡->userId:"+GlobalConfig.userId); | 189 | loger.log("已经提交过答案-不需要显示答题卡->userId:"+GlobalConfig.userId); |
| 190 | + //delete this.questionList[itemIdx]; | ||
| 160 | }else { | 191 | }else { |
| 161 | //显示答题卡数据 | 192 | //显示答题卡数据 |
| 162 | this._emit(MessageTypes.START_ANSWER_QUESTION,model); | 193 | this._emit(MessageTypes.START_ANSWER_QUESTION,model); |
| 163 | } | 194 | } |
| 164 | } | 195 | } |
| 196 | + if( this.questionTimer){ | ||
| 197 | + this.questionTimer.startTimer(); | ||
| 198 | + } | ||
| 165 | break; | 199 | break; |
| 166 | - //case 4: | ||
| 167 | - // //停止点名 | ||
| 168 | - // loger.log("更新点名数据"); | ||
| 169 | - // this._emit(MessageTypes.UPDATE_CALL_THE_ROLL,model); | ||
| 170 | - // break; | ||
| 171 | default : | 200 | default : |
| 172 | break; | 201 | break; |
| 173 | } | 202 | } |
| @@ -191,15 +220,17 @@ class QuestionApe extends Ape { | @@ -191,15 +220,17 @@ class QuestionApe extends Ape { | ||
| 191 | case 1: | 220 | case 1: |
| 192 | case 2: | 221 | case 2: |
| 193 | case 3: | 222 | case 3: |
| 223 | + case 4: | ||
| 224 | + case 100: | ||
| 194 | //停止答题 | 225 | //停止答题 |
| 195 | loger.log("停止答题->",itemDataInfo); | 226 | loger.log("停止答题->",itemDataInfo); |
| 196 | this._emit(MessageTypes.STOP_ANSWER_QUESTION,itemDataInfo); | 227 | this._emit(MessageTypes.STOP_ANSWER_QUESTION,itemDataInfo); |
| 197 | break; | 228 | break; |
| 198 | - case 4: | ||
| 199 | - //停止点名 | ||
| 200 | - loger.log("停止点名"); | ||
| 201 | - this._emit(MessageTypes.STOP_CALL_THE_ROLL,itemDataInfo); | ||
| 202 | - break; | 229 | + //case 100: |
| 230 | + // //停止点名 | ||
| 231 | + // loger.log("停止点名"); | ||
| 232 | + // this._emit(MessageTypes.STOP_CALL_THE_ROLL,itemDataInfo); | ||
| 233 | + // break; | ||
| 203 | default : | 234 | default : |
| 204 | break; | 235 | break; |
| 205 | } | 236 | } |
| @@ -234,7 +265,7 @@ class QuestionApe extends Ape { | @@ -234,7 +265,7 @@ class QuestionApe extends Ape { | ||
| 234 | modelPdu.type = parseInt(_param.type)||0; | 265 | modelPdu.type = parseInt(_param.type)||0; |
| 235 | modelPdu.questionId= parseInt(_param.questionId)||0; | 266 | modelPdu.questionId= parseInt(_param.questionId)||0; |
| 236 | modelPdu.timeLimit= parseInt(_param.timeLimit)||1;//有效时间 | 267 | modelPdu.timeLimit= parseInt(_param.timeLimit)||1;//有效时间 |
| 237 | - modelPdu.timestamp= parseInt(_param.timestamp)||EngineUtils.creatTimestamp();//创建的时间 | 268 | + modelPdu.timestamp= parseInt(_param.timestamp)||parseInt(EngineUtils.creatTimestamp()- GlobalConfig.serverAndLoacTimeDistanc);;//创建的时间(秒) |
| 238 | modelPdu.content= _param.content||[];//题干 | 269 | modelPdu.content= _param.content||[];//题干 |
| 239 | modelPdu.options= _param.options||[];//选项列表 | 270 | modelPdu.options= _param.options||[];//选项列表 |
| 240 | modelPdu.answer= _param.answer||[];//用户选择的选项索引 | 271 | modelPdu.answer= _param.answer||[];//用户选择的选项索引 |
| @@ -352,16 +383,11 @@ class QuestionApe extends Ape { | @@ -352,16 +383,11 @@ class QuestionApe extends Ape { | ||
| 352 | _sassCreatQuestionSuccessHandler(_data){ | 383 | _sassCreatQuestionSuccessHandler(_data){ |
| 353 | //loger.log("创建答题卡成功",_data); | 384 | //loger.log("创建答题卡成功",_data); |
| 354 | if(_data){ | 385 | if(_data){ |
| 355 | - //this.questionDataList[_data.questionId]=_data;//保存题目数据 | ||
| 356 | - | 386 | + //获取当前对方系统时间,再减去服务器时间差 |
| 387 | + let timestamp=parseInt(EngineUtils.creatTimestamp()- GlobalConfig.serverAndLoacTimeDistanc);//创建答题卡的时间(秒) | ||
| 357 | let questionItem=_data; | 388 | let questionItem=_data; |
| 358 | - /* //判断是答题还是点名,type=100的时候是点名 | ||
| 359 | - if(questionItem.type==100){ | ||
| 360 | - questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID+1; | ||
| 361 | - }else { | ||
| 362 | - questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID; | ||
| 363 | - }*/ | ||
| 364 | - questionItem.itemIdx=EngineUtils.creatTimestamp(); | 389 | + questionItem.itemIdx=timestamp; |
| 390 | + questionItem.timestamp=timestamp; | ||
| 365 | this.sendUpdaterTable(questionItem); | 391 | this.sendUpdaterTable(questionItem); |
| 366 | } | 392 | } |
| 367 | 393 |
-
请 注册 或 登录 后发表评论