吾道SDK-接入说明
张伟宝 保存 显示目录
一、概述
吾道SDK可以帮助第三方网站及应用快速构建一个幻灯片编辑器,SDK提供较为完善的编辑器应用功能,及简洁的API接口。
SDK提供如下扩展功能:
- 自定义接入
- 文档页操作(增加、删除、修改、排序,选中)
- 撤回重做
- 文档下载
- 文档预览
- 获取编辑数据
对接吾道SDK,首先需要联系吾道客服开通平台账号,然后根据客服返回的appId和appSecret,在页面上添加提供的接入代码即可,代码需要加在body中。用户访问页面时,页面执行代码,加载吾道的JS文件。
API列表
API | API说明 |
---|---|
woodoJs.init(config,callball) | 设置sdk初始化成功回调 |
woodoJs.addPage(pageInfos,targetPageUuid,record,callback) | 添加文档页 |
woodoJs.delPage(pageUuids,record,callback) | 删除文档页 |
woodoJs.replacePage(pages,record,callback) | 修改或替换文档页 |
woodoJs.orderPage(orderPageUuids,targetPageUuid,record,callback) | 排序文档页 |
woodoJs.selectPage(pageUuid,record,callback) | 选中文档页 |
woodoJs.addRecord(record,callback) | 添加操作记录 |
woodoJs.getSaveCommand(callback) | 获取保存数据 |
woodoJs.addPagesByDocId(docId,targetPageUuid,appId,token,time,record,callback) | 根据文档ID添加文档页 |
二、接入说明
基本接入配置
1、获取接入资格
联系吾道客服,开通接入资格,并保存好吾道客服返回的appId、appSecret和domain
ps:测试的appId、appSecret、domain如下(测试通过后再重新生成新的)
appId:xxx
appSecret:xxxxxxx
domain:https://www.woodo.cn
接入流程
1、页面引入woodoJs并调用init方法初始化sdk
function loadScript(src, callback) { var script = document.createElement('script'), head = document.getElementsByTagName('head')[0]; script.type = 'text/javascript'; script.charset = 'UTF-8'; script.src = src; if (script.addEventListener) { script.addEventListener('load', function () { callback(); }, false); } else if (script.attachEvent) { script.attachEvent('onreadystatechange', function () { var target = window.event.srcElement; if (target.readyState == 'loaded') { callback(); } }); } head.appendChild(script); } loadScript("https://www.woodo.cn/public/sdk/api-sdk.js",function(){ woodoJs.init({ "domain":"https://www.woodo.cn", "appId":"appId", "token":"token", "time":"time", "css":"cssfile", "ele":"selector", "docId":"docId", "userUuid":"", listenMessage:function(){} }); });
2、初始化方法说明
初始化方法 woodoJs.init
接入方可以通过此接口对SDK进行配置
参数说明:
参数 | 类型 | 描述 |
---|---|---|
domain | 字符串,String | 必选,接入方使用什么域名访问编辑器 |
appId | 字符串,String | 必选,appId |
token | 字符串,String | 必选,根据JWT协议appId和appSecret生成token 详细请参考这个demo |
time | 字符串,String | 必选,生成token时的时间戳 |
css | 字符串,String | 可选,css文件地址,用来控制编辑器样式 |
ele | 字符串,String | 必选,编辑器使用初始化后,追加的节点选择器 |
docId | 字符串,String | 必选,文档ID |
userUuid | 字符串,String | 必选,接入方用户uuid,用于文档关联 |
loadingStart | 函数,Function | 可选,编辑器加载开始函数,如可做加载样式处理 |
loadingEnd | 函数,Function | 可选,编辑器加载结束函数,如可做加载样式处理 |
autoSave | 布尔值,Boolean | 可选,编辑器保存模式,true:自动保存,false手动保存(默认) |
ws | 布尔值,Boolean | 可选,协作通讯,true:开启,false:关闭(默认) |
listenMessage | 函数,Function | 可选,接收吾道上报消息接口,例如(吾道编辑器内新增文档页、排序页、撤回重做,都会上报数据到此接口),该接口上报的消息在下面listenMessage说明 |
示例代码:
woodoJs.init({ "domain":"https://www.woodo.cn", "appId":"wd5f983248169a4fdf", "token":"eyJhbGciOiJIUzM4NCJ9.eyJpYXQiOjE1NzcxNzEyNzUsImV4cCI6MTU3NzE3MTMzNX0.tOFq_gyVa6yIMwDdanMTVFjw1i5WxbyD8tEuOtuxsc_IVcLBddRqQs1ipG0bsNIA", "time":"1577171275984", "css":"https://www.woodo.cn/public/sdk/style.css", "ele":".woodo_area", "docId":"123456", "userUuid":"12356567ghj234234", "loadingStart":function(){console.log("加载开始")}, "loadingEnd":function(){console.log("加载结束")}, "autoSave":fales, listenMessage:function(data){ if(data.opt=="addPage"){ //添加页操作 }elseif(data.opt=="undo"){ //撤回操作 } } });
三、前端API对接
添加文档页 woodoJs.addPage
接入方可以通过此接口对文档添加文档页信息
参数说明:
参数 | 类型 | 描述 |
---|---|---|
pageInfos | 对象数组,Array<Object> | 必选,接入方经吾道提供的文档页数据 |
targetPageUuid | 字符串,String | 可选,文档页唯一标示,数据添加至指定文档页位置后,插入位置默认第一页 |
type | 字符串,String | 可选,插入方式,up:向上,down:向下 |
record | 对象,Object | 可选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
接入方操作record记录结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let pageInfos = []; let targetPageUuid = "uuid40183c8520751d8e51f5ce85d109"; let delPageUuids = ["uuide39843c77144eb3c0f7e904baefb","uuid98486832d0e1792e8fc0b557c30b"]; let record = { "master" : { "undo" : '平台添加文档页撤回'+new Date().getTime(), "redo" : '平台添加文档页重做'+new Date().getTime() } } //吾道接口返回的数据 let pageInfo = { //以下接口会忽略,可传可不传 "isLock": false, "image": null, "pageNumber": 1, "modifyDate": 1655365335000, "id": 4759430, "title": null, "uuid": "uuide60721dc8bac80a03b67d661402a", "createDate": 1655359203000, //以下属性为新增文档页内容 "switchType": "fadeInAndOut", "attr": null, "background": "{\"type\":\"color\",\"color\":\"#ffffff\",\"image\":null}", "elementList": "[{\"id\":\"uuid5011d3f29be4f6175098c94d7e1c\",\"type\":\"img\",\"group\":\"\",\"lock\":false,\"link\":null,\"opacity\":\"1\",\"animation\":[{\"name\":\"fade\",\"default\":\"true\",\"start\":\"same\",\"duration\":\"1\",\"delay\":\"0\",\"index\":[\"0\",\"0\"]}],\"translate\":\"250.2,51.2\",\"rotate\":\"0,204.8,204.8\",\"scale\":\"0.64,0.64\",\"border_w\":\"0\",\"border_c\":\"transparent\",\"border_s\":\"0\",\"border_o\":100,\"image_w\":\"640\",\"image_h\":\"640\",\"url\":\"https://500dme-test.oss-cn-shenzhen.aliyuncs.com/upload/image/202206/16/8a5b10b1-0338-4fad-bbe1-d7a8abba2c5d.jpg\",\"clip\":{\"id\":\"uuidde876f12c15f6d4cc8d3c17b395d\",\"type\":\"RECT\",\"scale\":\"1.6,1.6\",\"x\":\"0\",\"y\":\"0\",\"w\":\"640\",\"h\":\"640\",\"d\":\"M0,0 L400,0 L400,400 L0,400 L0,0 L0,0 Z\"},\"shadow\":{\"open\":false,\"distance\":15,\"blur\":15,\"rotate\":50,\"opacity\":25,\"color\":\"#000000\"},\"reversal\":{\"translate\":\"0,0\",\"matrix\":\"1,0,0,1,0,0\"},\"staticImage\":\"\"}]" } pageInfos.push(pageInfo); woodoJs.addPage(pageInfos,targetPageUuid,'down'record,function(data){ console.log(data); },delPageUuids);
pageInfo属性说明:elementList(文档页内容,json结构数组字符串或数组对象)、background(文档页背景色,json结构对象字符串或对象)
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
data | 对象,Object | 执行结果内容 |
data.targetPageUuid | 字符串,String | 插入的前一页,首页默认null |
data.pageInfos | 字符串数组,Array<String> | 新增文档页唯一标示 |
data.type | 字符串,String | 插入方式,up:向上,down:向下 |
删除文档页 woodoJs.delPage
接入方可以通过此接口对文档页进行删除
参数说明:
参数 | 类型 | 描述 |
---|---|---|
pageUuids | 字符串数组,Array<String> | 必选,文档页唯一标示,需要删除文档页 |
record | 对象,Object | 可选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
接入方操作record记录结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let pageUuids = ["uuid40183c8520751d8e51f5ce85d109"]; let record = { "master" : { "undo" : '平台删除文档页撤回'+new Date().getTime(), "redo" : '平台删除文档页重做'+new Date().getTime() } } woodoJs.delPage(pageUuids,record,function(data){ console.log(data); });
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
替换文档页 woodoJs.replacePage
接入方可以通过此接口对文档页替换
参数说明:
参数 | 类型 | 描述 |
---|---|---|
pages | 对象数组,Array<Object> | 必选,替换文档页数据,结构如下所示 |
record | 对象,Object | 可选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
接入方替换文档页pages结构
[{ srcUuid : 文档页唯一标示, pageInfo : 文档页数据 },...]
接入方操作记录record结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let pages = [ { srcUuid : "uuid1f06497107c43dd866c49c8e7575", pageInfo : { //以下接口会忽略,可传可不传 "isLock": false, "image": null, "pageNumber": 1, "modifyDate": 1655365335000, "id": 4759430, "title": null, "uuid": "uuide60721dc8bac80a03b67d661402a", "createDate": 1655359203000, //以下属性为新增文档页内容 "switchType": "fadeInAndOut", "attr": null, "background": "{\"type\":\"color\",\"color\":\"#ffffff\",\"image\":null}", "elementList": "[{\"id\":\"uuid5011d3f29be4f6175098c94d7e1c\",\"type\":\"img\",\"group\":\"\",\"lock\":false,\"link\":null,\"opacity\":\"1\",\"animation\":[{\"name\":\"fade\",\"default\":\"true\",\"start\":\"same\",\"duration\":\"1\",\"delay\":\"0\",\"index\":[\"0\",\"0\"]}],\"translate\":\"250.2,51.2\",\"rotate\":\"0,204.8,204.8\",\"scale\":\"0.64,0.64\",\"border_w\":\"0\",\"border_c\":\"transparent\",\"border_s\":\"0\",\"border_o\":100,\"image_w\":\"640\",\"image_h\":\"640\",\"url\":\"https://500dme-test.oss-cn-shenzhen.aliyuncs.com/upload/image/202206/16/8a5b10b1-0338-4fad-bbe1-d7a8abba2c5d.jpg\",\"clip\":{\"id\":\"uuidde876f12c15f6d4cc8d3c17b395d\",\"type\":\"RECT\",\"scale\":\"1.6,1.6\",\"x\":\"0\",\"y\":\"0\",\"w\":\"640\",\"h\":\"640\",\"d\":\"M0,0 L400,0 L400,400 L0,400 L0,0 L0,0 Z\"},\"shadow\":{\"open\":false,\"distance\":15,\"blur\":15,\"rotate\":50,\"opacity\":25,\"color\":\"#000000\"},\"reversal\":{\"translate\":\"0,0\",\"matrix\":\"1,0,0,1,0,0\"},\"staticImage\":\"\"}]" }; } ] let record = { "master" : { "undo" : '平台撤回'+new Date().getTime(), "redo" : '平台重做'+new Date().getTime() } } woodoJs.replacePage(pages, record, function(data){ console.log(data); });
pageInfo属性说明:elementList(文档页内容,json结构数组字符串或数组对象)、background(文档页背景色,json结构对象字符串或对象)、backgroundImage(背景图)、backgroundImageWidth(背景图宽)、backgroundImageHeight(背景图高)
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
排序文档页 woodoJs.orderPage
接入方可以通过此接口对文档页排序
参数说明:
参数 | 类型 | 描述 |
---|---|---|
orderPageUuids | 字符串数组,Array<String> | 必选,文档页唯一标示,需排序的文档页 |
targetPageUuid | 字符串,String | 可选,文档页唯一标示,放置指定文档页后,默认首页位置 |
record | 对象,Object | 可选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
接入方操作record记录结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let orderPageUuids = ["uuid7fad8f54fc9e923df25c05b400d4"]; let targetpageUuid = "uuid51996534cb06964a2b74760adab0"; let record = { "master" : { "undo" : '平台排序文档页撤回'+new Date().getTime(), "redo" : '平台排序文档页重做'+new Date().getTime() } } woodoJs.orderPage(orderPageUuids, targetpageUuid,record, function(data){ console.log(data); });
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
data | 对象,Object | 执行结果内容 |
data.after_uuid | 字符串,String | 文档页唯一标示,放置指定文档页后,默认首页 |
data.order_uuids | 字符串数组,Array<String> | 文档页唯一标示,需排序的文档页 |
选中文档页 woodoJs.selectPage
接入方可以通过此接口对文档页选中
参数说明:
参数 | 类型 | 描述 |
---|---|---|
pageUuid | 字符串,String | 必选,文档页唯一标示,需排序的文档页 |
record | 对象,Object | 可选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
接入方操作record记录结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let pageUuid = "uuid3dd50475eed60fe76490dabfbbf1"; let record = { "master" : { "undo" : '平台选中文档页撤回'+new Date().getTime(), "redo" : '平台选中文档页重做'+new Date().getTime() } } woodoJs.selectPage(pageUuid, record, function(data){ console.log(data); });
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
根据文档IDS添加文档页 woodoJs.addPagesByDocIds
接入方可以通过此接口对文档页添加
参数说明:
参数 | 类型 | 描述 |
---|---|---|
docIds | 长整型数组,Array<Long> | 必选,文档唯一标示,根据文档查询新增文档页 |
targetPageUuid | 字符串,String | 可选,文档页唯一标示,数据添加至指定文档页位置后,默认第一页 |
appId | 字符串,String | 必选,接入方应用id |
token | 字符串,String | 必选,接入方接口授权token |
time | 长整型,Long | 必选,接入方生成接口授权token时间戳 |
record | 对象,Object | 可选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
delPageUuids | 字符串数组,Array<String> | 可选,需要删除文档页的唯一标示(删除操作在新增操作后) |
接入方操作record记录结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let docIds = [516697,516698]; let targetPageUuid = 'uuidf0ddb25767d5e2820c75eb2001a2'; let delPageUuids = ['uuidf0ddb25767dasdasdasd5eb2001a2','uuidf0ddbasdasdasdasdb2001a2'];//可传 let appId = 'wd5f983248169a4fdf'; let token = 'eyJhbGciOiJIUzM4NCJ9.eyJpYXQiOjE1NzcxMDA2MzN9.QMuMg5im1T4NqEbnVX1i5QPeDzY66pjKcG66slvNoRbPAG5D6wFIIrMmaQqYhfGa'; let time = '1577082911535'; let record = { "master" : { "undo" : '平台添加文档页撤回'+new Date().getTime(), "redo" : '平台添加文档页重做'+new Date().getTime() } } woodoJs.addPagesByDocIds(docIds, targetPageUuid, appId, token, time, record,function(data){ console.log(data) },delPageUuids);
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
data | 对象数组,Array<Object> | 执行结果内容,新增文档对应文档页唯一标示 |
添加接入方操作记录 woodoJs.addRecord
接入方可以通过此接口添加操作记录
参数说明:
参数 | 类型 | 描述 |
---|---|---|
record | 对象,Object | 必选,接入方操作记录,结构如下所示 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
接入方操作record记录结构
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
let record = { "master" : { "undo" : '平台添加操作记录撤回'+new Date().getTime(), "redo" : '平台添加操作记录重做'+new Date().getTime() } } woodoJs.addRecord(record, function(data){ console.log(data); });
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
获取文档保存指令 woodoJs.getSaveCommand
接入方可以通过此接口获取文档保存指令
参数说明:
参数 | 类型 | 描述 |
---|---|---|
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
示例代码:
woodoJs.getSaveCommand(function(data){ console.log(data); });
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer, | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
data | 对象数组,Array<Object> | 文档保存指令 |
设置文档保存指令结果 woodoJs.setSaveCommandResult
接入方把文档指令发送吾道保存接口后返回的数据作为参数调用此接口(因非画布区域数据要渲染,如文档、文档页id等)
参数说明:
参数 | 类型 | 描述 |
---|---|---|
data | 对象,Object | 必选,文档保存接口(/api/platform/doucment/save/)返回的数据 |
callback | 函数,Function | 可选,接口执行后回调函数,返回结果 |
示例代码:
let data = {"type":"success","code":"2","content":"保存成功","data":{"docId":655162,"pageUuidMappingId":{"uuid78a66ae489a51461230206477ab3":8104115},"docUrl":"1103333559","docTitle":"幻灯片作品","docUuidMappingId":{"uuidc037e28dba6800f74b7a92b6968a":655162},"docEditCount":0}}; woodoJs.setSaveCommandResult(data,function(data){ console.log(data); });
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
code | 整型,Integer | 执行结果状态,2成功、1失败 |
msg | 字符串,String | 执行结果描述 |
文档撤回 woodoJs.undo
接入方可以通过此接口进行文档撤回
参数说明:
无
示例代码:
woodoJs.undo();
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,undo |
data | 对象,Object | 返回数据 |
data.code | 整型,Integer, | 执行结果状态,2成功、1失败 |
data.msg | 字符串,String | 执行结果描述 |
data.data | 对象,Object | 返回数据内容 |
data.data.record | 平台操作记录 |
文档重做 woodoJs.redo
接入方可以通过此接口进行文档重做
参数说明:
无
示例代码:
woodoJs.redo();
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,redo |
data | 对象,Object | 返回数据 |
data.code | 整型,Integer, | 执行结果状态,2成功、1失败 |
data.msg | 字符串,String | 执行结果描述 |
data.data | 对象,Object | 返回数据内容 |
data.data.record | 平台操作记录 |
文档预览
接入方可以通过此接口进行文档预览,此接口直接返回渲染好的页面,会根据设备进行渲染PC端或WAP端
请求地址:
PC端:/platform/slides/
WAP端:/platform/mobile/slides/
请求方式:GET
参数说明:
参数 | 类型 | 描述 |
---|---|---|
appId | 字符串,String | 必选,平台应用id(吾道生成) |
token | 字符串,String | 必选,基于JWT规范生成授权token |
time | 长整型,Long | 必选,基于JWT规范生成授权token的时间 |
docId | 长整型,Long | 必选,文档ID |
userUuid | 字符串,String | 必选,用户唯一标识 |
示例代码:
https://www.woodo.cn/platform/slides/?time=1577966036238&token=eyJhbGciOiJIUzM4NCJ9.eyJpYXQiOjE1Nzc5NjYwMzYsImV4cCI6MTU3Nzk2NjA5Nn0.hXKFb3ed4bWlOhBXEAnaiAnwXVTSEVj9Ypu7MJZ8gFfiLY_-fwoHp4t-LzOk4Kze&appId=wd5f983248169a4fdf&docId=390715
返回值说明:
直接返回页面,如下图所示
错误页面
接入方可以通过此请求进行重定向,根据类型自定义错误文案
请求:/no_power/
请求方式:GET
参数说明:
参数 | 类型 | 描述 |
---|---|---|
type | 字符串,String | 必选,类型 |
type参数说明:
type | 说明 |
---|---|
preview | 该文档暂不支持外部查看,请联系所有者开放权限 |
edit | 文档暂不支持第三方编辑 |
nonexistent | 该文档已删除,请联系文档所有者 |
platform_param_null | 平台校验失败,appId和token不允许为null |
platform_null | 平台校验失败,不存在或未启用 |
platform_valid_error | 平台校验失败,token校验失败 |
platform_member_add_error | 平台用户新增失败 |
platform_service_expire | 平台校验失败,吾道SDK相关服务已到期,可联系服务方处理 |
platform_unknown_error | 平台校验失败,未知异常 |
接收文档操作行为数据 listenMessage
接入方可以通过重写此接口,监听吾道对文档的操作行为数据,此接口目前可以接收到数据如①-⑥示例
①新增文档页 addPage
监听吾道对文档的新增文档页操作行为数据,根据监听返回数据返回接入方操作记录(吾道与接入方操作记录关联)
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,addPage |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.data | 对象,Object | 操作结果返回值 |
data.data.targetPageUuid | 字符串,String | 文档页唯一标示,新增文档页的前一页 |
data.data.pageInfos | 字符串数组,Array<String> | 文档页唯一标示,新增文档页 |
data.data.type | 字符串,String | 插入方式,up:向上,down:向下 |
返回接入方操作记录:
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
listenMessage:function(data){ if(data.opt === 'addPage'){ //处理返回数据,返回平台操作记录 return {master:{undo:'撤回添加文档页操作'+new Date().getTime(),redo:'重做添加文档页操作'+new Date().getTime()}} } }
②复制文档页 copyPage
监听吾道对文档的复制文档页操作行为数据,根据监听返回数据返回接入方操作记录(吾道与接入方操作记录关联)
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,copyPage |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.data | 对象,Object | 操作结果返回值 |
data.data.prePageUuid | 字符串,String | 文档页唯一标示,新增文档页的前一页 |
data.data.insertPageUuids | 字符串数组,Array<String> | 文档页唯一标示,新增文档页 |
返回接入方操作记录:
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
listenMessage:function(data){ if(data.opt === 'copyPage'){ //处理返回数据,返回平台操作记录 return {master:{undo:'撤回添加文档页操作'+new Date().getTime(),redo:'重做添加文档页操作'+new Date().getTime()}} } }
③删除文档页 delPage
监听吾道对文档的删除文档页操作行为数据,根据监听返回数据返回接入方操作记录(吾道与接入方操作记录关联)
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,delPage |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.data | 对象,Object | 操作结果返回值 |
data.data.deletePageUuids | 字符串数组,Array<String> | 文档页唯一标示,删除文档页 |
返回接入方操作记录:
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
listenMessage:function(data){ if(data.opt === 'delPage'){ //处理返回数据,返回平台操作记录 return {master:{undo:'撤回添加文档页操作'+new Date().getTime(),redo:'重做添加文档页操作'+new Date().getTime()}} } }
④排序文档页 orderPage
监听吾道对文档的排序文档页操作行为数据,根据监听返回数据返回接入方操作记录(吾道与接入方操作记录关联)
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,orderPage |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.data | 对象,Object | 操作结果返回值 |
data.data.orderPageUuids | 字符串数组,Array<String> | 文档页唯一标示,排序文档页 |
data.data.targetPageUuid | 字符串,String | 文档页唯一标示,放置指定文档页后 |
返回接入方操作记录:
{ "master": { "undo": 内容自行定义, "redo": 内容自行定义 } }
示例代码:
listenMessage:function(data){ if(data.opt === 'orderPage'){ //处理返回数据,返回平台操作记录 return {master:{undo:'撤回添加文档页操作'+new Date().getTime(),redo:'重做添加文档页操作'+new Date().getTime()}} } }
⑤文档撤回 undo
吾道对文档撤回操作行为数据
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,undo |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.record.undo | 对象,Object | 撤回记录 |
⑥文档重做 redo
吾道对文档重做操作行为数据
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,undo |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.record.redo | 对象,Object | 重做记录 |
⑦快捷键保存 saveDoc
吾道对文档进行快捷键保存操作行为数据
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,saveDoc |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
示例代码:
listenMessage:function(data){ console.log(data); if(data.opt === 'saveDoc'){ //... } }
⑧操作记录状态 recordState
吾道对文档操作记录操作行为数据
接收数据说明:
字段 | 类型 | 描述 |
---|---|---|
opt | 字符串,String | 操作类型,recordState |
data | 对象,Object | 操作结果 |
data.code | 整型,Long | 操作结果状态 |
data.msg | 字符串,String | 操作结果说明 |
data.data | 对象,Object | 操作结果数据 |
data.data.canUndo | 布尔值,Boolean | 是否可撤回上一步,true:可以,false:不可以 |
data.data.canRedo | 布尔值,Boolean | 是否可以重做前一步,true:可以,false:不可以 |
listenMessage:function(data){ console.log(data); if(data.opt === 'recordState'){ //... } }
四、后端API接口对接
JAVA 请求示例
import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.lang.StringUtils; import org.apache.http.NameValuePair; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; public class TestHttpUtils { public static void main(String[] args) { // POST Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("appId", "your appId"); parameterMap.put("token", "your token"); parameterMap.put("time", "your token time"); parameterMap.put("userUuid", ""); parameterMap.put("docId", ""); parameterMap.put("command", ""); String postResult = post("/api/platform/document/save/", parameterMap, 10 * 1000); //GET String getResult = get("/api/platform/document/detail/{docId}/?appId=&token=&time=&docId="); } /** * post * @param url * @param parameterMap * @param timeout * @return */ public static String post(String url, Map<String, Object> parameterMap, Integer timeout) { CloseableHttpResponse response = null; CloseableHttpClient client = HttpClients.createDefault(); HttpPost method = new HttpPost(url); try { RequestConfig requestConfig = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout).build(); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); if (parameterMap != null) { for (Entry<String, Object> entry : parameterMap.entrySet()) { String name = entry.getKey(); String value = ConvertUtils.convert(entry.getValue()); if (StringUtils.isNotEmpty(name)) { nameValuePairs.add(new BasicNameValuePair(name, value)); } } } method.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); method.setConfig(requestConfig); response = client.execute(method); return EntityUtils.toString(response.getEntity(), "utf-8"); } catch (IOException e) { e.printStackTrace(); } finally { try { if(response != null) response.close(); } catch (IOException e) { e.printStackTrace(); } try { if(client != null) client.close(); } catch (IOException e) { e.printStackTrace(); } } return null; } /** * get * @param url * @return */ public static String get(String url) { CloseableHttpResponse response = null; CloseableHttpClient client = HttpClients.createDefault(); HttpGet method = new HttpGet(url); try { response = client.execute(method); return EntityUtils.toString(response.getEntity(), "utf-8"); } catch (IOException e) { e.printStackTrace(); } finally { try { if(response != null) response.close(); } catch (IOException e) { e.printStackTrace(); } try { if(client != null) client.close(); } catch (IOException e) { e.printStackTrace(); } } return null; } }
文档创建
请求地址:/api/platform/document/create/
请求方式:POST
参数说明:
参数 | 类型 | 描述 |
---|---|---|
appId | 字符串,String | 必选,平台应用id(吾道生成) |
token | 字符串,String | 必选,基于JWT规范生成授权token |
time | 长整型,Long | 必选,基于JWT规范生成授权token的时间 |
userUuid | 字符串,String | 必选,用户唯一标识 |
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
type | 字符串,String | 请求结果状态类型 |
code | 字符串,String | 请求结果状态 |
content | 字符串,String | 请求结果说明 |
data | 对象,Object | 请求结果数据 |
data.documentId | 长整型,Long | 文档id |
data.documentUuid | 字符串,String | 文档uuid |
data.documentPageId | 长整型,Long | 文档页id |
data.documentPageUuid | 字符串,String | 文档页uuid |
示例
{ "type": "success", "code": "2", "content": "创建成功", "data": { "documentUuid": "bfecdbe36497447182867cd94cfb301d", "documentId": 7, "documentPageId": 7, "documentPageUuid": "3b1ba7a2b0f449deba88be6126881811" } }
文档复制
请求地址:/api/platform/document/copy/
请求方式:POST
参数说明:
参数 | 类型 | 描述 |
---|---|---|
appId | 字符串,String | 必选,平台应用id(吾道生成) |
token | 字符串,String | 必选,基于JWT规范生成授权token |
time | 长整型,Long | 必选,基于JWT规范生成授权token的时间 |
userUuid | 字符串,String | 必选,用户唯一标识 |
docId | 长整型,Long | 必选,文档ID |
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
type | 字符串,String | 请求结果状态类型 |
code | 字符串,String | 请求结果状态 |
content | 字符串,String | 请求结果说明 |
data | 对象,object | 返回数据 |
data.docId | 长整形,Long | 文档Id |
data.pageUuids | 数组,Array | 文档页UUID |
示例
{ "type": "success", "code": "2", "content": "创建成功", "data": { "docId": 516760, "pageUuids": ["f0fe17a81ffe48a4b78dd395cd0b49c7","f0fe17a81ffe48a4b78dd395cddf34"] } }
文档详情
请求地址:/api/platform/document/detail/{docId}/
请求方式:GET
参数说明:
参数 | 类型 | 描述 |
---|---|---|
appId | 字符串,String | 必选,平台应用id(吾道生成) |
token | 字符串,String | 必选,基于JWT规范生成授权token |
time | 长整型,Long | 必选,基于JWT规范生成授权token的时间 |
docId | 长整型,Long | 必选,文档id |
userUuid | 字符串,String | 必选,用户唯一标识 |
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
type | 字符串,String | 请求结果状态类型 |
code | 字符串,String | 请求结果状态 |
content | 字符串,String | 请求结果说明 |
data | 对象,Object | 文档信息 |
data.document | 对象,Object | 文档id |
data.documentPages | 数组,Array | 文档页uuid与id映射 |
示例:
{ "type": "success", "code": "2", "content": "请求成功", "data": { "document": { "modifyDate": 1577176365000, "documentType": "slides", "backgroundImage": null, "title": "幻灯片作品", "uuid": "uuid56e2ce93ad2510e499608788065b", "textColor": "#42464b", "url": "1812985286", "background": "#ffffff", "shapeColor": "#42464b", "width": 910, "id": 516723, "font": null, "height": 512, "editCount": 0 }, "documentPages": [{ "id": 7633291, "createDate": 1577171762000, "modifyDate": 1577171762000, "uuid": "uuid9881773fb1e27cdb73df9172adf9", "elementList": null, "image": null, "pageNumber": 1, "background": "#ffffff", "backgroundImage": null, "backgroundImageWidth": null, "backgroundImageHeight": null, "title": null, "switchType": "fadeInAndOut", "isLock": false }, { "id": 7633297, "createDate": 1577176120000, "modifyDate": 1577176120000, "uuid": "uuid3290b208b6ed5ff2a71b392769ab", "elementList": null, "image": null, "pageNumber": 2, "background": "#ffffff", "backgroundImage": null, "backgroundImageWidth": null, "backgroundImageHeight": null, "title": null, "switchType": "fadeInAndOut", "isLock": false }] } }
多个文档详情
请求地址:/api/platform/document/multiple_detail/
请求方式:GET
参数说明:
参数 | 类型 | 描述 |
---|---|---|
appId | 字符串,String | 必选,平台应用id(吾道生成) |
token | 字符串,String | 必选,基于JWT规范生成授权token |
time | 长整型,Long | 必选,基于JWT规范生成授权token的时间 |
docIds | 长整型数组,Array<Long> | 必选,文档id |
userUuid | 字符串,String | 必选,用户唯一标识 |
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
type | 字符串,String | 请求结果状态类型 |
code | 字符串,String | 请求结果状态 |
content | 字符串,String | 请求结果说明 |
data | 数组对象,Array<Object> | 多个文档信息 |
data[n].document | 对象,Object | 文档id |
data[n].documentPages | 数组,Array | 文档页uuid与id映射 |
示例:
{ "type":"success", "code":"2", "content":"请求成功", "data":[ { "document":{ "modifyDate":1581427141000, "documentType":"slides", "backgroundImage":null, "title":"幻灯片作品", "uuid":"uuid024862c9fc3b068446a790a55ddf", "textColor":"#42464b", "url":"2294442259", "background":"#ffffff", "shapeColor":"#42464b", "width":910, "id":390743, "font":null, "height":512, "editCount":2 }, "documentPages":[ { "id":4714579, "createDate":1581427135000, "modifyDate":1581427138000, "uuid":"uuidaa2ac659c3aae5d805286d1b1aa6", "elementList":"[{"id":"uuidc153fb5d2a254dacc0f8ebd03a88","type":"table","preset":"","group":"","lock":false,"opacity":"1","translate":"240.2,196","rotate":"0,0,0","scale":"0.5,0.5","border_w":2,"border_c":"rgb(0, 0, 0)","border_s":"solid","width":859,"height":242,"tr_list":[[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}]],"column_width":["107.4","107.4","107.4","107.4","107.4","107.4","107.4","107.4"],"row_height":["48","48","48","48","48"]}]", "image":null, "pageNumber":1, "background":"#ffffff", "backgroundImage":null, "backgroundImageWidth":null, "backgroundImageHeight":null, "title":null, "switchType":"fadeInAndOut", "isLock":false }, { "id":4714580, "createDate":1581427135000, "modifyDate":1581427141000, "uuid":"uuide9acc0096e05e910f5fb95992ca6", "elementList":"[{"id":"uuid70a3dacfaedfab2758bf01594cb4","type":"img","group":"","lock":false,"link":null,"opacity":"1","translate":"227.5,78.62","rotate":"0,227.5,177.37890625","scale":"0.91,0.91","border_w":"0","image_w":"500","image_h":"389.84375","url":"http://file.woodo.cn/upload/resource/201808/07/e89fbe6d-91b7-4936-96ce-28aabfe69ef8.jpg","clip":{"id":"uuidc34932eeeb78a42363c8de860fe3","type":"RECT","scale":"1.25,0.974609375","x":"0","y":"0","w":"500","h":"389.84375","d":"M0.001,0.006 L401.000,0.006 L401.000,399.994 L0.001,399.994 L0.001,0.006 L0.001,0.006 Z"},"shadow":{"color":"transparent","blur":"0","x":"0","y":"0","rotate":"0","offset_x":"0%","offset_y":"0%","dx":"0","dy":"0","w":"100%","h":"100%"},"reversal":{"translate":"0,0","matrix":"1,0,0,1,0,0"}}]", "image":null, "pageNumber":2, "background":"#ffffff", "backgroundImage":null, "backgroundImageWidth":null, "backgroundImageHeight":null, "title":null, "switchType":"fadeInAndOut", "isLock":false } ] }, { "document":{ "modifyDate":1581427141000, "documentType":"slides", "backgroundImage":null, "title":"幻灯片作品", "uuid":"uuid024862c9fc3b068446a790a55ddf", "textColor":"#42464b", "url":"2294442259", "background":"#ffffff", "shapeColor":"#42464b", "width":910, "id":390743, "font":null, "height":512, "editCount":2 }, "documentPages":[ { "id":4714579, "createDate":1581427135000, "modifyDate":1581427138000, "uuid":"uuidaa2ac659c3aae5d805286d1b1aa6", "elementList":"[{"id":"uuidc153fb5d2a254dacc0f8ebd03a88","type":"table","preset":"","group":"","lock":false,"opacity":"1","translate":"240.2,196","rotate":"0,0,0","scale":"0.5,0.5","border_w":2,"border_c":"rgb(0, 0, 0)","border_s":"solid","width":859,"height":242,"tr_list":[[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}],[{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"},{"colspan":"1","rowspan":"1","hide":false,"background":"rgb(255, 255, 255)","content":"<div contenteditable=\"true\" class=\"show_text\" style=\"font-size:20px;text-align:center;line-height:1.4;color:#42464b;font-family:\"><br><\/div>"}]],"column_width":["107.4","107.4","107.4","107.4","107.4","107.4","107.4","107.4"],"row_height":["48","48","48","48","48"]}]", "image":null, "pageNumber":1, "background":"#ffffff", "backgroundImage":null, "backgroundImageWidth":null, "backgroundImageHeight":null, "title":null, "switchType":"fadeInAndOut", "isLock":false }, { "id":4714580, "createDate":1581427135000, "modifyDate":1581427141000, "uuid":"uuide9acc0096e05e910f5fb95992ca6", "elementList":"[{"id":"uuid70a3dacfaedfab2758bf01594cb4","type":"img","group":"","lock":false,"link":null,"opacity":"1","translate":"227.5,78.62","rotate":"0,227.5,177.37890625","scale":"0.91,0.91","border_w":"0","image_w":"500","image_h":"389.84375","url":"http://file.woodo.cn/upload/resource/201808/07/e89fbe6d-91b7-4936-96ce-28aabfe69ef8.jpg","clip":{"id":"uuidc34932eeeb78a42363c8de860fe3","type":"RECT","scale":"1.25,0.974609375","x":"0","y":"0","w":"500","h":"389.84375","d":"M0.001,0.006 L401.000,0.006 L401.000,399.994 L0.001,399.994 L0.001,0.006 L0.001,0.006 Z"},"shadow":{"color":"transparent","blur":"0","x":"0","y":"0","rotate":"0","offset_x":"0%","offset_y":"0%","dx":"0","dy":"0","w":"100%","h":"100%"},"reversal":{"translate":"0,0","matrix":"1,0,0,1,0,0"}}]", "image":null, "pageNumber":2, "background":"#ffffff", "backgroundImage":null, "backgroundImageWidth":null, "backgroundImageHeight":null, "title":null, "switchType":"fadeInAndOut", "isLock":false } ] } ] }
文档保存
请求地址:/api/platform/document/save/
请求方式:POST
参数说明:
参数 | 类型 | 描述 |
---|---|---|
appId | 字符串,String | 必选,平台应用id(吾道生成) |
token | 字符串,String | 必选,基于JWT规范生成授权token |
time | 长整型,Long | 必选,基于JWT规范生成授权token的时间 |
userUuid | 字符串,String | 必选,平台用户唯一标示 |
docId | 长整型,Long | 必选,文档id |
command | 字符串,String | 必选,文档保存指令,JSON串 |
返回值说明:
字段 | 类型 | 描述 |
---|---|---|
type | 字符串,String | 请求结果状态类型 |
code | 字符串,String | 请求结果状态 |
content | 字符串,String | 请求结果说明 |
data | 对象,Object | 文档信息 |
data.docId | 长整型,Long | 文档id |
data.pageUuidMappingId | 对象,Object | 文档页uuid与id映射 |
data.docUrl | 字符串,String | 文档url |
data.docTitle | 字符串,String | 文档标题 |
data.docUuidMappingId | 对象,Object | 文档uuid与id映射 |
data.docEditCount | 整型,Integer | 文档编辑次数 |
示例:
{ "type":"success", "code":"2", "content":"保存成功", "data":{ "docId":516723, "pageUuidMappingId":{ "uuid3290b208b6ed5ff2a71b392769ab":7633297 }, "docUrl":"1812985286", "docTitle":"幻灯片作品", "docUuidMappingId":{ "uuid56e2ce93ad2510e499608788065b":516723 }, "docEditCount":0 } }