From 63295bac615461a69c4bd429141632dceea67647 Mon Sep 17 00:00:00 2001 From: liyong <liyong@3mang.com> Date: Fri, 20 Oct 2017 16:40:12 +0800 Subject: [PATCH] 1.新增白板文档切换接口;2.文档数据更新的时候增加新字段判断是否是白板文档;3.白板文档的ID设置为固定值 --- src/EngineEntrance.js | 54 ++++++++++++++++++++++++++++++++++++++++++------------ src/GlobalConfig.js | 2 +- src/apes/DocApe.js | 22 +++++++++++++++------- 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/src/EngineEntrance.js b/src/EngineEntrance.js index 9536a16..658cb77 100644 --- a/src/EngineEntrance.js +++ b/src/EngineEntrance.js @@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter { constructor() { super(); //sdk 信息 - GlobalConfig.sdkVersion = "v2.18.15.20171020"; + GlobalConfig.sdkVersion = "v2.19.8.20171020"; loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); //设置 @@ -261,7 +261,7 @@ export default class MessageEntrance extends Emiter { this.getDocPDFFullPath = this._getDocPDFFullPath.bind(this); //获取文档的完整路径 this.getDocFullAddress = this._getDocFullAddress.bind(this); //获取文档资源地址 this.hideCurrentDocument=this._hideCurrentDocument.bind(this);//隐藏当前显示的文档 - + this.switchToWhiteboard = this._switchToWhiteboard.bind(this); //切换到白板文档 //媒体共享模块 this.mediaSharedUpload = this._sendMediaSharedUpload.bind(this); //上传 this.mediaSharedDelete = this._sassDeletMediaShare.bind(this); //删除,先通过Sass删除,删除成功之后才删除MCU的 @@ -1773,6 +1773,21 @@ export default class MessageEntrance extends Emiter { GlobalConfig.setVideoCDNAddr(_data.videoCDNAddr); //cdn加速的拉流地址,直播的时候才使用 GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表 + //设置白板文档,固定ID + let whiteBoradData={ + itemIdx:GlobalConfig.whiteboardId,//指定的白板文档ID + name: "白板.pdf", + creatUserId: 0, + md5:"b153313f6f390328a30db5389b6cee53", + pageNum: 30, + docId: "b153313f6f390328a30db5389b6cee53", + url:"http://pclive.xuedianyun.com/DocSharing/data/whiteboard/default/whiteboard.pdf", + dynamicTransferStatic: "0", + relativeUrl: "/DocSharing/data/whiteboard/default/whiteboard.pdf", + fileType: "pdf" + } + GlobalConfig.docListPrepare.push(whiteBoradData); + let appConfigStr=_data.appConfig; appConfigStr=_base64.decode(appConfigStr); let appConfig={}; @@ -2229,14 +2244,29 @@ export default class MessageEntrance extends Emiter { //切换文档 _sendDocumentSwitchDoc(_param) { if (!_mcu.connected) { - loger.warn(GlobalConfig.getCurrentStatus()); + loger.warn("连接已经断开->不能切换文档"); return; } if (_doc_ape) { _doc_ape.documentSwitchDoc(_param); } } - + //切换到白板文档 + _switchToWhiteboard(_param){ + if (!_mcu.connected) { + loger.warn("连接已经断开->不能切换到白板文档"); + return; + } + //白板文档的数据 + let data={ + itemIdx:GlobalConfig.whiteboardId, + visible:true + } + if (_doc_ape) { + loger.log("切换到白板文档"); + _doc_ape.documentSwitchDoc(data); + } + } //操作文档(翻页) _sendDocumentSwitchPage(_param) { if (!_mcu.connected) { @@ -2321,7 +2351,6 @@ export default class MessageEntrance extends Emiter { //文档加入频道成功,同步到MCU服务器上的数据 docJoinChannelSuccess() { loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); - //loger.log("docJoinChannelSuccess docListPrepare="); //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 if (GlobalConfig.docListPrepare && GlobalConfig.docListPrepare.length > 0) { //如果当前身份是老师或者当前课堂内只有一个人,有权限同步文档到MCU @@ -2331,15 +2360,16 @@ export default class MessageEntrance extends Emiter { if (value) { //loger.log("判断是否需要把提前上传的文档上传到mcu", value); let paramInfo = { - "pageNum": value.pdfSize, + "pageNum": value.pdfSize||value.pageNum, "fileName": value.name, "fileType": value.type, - "relativeUrl": value.relativeLocation, - "url": value.absoluteLocation, - "creatUserId": value.createUserID, - "docId": value.id, - "md5": value.MD5, - "visible": false + "relativeUrl": value.relativeLocation||value.relativeUrl, + "url": value.absoluteLocation||value.url, + "creatUserId": value.createUserID||0, + "docId": value.id||value.docId, + "md5": value.MD5||"", + "visible": false, + "itemIdx":value.itemIdx||0 }; this._sendDocumentUpload(paramInfo); } diff --git a/src/GlobalConfig.js b/src/GlobalConfig.js index 629bf06..89cf4e5 100644 --- a/src/GlobalConfig.js +++ b/src/GlobalConfig.js @@ -568,7 +568,7 @@ GlobalConfig.updateRecordTimeDelay = 5; //(秒),同步一次课堂录制状态 GlobalConfig.updateClassInfoDelay = 10; //(秒),同步一次课堂状态的并保存到Sass GlobalConfig.msDynamicChooseIpDelay = 60 * 3; //(秒)MS动态选点的间隔 //GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取 - +GlobalConfig.whiteboardId=2359297;//白板文档的ID GlobalConfig.activeDocId = 0; //当前激活的文档ID GlobalConfig.activeDocCurPage = 1; //当前激活的文档的当前页 diff --git a/src/apes/DocApe.js b/src/apes/DocApe.js index 7bae4d0..461ef42 100644 --- a/src/apes/DocApe.js +++ b/src/apes/DocApe.js @@ -53,14 +53,18 @@ class DocApe extends Ape { return; } - let itemIdx = EngineUtils.creatSoleNumberFromTimestamp();// + let itemIdx =parseInt(paramInfo.itemIdx||0);//使用外部指定的itemIdx + if(itemIdx<=0){ + //外部指定的值无效就使用时间戳 + itemIdx = EngineUtils.creatSoleNumberFromTimestamp(); + } let docDataModelPdu = this.packPdu(paramInfo, itemIdx); - if (docDataModelPdu == null) { - loger.log('上传文档->失败->数据无效'); + //数据无效或地址无效的不做处理 + if (docDataModelPdu == null||!docDataModelPdu.url) { + loger.log('上传文档->失败->数据无效',docDataModelPdu); this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); return; } - //console.log(docDataModelPdu); let tableItemPdu = new pdu['RCRegistryTableItemPdu']; tableItemPdu.itemIdx = itemIdx;//直接用时间戳作为id @@ -305,6 +309,10 @@ class DocApe extends Ape { //组织完整的文档信息,包含上传时的信息和转换后的完整地址信息 _docPackFullInfo(_itemDataInfo) { let itemDataInfo = _itemDataInfo; + itemDataInfo.isWhiteboard=false;//默认是普通的文档 + if(itemDataInfo.itemIdx==GlobalConfig.whiteboardId){ + itemDataInfo.isWhiteboard=true;//这是白板数据 + } let getDocAddress = this.getDocFullAddress(_itemDataInfo); //loger.log('docPackFullInfo->', itemDataInfo); if (getDocAddress.code == ApeConsts.RETURN_SUCCESS) { @@ -571,7 +579,7 @@ class DocApe extends Ape { if (insertItem) { //this.tableInsertHandler(insertItem.owner, insertItem.itemIdx, insertItem.itemData); let itemDataInfo = this.unPackPdu(insertItem.owner, insertItem.itemIdx, insertItem.itemData); - if (itemDataInfo) { + if (itemDataInfo&&itemDataInfo.url) { this.docList[insertItem.itemIdx] = itemDataInfo; if (itemDataInfo.visible == "true" || itemDataInfo.visible == true) { GlobalConfig.activeDocId = itemDataInfo.itemIdx;//当前激活的文档ID @@ -639,7 +647,7 @@ class DocApe extends Ape { let tableItem = _tableUpdateItems[i]; if (tableItem) { let itemDataInfo = this.unPackPdu(tableItem.owner, tableItem.itemIdx, tableItem.itemData); - if (itemDataInfo) { + if (itemDataInfo&&itemDataInfo.url) { this.docList[tableItem.itemIdx] = itemDataInfo; if (itemDataInfo && (itemDataInfo.visible == "true" || itemDataInfo.visible == true)) { GlobalConfig.activeDocId = itemDataInfo.itemIdx;//当前激活的文档ID @@ -713,7 +721,7 @@ class DocApe extends Ape { //遍历查找 for (let key in this.docList) { let item = this.docList[key]; - if (item && item.docId == _docId) { + if (item && item.docId == _docId&&item.url) { //loger.log('查找文档->已经存在->',_docId); return true; } -- libgit2 0.24.0