正在显示
3 个修改的文件
包含
56 行增加
和
61 行删除
dist/McuClient.js
0 → 100644
此 diff 太大无法显示。
| @@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | @@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | ||
| 26 | import UTF8 from 'utf-8'; | 26 | import UTF8 from 'utf-8'; |
| 27 | 27 | ||
| 28 | let loger = Loger.getLoger('MessageEntrance'); | 28 | let loger = Loger.getLoger('MessageEntrance'); |
| 29 | -let _sdkInfo = {"version": "v.1.8.8.20170406", "author": "www.3mang.com"}; | 29 | +let _sdkInfo = {"version": "v.1.8.9.20170407", "author": "www.3mang.com"}; |
| 30 | 30 | ||
| 31 | //APE | 31 | //APE |
| 32 | let _sass; | 32 | let _sass; |
| @@ -155,7 +155,6 @@ export default class MessageEntrance extends Emiter { | @@ -155,7 +155,6 @@ export default class MessageEntrance extends Emiter { | ||
| 155 | 155 | ||
| 156 | //whiteBoradApe | 156 | //whiteBoradApe |
| 157 | this.sendInsertAnnotaion = this._sendInsertAnnotaion.bind(this); | 157 | this.sendInsertAnnotaion = this._sendInsertAnnotaion.bind(this); |
| 158 | - //this.sendDeleteAnnotaion=this._sendDeleteAnnotaion; | ||
| 159 | this.sendDeleteAllAnnotation = this._sendDeleteAllAnnotation.bind(this); | 158 | this.sendDeleteAllAnnotation = this._sendDeleteAllAnnotation.bind(this); |
| 160 | this.sendDeleteCurPageAnnotation = this._sendDeleteCurPageAnnotation.bind(this); | 159 | this.sendDeleteCurPageAnnotation = this._sendDeleteCurPageAnnotation.bind(this); |
| 161 | this.sendGotoPrev = this._sendGotoPrev.bind(this); | 160 | this.sendGotoPrev = this._sendGotoPrev.bind(this); |
| @@ -880,18 +879,6 @@ export default class MessageEntrance extends Emiter { | @@ -880,18 +879,6 @@ export default class MessageEntrance extends Emiter { | ||
| 880 | _whiteboard_ape.sendInsetAnnotaion(_param); | 879 | _whiteboard_ape.sendInsetAnnotaion(_param); |
| 881 | } | 880 | } |
| 882 | } | 881 | } |
| 883 | - | ||
| 884 | - //删除标注,发送信息 | ||
| 885 | - _sendDeleteAnnotaion(_param) { | ||
| 886 | - if (!_mcu.connected) { | ||
| 887 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 888 | - return; | ||
| 889 | - } | ||
| 890 | - if (_whiteboard_ape) { | ||
| 891 | - _whiteboard_ape.sendDeleteAnnotaion(_param); | ||
| 892 | - } | ||
| 893 | - } | ||
| 894 | - | ||
| 895 | //删除当前页面上的所有标注 | 882 | //删除当前页面上的所有标注 |
| 896 | _sendDeleteCurPageAnnotation(_param) { | 883 | _sendDeleteCurPageAnnotation(_param) { |
| 897 | if (!_mcu.connected) { | 884 | if (!_mcu.connected) { |
| @@ -1052,24 +1039,6 @@ export default class MessageEntrance extends Emiter { | @@ -1052,24 +1039,6 @@ export default class MessageEntrance extends Emiter { | ||
| 1052 | this._sendDocumentUpload(paramInfo); | 1039 | this._sendDocumentUpload(paramInfo); |
| 1053 | } | 1040 | } |
| 1054 | } | 1041 | } |
| 1055 | - /* for (let value of GlobalConfig.docListPrepare) { | ||
| 1056 | - if (value) { | ||
| 1057 | - loger.log("判断是否需要把提前上传的文档上传到mcu", value); | ||
| 1058 | - let paramInfo = { | ||
| 1059 | - "pageNum": value.pdfSize, | ||
| 1060 | - "fileName": value.name, | ||
| 1061 | - "fileType": value.type, | ||
| 1062 | - "relativeUrl": value.relativeLocation, | ||
| 1063 | - "url": value.absoluteLocation, | ||
| 1064 | - "creatUserId": value.createUserID, | ||
| 1065 | - "docId": value.id, | ||
| 1066 | - "md5": value.MD5, | ||
| 1067 | - "visible": false | ||
| 1068 | - }; | ||
| 1069 | - | ||
| 1070 | - this._sendDocumentUpload(paramInfo); | ||
| 1071 | - } | ||
| 1072 | - }*/ | ||
| 1073 | } | 1042 | } |
| 1074 | } | 1043 | } |
| 1075 | 1044 |
| @@ -62,20 +62,18 @@ class WhiteBoardApe extends Ape { | @@ -62,20 +62,18 @@ class WhiteBoardApe extends Ape { | ||
| 62 | // 添加标注,发送信息 | 62 | // 添加标注,发送信息 |
| 63 | sendInsetAnnotaion(_param) { | 63 | sendInsetAnnotaion(_param) { |
| 64 | if (_param == null || EngineUtils.isEmptyObject(_param)) { | 64 | if (_param == null || EngineUtils.isEmptyObject(_param)) { |
| 65 | - loger.log('sendInsetAnnotaion失败,参数错误'); | 65 | + loger.warn('添加标注失败->参数错误->',_param); |
| 66 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 66 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | - itemIdx = EngineUtils.creatSoleNumberFromTimestamp(); | 70 | + itemIdx = EngineUtils.creatSoleNumberFromTimestamp();//创建时间戳,保证每条数据的唯一 |
| 71 | let whiteBoardModelPdu = this.packPdu(_param, itemIdx); | 71 | let whiteBoardModelPdu = this.packPdu(_param, itemIdx); |
| 72 | if (whiteBoardModelPdu == null) { | 72 | if (whiteBoardModelPdu == null) { |
| 73 | - loger.log('sendInsetAnnotaion失败,参数错误'); | 73 | + loger.warn('添加标注失败-->参数错误->',_param); |
| 74 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 74 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 75 | return; | 75 | return; |
| 76 | } | 76 | } |
| 77 | - //console.log(whiteBoardModelPdu); | ||
| 78 | - | ||
| 79 | //储存记录,用于返回上一步操作 | 77 | //储存记录,用于返回上一步操作 |
| 80 | this.insertHistory.push(whiteBoardModelPdu); | 78 | this.insertHistory.push(whiteBoardModelPdu); |
| 81 | 79 | ||
| @@ -87,8 +85,6 @@ class WhiteBoardApe extends Ape { | @@ -87,8 +85,6 @@ class WhiteBoardApe extends Ape { | ||
| 87 | 85 | ||
| 88 | //insert | 86 | //insert |
| 89 | let tableInsertItemPdu = new pdu['RCRegistryTableInsertItemPdu']; | 87 | let tableInsertItemPdu = new pdu['RCRegistryTableInsertItemPdu']; |
| 90 | - //optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU]; | ||
| 91 | - //repeated RCRegistryTableItemPdu items = 2; | ||
| 92 | tableInsertItemPdu.type = pdu.RCPDU_REG_TABLE_INSERT_PDU;// | 88 | tableInsertItemPdu.type = pdu.RCPDU_REG_TABLE_INSERT_PDU;// |
| 93 | tableInsertItemPdu.items.push(tableItemPdu); | 89 | tableInsertItemPdu.items.push(tableItemPdu); |
| 94 | 90 | ||
| @@ -106,43 +102,79 @@ class WhiteBoardApe extends Ape { | @@ -106,43 +102,79 @@ class WhiteBoardApe extends Ape { | ||
| 106 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 102 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 107 | adapterPdu.item.push(adapterItemPdu); | 103 | adapterPdu.item.push(adapterItemPdu); |
| 108 | 104 | ||
| 109 | - loger.log("添加白板数据=====itemIdx=" + tableItemPdu.itemIdx); | 105 | + loger.log("添加标注->itemIdx=" + tableItemPdu.itemIdx); |
| 110 | this.sendUniform(adapterPdu, true); | 106 | this.sendUniform(adapterPdu, true); |
| 111 | } | 107 | } |
| 112 | 108 | ||
| 113 | //撤销上一步 | 109 | //撤销上一步 |
| 114 | sendGotoPrev() { | 110 | sendGotoPrev() { |
| 115 | - loger.log("白板返回上一步"); | 111 | + loger.log("撤销上一步"); |
| 116 | if (this.insertHistory == null || this.insertHistory.length < 1) { | 112 | if (this.insertHistory == null || this.insertHistory.length < 1) { |
| 117 | loger.warn("无法继续上一步操作,已经没有可以撤销的数据"); | 113 | loger.warn("无法继续上一步操作,已经没有可以撤销的数据"); |
| 118 | return; | 114 | return; |
| 119 | } | 115 | } |
| 120 | - //loger.log(this.insertHistory); | ||
| 121 | - this.sendDeleteAnnotaion(this.insertHistory.pop()); | 116 | + let annoItem=this.insertHistory.pop(); |
| 117 | + if(annoItem){ | ||
| 118 | + let temAnnos={}; | ||
| 119 | + temAnnos[annoItem.itemIdx]=annoItem; | ||
| 120 | + this.sendDeleteAnnotaion({"itemIdxArr":temAnnos}); | ||
| 121 | + } | ||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | //删除当前页码的所有标注 | 124 | //删除当前页码的所有标注 |
| 125 | sendDeleteCurPageAnnotation(_param) { | 125 | sendDeleteCurPageAnnotation(_param) { |
| 126 | this.insertHistory=[]; | 126 | this.insertHistory=[]; |
| 127 | + let curPageAnnos={}; | ||
| 127 | for (let key in this.annoInfos) { | 128 | for (let key in this.annoInfos) { |
| 128 | let item = this.annoInfos[key]; | 129 | let item = this.annoInfos[key]; |
| 129 | if (item && item.parentId == GlobalConfig.activeDocId && item.curPageNo == GlobalConfig.activeDocCurPage) { | 130 | if (item && item.parentId == GlobalConfig.activeDocId && item.curPageNo == GlobalConfig.activeDocCurPage) { |
| 130 | - loger.log("sendDeleteCurPageAnnotation 删除当前页面上的标注", key); | ||
| 131 | - this.sendDeleteAnnotaion({"itemIdx": key}); | 131 | + //loger.log("sendDeleteCurPageAnnotation 删除当前页面上的标注", key); |
| 132 | + //this.sendDeleteAnnotaion({"itemIdx": key}); | ||
| 133 | + curPageAnnos[key]=item; | ||
| 132 | } | 134 | } |
| 133 | } | 135 | } |
| 136 | + | ||
| 137 | + this.sendDeleteAnnotaion({"itemIdxArr":curPageAnnos}); | ||
| 134 | } | 138 | } |
| 135 | 139 | ||
| 136 | //删除所有标注 | 140 | //删除所有标注 |
| 137 | sendDeleteAllAnnotation(_param) { | 141 | sendDeleteAllAnnotation(_param) { |
| 138 | this.insertHistory=[]; | 142 | this.insertHistory=[]; |
| 139 | - for (let key in this.annoInfos) { | 143 | + /* for (let key in this.annoInfos) { |
| 140 | this.sendDeleteAnnotaion({"itemIdx": key}); | 144 | this.sendDeleteAnnotaion({"itemIdx": key}); |
| 141 | - } | 145 | + }*/ |
| 146 | + this.sendDeleteAnnotaion({"itemIdxArr":this.annoInfos}); | ||
| 142 | } | 147 | } |
| 143 | 148 | ||
| 144 | - //删除标注,发送信息 | 149 | + //删除标注,发送信息 {"itemIdxArr":{}} |
| 145 | sendDeleteAnnotaion(_param) { | 150 | sendDeleteAnnotaion(_param) { |
| 151 | + if (_param == null||_param.itemIdxArr==null) { | ||
| 152 | + loger.warn("要删除的数据不存在->",_param); | ||
| 153 | + return; | ||
| 154 | + } | ||
| 155 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 156 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 157 | + | ||
| 158 | + for (let key in _param.itemIdxArr) { | ||
| 159 | + let tableDeleteItemPdu = new pdu['RCRegistryTableDeleteItemPdu']; | ||
| 160 | + tableDeleteItemPdu.type = pdu.RCPDU_REG_TABLE_DELETE_PDU;// | ||
| 161 | + tableDeleteItemPdu.itemIdx = parseInt(key);//这里需要设置要删除的数据的itemIdx,每条数据的这个id都不一样 | ||
| 162 | + | ||
| 163 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 164 | + updateObjPdu.objId = ApeConsts.WHITEBOARD_OBJ_TABLE_ID; | ||
| 165 | + updateObjPdu.subType = tableDeleteItemPdu.type; | ||
| 166 | + updateObjPdu.userData = tableDeleteItemPdu.toArrayBuffer(); | ||
| 167 | + | ||
| 168 | + //同步 | ||
| 169 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 170 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 171 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 172 | + adapterPdu.item.push(adapterItemPdu); | ||
| 173 | + } | ||
| 174 | + loger.log("发送删除白板标注数据->长度:" + adapterPdu.item.length); | ||
| 175 | + this.sendUniform(adapterPdu, true); | ||
| 176 | + } | ||
| 177 | + /*sendDeleteAnnotaion(_param) { | ||
| 146 | if (_param == null) { | 178 | if (_param == null) { |
| 147 | loger.warn("要删除的数据不存在"); | 179 | loger.warn("要删除的数据不存在"); |
| 148 | return; | 180 | return; |
| @@ -168,9 +200,11 @@ class WhiteBoardApe extends Ape { | @@ -168,9 +200,11 @@ class WhiteBoardApe extends Ape { | ||
| 168 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 200 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 169 | adapterPdu.item.push(adapterItemPdu); | 201 | adapterPdu.item.push(adapterItemPdu); |
| 170 | 202 | ||
| 171 | - loger.log("白板发送删除数据=============" + tableDeleteItemPdu.itemIdx); | 203 | + loger.log("白板发送删除数据->" + tableDeleteItemPdu.itemIdx); |
| 172 | this.sendUniform(adapterPdu, true); | 204 | this.sendUniform(adapterPdu, true); |
| 173 | - } | 205 | + }*/ |
| 206 | + | ||
| 207 | + | ||
| 174 | 208 | ||
| 175 | 209 | ||
| 176 | //更新标注 | 210 | //更新标注 |
| @@ -182,7 +216,6 @@ class WhiteBoardApe extends Ape { | @@ -182,7 +216,6 @@ class WhiteBoardApe extends Ape { | ||
| 182 | } | 216 | } |
| 183 | itemIdx = _param.itemIdx; | 217 | itemIdx = _param.itemIdx; |
| 184 | let whiteBoardModelPdu = this.packPdu(_param, itemIdx); | 218 | let whiteBoardModelPdu = this.packPdu(_param, itemIdx); |
| 185 | - //console.log(whiteBoardModelPdu); | ||
| 186 | 219 | ||
| 187 | if (whiteBoardModelPdu == null) { | 220 | if (whiteBoardModelPdu == null) { |
| 188 | loger.log('sendInsetAnnotaion失败,参数错误'); | 221 | loger.log('sendInsetAnnotaion失败,参数错误'); |
| @@ -230,8 +263,7 @@ class WhiteBoardApe extends Ape { | @@ -230,8 +263,7 @@ class WhiteBoardApe extends Ape { | ||
| 230 | loger.log(whiteBoardModel); | 263 | loger.log(whiteBoardModel); |
| 231 | if (whiteBoardModel) { | 264 | if (whiteBoardModel) { |
| 232 | if (GlobalConfig.activeDocId == whiteBoardModel.parentId && GlobalConfig.activeDocCurPage == whiteBoardModel.curPageNo) { | 265 | if (GlobalConfig.activeDocId == whiteBoardModel.parentId && GlobalConfig.activeDocCurPage == whiteBoardModel.curPageNo) { |
| 233 | - loger.log('WHITEBOARD_ANNOTAION_INSERT 显示到界面上', whiteBoardModel); | ||
| 234 | - //this._emit(MessageTypes.WHITEBOARD_ANNOTAION_INSERT,whiteBoardModel); | 266 | + //loger.log('显示新增的标注->'); |
| 235 | this.insertAandShowAnnotaion(whiteBoardModel); | 267 | this.insertAandShowAnnotaion(whiteBoardModel); |
| 236 | } | 268 | } |
| 237 | } | 269 | } |
| @@ -266,7 +298,6 @@ class WhiteBoardApe extends Ape { | @@ -266,7 +298,6 @@ class WhiteBoardApe extends Ape { | ||
| 266 | for (let i = 0; i < len; i++) { | 298 | for (let i = 0; i < len; i++) { |
| 267 | if (this.annoInfos[itemIdxs[i]]) { | 299 | if (this.annoInfos[itemIdxs[i]]) { |
| 268 | loger.log("删除白板数据:", itemIdxs[i]); | 300 | loger.log("删除白板数据:", itemIdxs[i]); |
| 269 | - //this._emit(MessageTypes.WHITEBOARD_ANNOTAION_DELETE,{ "itemIdx":itemIdxs[i]}); | ||
| 270 | delete this.annoInfos[itemIdxs[i]]; | 301 | delete this.annoInfos[itemIdxs[i]]; |
| 271 | } | 302 | } |
| 272 | } | 303 | } |
| @@ -311,7 +342,7 @@ class WhiteBoardApe extends Ape { | @@ -311,7 +342,7 @@ class WhiteBoardApe extends Ape { | ||
| 311 | "isFresh": false, | 342 | "isFresh": false, |
| 312 | "annotaionItems": annotaionItems | 343 | "annotaionItems": annotaionItems |
| 313 | }; | 344 | }; |
| 314 | - loger.log("WHITEBOARD_ANNOTATION_UPDATE", annotaionItems.length); | 345 | + loger.log("新增一条标注数据->显示到界面"); |
| 315 | this._emit(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, updateObj); | 346 | this._emit(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, updateObj); |
| 316 | } | 347 | } |
| 317 | 348 | ||
| @@ -331,7 +362,7 @@ class WhiteBoardApe extends Ape { | @@ -331,7 +362,7 @@ class WhiteBoardApe extends Ape { | ||
| 331 | "isFresh": true,//清除现有显示的数据 | 362 | "isFresh": true,//清除现有显示的数据 |
| 332 | "annotaionItems": annotaionItems //最新需要显示的数据 | 363 | "annotaionItems": annotaionItems //最新需要显示的数据 |
| 333 | }; | 364 | }; |
| 334 | - loger.log("清除标注---->重绘标注数量--->", annotaionItems.length,"当前文档信息--->DocId->",GlobalConfig.activeDocId,"curPageNo->",GlobalConfig.activeDocCurPage); | 365 | + loger.log("清除当前显示的标注---->重绘标注数量--->", annotaionItems.length,"当前文档信息--->DocId->",GlobalConfig.activeDocId,"curPageNo->",GlobalConfig.activeDocCurPage); |
| 335 | this._emit(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, updateObj); | 366 | this._emit(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, updateObj); |
| 336 | } | 367 | } |
| 337 | 368 | ||
| @@ -369,9 +400,6 @@ class WhiteBoardApe extends Ape { | @@ -369,9 +400,6 @@ class WhiteBoardApe extends Ape { | ||
| 369 | whiteBoardModelPdu.itemIdx = _itemIdx; | 400 | whiteBoardModelPdu.itemIdx = _itemIdx; |
| 370 | whiteBoardModelPdu.initiator = GlobalConfig.nodeId; | 401 | whiteBoardModelPdu.initiator = GlobalConfig.nodeId; |
| 371 | 402 | ||
| 372 | - /* whiteBoardModelPdu.parentId=_param.parentId||0; | ||
| 373 | - whiteBoardModelPdu.curPage=_param.curPage||1;*/ | ||
| 374 | - | ||
| 375 | whiteBoardModelPdu.parentId = GlobalConfig.activeDocId;//当前激活的文档id | 403 | whiteBoardModelPdu.parentId = GlobalConfig.activeDocId;//当前激活的文档id |
| 376 | whiteBoardModelPdu.curPageNo = GlobalConfig.activeDocCurPage;//当前激活的文档页码 | 404 | whiteBoardModelPdu.curPageNo = GlobalConfig.activeDocCurPage;//当前激活的文档页码 |
| 377 | 405 | ||
| @@ -386,8 +414,6 @@ class WhiteBoardApe extends Ape { | @@ -386,8 +414,6 @@ class WhiteBoardApe extends Ape { | ||
| 386 | try { | 414 | try { |
| 387 | loger.log("白板收到数据===unPackPdu "); | 415 | loger.log("白板收到数据===unPackPdu "); |
| 388 | let whiteBoardModelPdu = pdu['RCWhiteBoardDataModelPdu'].decode(itemData); | 416 | let whiteBoardModelPdu = pdu['RCWhiteBoardDataModelPdu'].decode(itemData); |
| 389 | - //console.log(whiteBoardModelPdu); | ||
| 390 | - //loger.log(whiteBoardModelPdu); | ||
| 391 | let _pointGroup = EngineUtils.arrayFromJsonString(whiteBoardModelPdu.pointGroup); | 417 | let _pointGroup = EngineUtils.arrayFromJsonString(whiteBoardModelPdu.pointGroup); |
| 392 | whiteBoardModelPdu.pointGroup = _pointGroup; | 418 | whiteBoardModelPdu.pointGroup = _pointGroup; |
| 393 | this.annoInfos[itemIdx] = whiteBoardModelPdu; | 419 | this.annoInfos[itemIdx] = whiteBoardModelPdu; |
-
请 注册 或 登录 后发表评论