import React from 'react'; import { toJS } from 'mobx'; import { inject, observer } from 'mobx-react'; import { WeaLeftTree, WeaLeftRightLayout } from 'ecCom'; import { Tag } from 'antd'; import marked from 'marked'; import '../../style/index.less'; import ReactJson from 'react-json-view'; import * as API from '../../apis/index'; function parseParms(str) { let pieces = str.split('&'), data = {}, i, parts; // process each query pair for (i = 0; i < pieces.length; i++) { parts = pieces[i].split('='); if (parts.length < 2) { parts.push(''); } data[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]); } return data; } @inject("apiDocCheck") @observer class Index extends React.Component { componentDidMount() { const hashStr = window.location.hash; const { apiDocCheck } = this.props; const paramsObj = parseParms(hashStr.substring(hashStr.indexOf('?') + 1)); // apiDocCheck.getmarkapi(paramsObj) apiDocCheck.getTreeData(paramsObj); document.title = '泛微E9后端接口文档'; } onTreeSelect(key) { const { apiDocCheck } = this.props; if (key.indexOf('bt_') > -1) { } else { apiDocCheck.getmarkapi({ id: key }); // window.location.href = '/spa/smallApp/static4engine/engine.html#/apidoc/index?id=' + key; // window.location.reload(); } } render() { // const datas = [ // { // childs: [{ domid: 'wf_747', haschild: false, isopen: false, key: '747', name: '内部留言' }], // domid: 'type_15', // haschild: true, // isopen: true, // key: '15', // name: '日常工作', // }, // { // childs: [{ domid: 'wf_1', haschild: false, isopen: false, key: '1', name: '系统提醒工作流' }], // domid: 'type_1', // haschild: true, // isopen: true, // key: '1', // name: '默认流程', // }, // ]; // http://192.168.41.216:9990/api/ec/dev/help/getmarkdown?id=1 // { // "code": 0, // "data": "## ##\n\n概述\n\n>\n\n请求方式\n\n>GET\n\n请求地址\n\n>/api/cowork/view/getDiscussRecordCondition\n\n请求参数说明\n\n参数名 | 类型 | 描述 \n-|-|-\n__random__|String|\n_ec_browserVersion|String|\n_ec_osVersion|String|\n_ec_ismobile|String|\n_ec_browser|String|\n_ec_os|String|\nismobile|String|\n返回值类型\n\n>json\n\n返回示例\n\n>\n\n注意事项\n\n", // "msgShowType": "none", // "status": true // } // let strMD = ""; // strMD = "## 概述\n\n>\n\n请求方式\n\n>GET\n\n请求地址\n\n>/api/cowork/view/getDiscussRecordCondition\n\n请求参数说明\n\n参数名 | 类型 | 描述 \n-|-|-\n__random__|String|\n_ec_browserVersion|String|\n_ec_osVersion|String|\n_ec_ismobile|String|\n_ec_browser|String|\n_ec_os|String|\nismobile|String|\n返回值类型\n\n>json\n\n返回示例\n\n>\n\n注意事项\n\n" const { apiDocCheck } = this.props; const { testRes: strMD, data, treeData, defaultKey } = apiDocCheck; // /wui/engine.html#/apidoc/index?id=14656 let isJSON = false; let dataReturn = data.return; let treeDataObj = toJS(treeData); try { if (typeof JSON.parse(dataReturn) === 'object') { isJSON = true; } } catch (error) { isJSON = false; } return (
{data.info}
{data.methodSelect}
{data.url}
| Ecology版本 | 生效 KB 版本 |
|---|---|
| {data.sysversion2} | {data.patchversion2} |
| 参数名 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| {item.name} | {item.type} | {item.required === '1' ? '必填' : '非必填'} | {item.memo} |
{isJSON ? (
|
{data.returnType}
)}{JSON.stringify(dataReturn)}
| 参数名 | 类型 | 描述 |
|---|---|---|
| {item.name} | {item.type} | {item.memo} |