李勇

点名和答题卡模块接口和事件监听统一使用一套接口;根据type来区分,点名的type=100

此 diff 太大无法显示。
@@ -32,7 +32,7 @@ import QuestionApe from 'apes/QuestionApe'; @@ -32,7 +32,7 @@ import QuestionApe from 'apes/QuestionApe';
32 import UTF8 from 'utf-8'; 32 import UTF8 from 'utf-8';
33 33
34 let loger = Loger.getLoger('McuClient'); 34 let loger = Loger.getLoger('McuClient');
35 -let _sdkInfo = {"version": "v1.31.8.20170613", "author": "www.3mang.com"}; 35 +let _sdkInfo = {"version": "v1.31.11.20170613", "author": "www.3mang.com"};
36 36
37 //APE 37 //APE
38 let _sass; 38 let _sass;
@@ -16,7 +16,6 @@ import TimerCounter from "TimerCounter"; @@ -16,7 +16,6 @@ import TimerCounter from "TimerCounter";
16 import Sass from 'Sass'; 16 import Sass from 'Sass';
17 17
18 let loger = Loger.getLoger('ConferApe'); 18 let loger = Loger.getLoger('ConferApe');
19 -let itemIdx = 0;//table插入新数据的计数id,目前用时间戳  
20 19
21 class ConferApe extends Ape { 20 class ConferApe extends Ape {
22 constructor() { 21 constructor() {
@@ -33,21 +32,6 @@ class ConferApe extends Ape { @@ -33,21 +32,6 @@ class ConferApe extends Ape {
33 this.thirdMessage=new ThirdMessage(); 32 this.thirdMessage=new ThirdMessage();
34 this.thirdMessage.on(ThirdMessage.RECIVE_MESSAGE,this.onThirdReciveParentMessage.bind(this)); 33 this.thirdMessage.on(ThirdMessage.RECIVE_MESSAGE,this.onThirdReciveParentMessage.bind(this));
35 34
36 - //监听Sass事件  
37 - this._sass=Sass;  
38 - //创建答题卡  
39 - this._sass.on(Sass.SASS_CREAT_QUESTION_SUCCESS,this._sassCreatQuestionSuccessHandler.bind(this));  
40 - this._sass.on(Sass.SASS_CREAT_QUESTION_FAILED,this._sassCreatQuestionFailedHandler.bind(this));  
41 - //获取题目数据  
42 - this._sass.on(Sass.SASS_GET_QUESTION_SUCCESS,this._sassGetQuestionSuccessHandler.bind(this));  
43 - this._sass.on(Sass.SASS_GET_QUESTION_FAILED,this._sassGetQuestionFailedHandler.bind(this));  
44 - //获取答题结果  
45 - this._sass.on(Sass.SASS_GET_QUESTION_RESULT_SUCCESS,this._sassGetQuestionResultSuccessHandler.bind(this));  
46 - this._sass.on(Sass.SASS_GET_QUESTION_RESULT_FAILED,this._sassGetQuestionResultFailedHandler.bind(this));  
47 - //保存答题数据  
48 - this._sass.on(Sass.SASS_SEND_ANSWER_SUCCESS,this._sassSendAnswerSuccessHandler.bind(this));  
49 - this._sass.on(Sass.SASS_SEND_ANSWER_FAILED,this._sassSendAnswerFailedHandler.bind(this));  
50 -  
51 // Ape Models 35 // Ape Models
52 this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); 36 this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer);
53 37
@@ -966,95 +950,6 @@ class ConferApe extends Ape { @@ -966,95 +950,6 @@ class ConferApe extends Ape {
966 } 950 }
967 return null; 951 return null;
968 } 952 }
969 - //答题卡接口-------------------------------------------------------------------  
970 - creatQuestion(_param){  
971 - if(!_param){  
972 - loger.warn("创建答题卡->参数错误",_param);  
973 - return;  
974 - }  
975 - loger.log("创建答题卡->",_param);  
976 - if(this._sass){  
977 - /*{  
978 - "type": 1,//1单选,2多选,3判断,4点名  
979 - "content": "题目",//没有就传""  
980 - "timeLimit": 88,//有效时间(秒)  
981 - "correct": "[]",//正确答案,没有就传[]  
982 - "options": [],//选项数组,没有就传[]  
983 - "answer": []//学生选择的答案,没有就传[]  
984 - }*/  
985 - let paramObj=_param;  
986 - paramObj.classId=GlobalConfig.classId;  
987 - this._sass.creatQuestion(paramObj);  
988 - }  
989 - }  
990 - getQuestion(_param){  
991 - if(!_param){  
992 - loger.warn("获取答题卡数据->参数错误",_param);  
993 - return;  
994 - }  
995 - loger.log("获取答题卡数据->.",_param);  
996 - if(this._sass){  
997 - this._sass.getQuestion(_param);  
998 - }  
999 - }  
1000 - getQuestionResult(_param){  
1001 - if(!_param){  
1002 - loger.warn("获取答题卡结果->参数错误",_param);  
1003 - return;  
1004 - }  
1005 - loger.log("获取答题卡结果->",_param);  
1006 - if(this._sass){  
1007 - this._sass.getQuestionResult(_param);  
1008 - }  
1009 - }  
1010 - stopQuestion(_param){  
1011 - if(!_param){  
1012 - loger.warn("停止答题->参数错误",_param);  
1013 - return;  
1014 - }  
1015 - loger.log("停止答题->",_param);  
1016 -  
1017 - }  
1018 - sendAnswer(_param){  
1019 - if(!_param){  
1020 - loger.warn("保存答题答案->参数错误",_param);  
1021 - return;  
1022 - }  
1023 - loger.log("保存答题答案->",_param);  
1024 - if(this._sass){  
1025 - let paramObj=_param;  
1026 - paramObj.classId=GlobalConfig.classId;  
1027 - paramObj.userId = GlobalConfig.userId;  
1028 - paramObj.userName = GlobalConfig.userName;  
1029 - this._sass.sendAnswer(_param);  
1030 - }  
1031 - }  
1032 -  
1033 - //Sass 事件监听  
1034 - _sassCreatQuestionSuccessHandler(_data){  
1035 - loger.log("创建答题卡成功",_data);  
1036 - }  
1037 - _sassCreatQuestionFailedHandler(_data){  
1038 - loger.log("创建答题卡失败",_data);  
1039 - }  
1040 - _sassGetQuestionSuccessHandler(_data){  
1041 - loger.log("获取答题卡数据成功",_data);  
1042 - }  
1043 - _sassGetQuestionFailedHandler(_data){  
1044 - loger.log("获取答题卡数据失败",_data);  
1045 - }  
1046 - _sassGetQuestionResultSuccessHandler(_data){  
1047 - loger.log("获取答题卡结果成功",_data);  
1048 - }  
1049 - _sassGetQuestionResultFailedHandler(_data){  
1050 - loger.log("获取答题卡结果失败",_data);  
1051 - }  
1052 - _sassSendAnswerSuccessHandler(_data){  
1053 - loger.log("保存答案成功",_data);  
1054 - }  
1055 - _sassSendAnswerFailedHandler(_data){  
1056 - loger.log("保存答案失败",_data);  
1057 - }  
1058 953
1059 } 954 }
1060 955
@@ -56,7 +56,7 @@ class QuestionApe extends Ape { @@ -56,7 +56,7 @@ class QuestionApe extends Ape {
56 this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); 56 this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
57 return; 57 return;
58 } 58 }
59 - let itemIdx = ApeConsts.CONFERENCE_OBJ_QUESTION_ID; 59 + let itemIdx =_param.itemIdx;
60 let modelPdu = this.packPdu(_param, itemIdx); 60 let modelPdu = this.packPdu(_param, itemIdx);
61 61
62 if (modelPdu == null) { 62 if (modelPdu == null) {
@@ -135,6 +135,8 @@ class QuestionApe extends Ape { @@ -135,6 +135,8 @@ class QuestionApe extends Ape {
135 case 1: 135 case 1:
136 case 2: 136 case 2:
137 case 3: 137 case 3:
  138 + case 4:
  139 + case 100:
138 //停止答题 140 //停止答题
139 loger.log("更新答题数据"); 141 loger.log("更新答题数据");
140 if(GlobalConfig.isHost){ 142 if(GlobalConfig.isHost){
@@ -161,11 +163,11 @@ class QuestionApe extends Ape { @@ -161,11 +163,11 @@ class QuestionApe extends Ape {
161 } 163 }
162 } 164 }
163 break; 165 break;
164 - case 4:  
165 - //停止点名  
166 - loger.log("更新点名数据");  
167 - this._emit(MessageTypes.UPDATE_CALL_THE_ROLL,model);  
168 - break; 166 + //case 4:
  167 + // //停止点名
  168 + // loger.log("更新点名数据");
  169 + // this._emit(MessageTypes.UPDATE_CALL_THE_ROLL,model);
  170 + // break;
169 default : 171 default :
170 break; 172 break;
171 } 173 }
@@ -317,7 +319,7 @@ class QuestionApe extends Ape { @@ -317,7 +319,7 @@ class QuestionApe extends Ape {
317 return; 319 return;
318 }else { 320 }else {
319 if(this._sass){ 321 if(this._sass){
320 - if(this.questionList[_param.itemIdx]){ 322 + if(questionItem.questionId==parseInt(_param.questionId)){
321 loger.log("保存答题答案->",_param); 323 loger.log("保存答题答案->",_param);
322 let paramObj=_param; 324 let paramObj=_param;
323 paramObj.classId=GlobalConfig.classId; 325 paramObj.classId=GlobalConfig.classId;
@@ -325,11 +327,13 @@ class QuestionApe extends Ape { @@ -325,11 +327,13 @@ class QuestionApe extends Ape {
325 paramObj.userName = GlobalConfig.userName; 327 paramObj.userName = GlobalConfig.userName;
326 this._sass.sendAnswer(paramObj); 328 this._sass.sendAnswer(paramObj);
327 }else { 329 }else {
328 - loger.log("保存答题答案->数据不存在",_param); 330 + loger.log("保存答题答案->questionId不存在",_param);
329 console.log("questionList",this.questionList); 331 console.log("questionList",this.questionList);
330 } 332 }
331 } 333 }
332 } 334 }
  335 + }else {
  336 + loger.warn("保存答题答案->数据不存在",_param);
333 } 337 }
334 } 338 }
335 stopQuestion(_param){ 339 stopQuestion(_param){
@@ -337,17 +341,27 @@ class QuestionApe extends Ape { @@ -337,17 +341,27 @@ class QuestionApe extends Ape {
337 loger.warn("停止答题->参数错误",_param); 341 loger.warn("停止答题->参数错误",_param);
338 return; 342 return;
339 } 343 }
340 - loger.log("停止答题->",_param);  
341 - this.tableDelete(_param); 344 + if(this.questionList[_param.itemIdx]){
  345 + loger.log("停止答题->",_param);
  346 + this.tableDelete(_param);
  347 + }else {
  348 + loger.warn("停止答题->数据不存在",_param);
  349 + }
342 } 350 }
343 //Sass 事件监听 351 //Sass 事件监听
344 _sassCreatQuestionSuccessHandler(_data){ 352 _sassCreatQuestionSuccessHandler(_data){
345 - loger.log("创建答题卡成功",_data); 353 + //loger.log("创建答题卡成功",_data);
346 if(_data){ 354 if(_data){
347 //this.questionDataList[_data.questionId]=_data;//保存题目数据 355 //this.questionDataList[_data.questionId]=_data;//保存题目数据
348 356
349 let questionItem=_data; 357 let questionItem=_data;
350 - questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID; 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();
351 this.sendUpdaterTable(questionItem); 365 this.sendUpdaterTable(questionItem);
352 } 366 }
353 367