123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>新版杏聆荟JsonRPC接口文档</title>
- <link rel="stylesheet" type="text/css" href="https://img.cdn.apipost.cn/docs/css/reset.css">
- <link rel="stylesheet" type="text/css" href="https://img.cdn.apipost.cn/docs/css/style.css">
- <link rel="stylesheet" type="text/css"
- href="https://img.cdn.apipost.cn/docs/css/font-awesome-4.7.0/css/font-awesome.css">
- <link rel="stylesheet" href="https://img.cdn.apipost.cn/docs/css/content.css">
- <link rel="stylesheet" href="https://img.cdn.apipost.cn/docs/css/github.css">
- <link rel="icon" href="ReleaseNoteStyle/favicon.ico">
- <script src="https://img.cdn.apipost.cn/docs/js/jquery-3.4.1.min.js"></script>
- <script src="https://img.cdn.apipost.cn/docs/js/marked.min.js"></script>
- <script src="https://img.cdn.apipost.cn/docs/js/template-web.js"></script>
- <script src="https://img.cdn.apipost.cn/docs/js/highlight.js"></script>
- <script src="https://img.cdn.apipost.cn/statics/libs/crypto-js/crypto-js.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="https://docs.apipost.cn/statics/enc.min.js"></script>
- <script src="https://img.cdn.apipost.cn/docs/js/clipboard.min.js"></script>
- <script src="ReleaseNoteStyle/xlsx.core.min.js"></script>
- </head>
- <body>
- <!-- <body> -->
- <div class="body">
- <div class="doc-head">
- <div class="left">
- <img src="https://flyinsono-bj-1300984704.cos.ap-beijing.myqcloud.com/BlueLogoChineseFlynoinso.png" style="margin-top: 3px;">
- </div>
- <div class="container">
- <div class="container-left">
- <input type="text" id="txtSearch" class="search" placeholder="搜索目录接口">
- <button onclick="searchClick();"><i class="fa fa-search" aria-hidden="true"></i></button>
- </div>
- <!-- <div class="export" style="position: relative;-->
- <!-- float: right;-->
- <!-- margin: -16px 50px;">-->
- <!-- <div class="container-right">-->
- <!-- <a href="javascript:;">导出文档</a>-->
- <!-- </div>-->
- <!-- <div class="export_panel">-->
- <!-- <ul>-->
- <!-- <li><a href="javascript:;">导出HTML</a></li>-->
- <!-- <li><a href="javascript:;">导出MarkDown</a></li>-->
- <!-- <li><a href="javascript:;">导出Word</a></li>-->
- <!-- </ul>-->
- <!-- </div>-->
- <!-- </div>-->
- </div>
- </div>
- <div class="box">
- <div class="box-first">
- <div class="title">新版杏聆荟RPC接口文档</div>
- <div class="top target" data-target_id="001">服务接口 Release Notes</div>
- <div class="new" style="height:calc(100% - 60px) !important;">
- </div>
- <div class="bar"></div>
- <script type="text/html" id="template-target-sidebar-list-tpl">
- {{each list value}}
- <div>
- <div class="target {{value.target_type == 'folder' ? 'folder':'api'}}"
- data-type="{{value.target_type}}" data-id="{{value.target_id}}"
- data-target_id="{{value.local_target_id}}">
- {{if value.target_type == 'folder'}}
- <span>
- <span class="control">
- {{if value.children}}
- <i class="fa fa-angle-down"></i>
- {{/if}}
- </span>
- <span class="controlName controlLevelOne">{{value.name}}</span>
- </span>
- {{else}}
- <span>
- <em class="{{((target_type == 'doc') || (target_type == 'example' && is_doc == 1)) ? 'DOC' : target_type == 'example' ? method : ''}}">{{(target_type == 'doc' || (target_type == 'example' && is_doc == '1')) ? '文本' : method == 'OPTIONS' ? 'OPT' : method == 'DELETE' ? 'DEL' : method == 'UNLINK' ? 'UNLNK' : method == 'UNLOCK' ? 'UNLCK' : method == 'PROPFIND' ? 'PROP' : method}}</em>
- <span>{{value.name}}</span>
- </span>
- <span></span>
- {{/if}}
- </div>
- {{if value.children!=null}}
- {{each value.children data}}
- {{set a=data["index"]=3}}
- {{include 'list1' data}}
- {{/each}}
- {{/if}}
- </div>
- {{/each}}
- </script>
- <script type="text/html" id="list1">
- <div>
- <div class="target {{target_type == 'folder' ? 'folder':'api'}}" data-type="{{target_type}}"
- data-id="{{target_id}}" data-target_id="{{local_target_id}}"
- style="padding-left:{{index * 15}}px">
- {{if target_type == 'folder'}}
- <span>
- <span class="control">
- {{if children}}
- <i class="fa fa-angle-down"></i>
- {{/if}}
- </span>
- <span class="controlName controlLevelTwo api_level{{api_level}}">{{name}}</span>
- </span>
- {{else}}
- <span>
- <em class="{{((target_type == 'doc') || (target_type == 'example' && is_doc == 1)) ? 'DOC' : target_type == 'example' ? method : ''}}">{{(target_type == 'doc' || (target_type == 'example' && is_doc == '1')) ? '文本' : method == 'OPTIONS' ? 'OPT' : method == 'DELETE' ? 'DEL' : method == 'UNLINK' ? 'UNLNK' : method == 'UNLOCK' ? 'UNLCK' : method == 'PROPFIND' ? 'PROP' : method}}</em>
- <span>{{name}}</span>
- </span>
- <span></span>
- {{/if}}
- </div>
- {{if children!=null}}
- {{each children data}}
- {{if index}}
- {{set b=data.index=index+1}}
- {{else}}
- {{set c=data["index"] = 3}}
- {{/if}}
- {{include 'list1' data}}
- {{/each}}
- {{/if}}
- </div>
- </script>
- </div>
- <div class="box-third">
- <div class="preview-markdown">
- </div>
- <div class="box-nav" style="background: #fff;top: 160px;right: 50px;">
- <ul class="api template-nav-menu">
- <script type="text/html" id="template-nav-menu-tpl">
- {{if target_type == "api" || target_type == "folder" || (target_type == "example" && is_doc == 0) }}
- <li class="cur nav-btn" data-id="0"><a href="javascript:;">基本信息</a></li>
- {{/if}}
- {{if request.header.parameter.length > 0 || request.query.parameter.length > 0 || request.resful.parameter.length > 0 || request.body.parameter.length>0 ||request.body.raw !=''}}
- <li class="nav-btn" data-id="1" style="display: block"><a href="javascript:;">请求参数</a></li>
- {{else}}
- <li class="nav-btn" data-id="1" style="display: none"><a href="javascript:;">请求参数</a></li>
- {{/if}}
- <ul>
- {{if request.header.parameter.length > 0}}
- <li class="nav-btn" data-id="2" style="display: block"><a
- href="javascript:;">header参数及说明</a></li>
- {{else}}
- <li class="nav-btn" data-id="2" style="display: none"><a href="javascript:;">header参数及说明</a>
- </li>
- {{/if}}
- {{if request.query.parameter.length > 0}}
- <li class="nav-btn" data-id="3" style="display: block"><a href="javascript:;">query参数及说明</a>
- </li>
- {{else}}
- <li class="nav-btn" data-id="3" style="display: none"><a href="javascript:;">query参数及说明</a>
- </li>
- {{/if}}
- {{if request.resful.parameter.length > 0}}
- <li class="nav-btn" data-id="4" style="display: block"><a href="javascript:;">路径参数及说明</a>
- </li>
- {{else}}
- <li class="nav-btn" data-id="4" style="display: none"><a href="javascript:;">路径参数及说明</a>
- </li>
- {{/if}}
- {{if request.body.parameter.length>0 ||request.body.raw !='' }}
- <li class="nav-btn" data-id="5" style="display: block"><a href="javascript:;">body参数及说明</a>
- </li>
- {{else}}
- <li class="nav-btn" data-id="5" style="display: none"><a href="javascript:;">body参数及说明</a>
- </li>
- {{/if}}
- <!-- <li class="nav-btn" data-id="6"><a href="javascript:;">预执行脚本</a></li>-->
- <!-- <li class="nav-btn" data-id="7"><a href="javascript:;">后执行脚本</a></li>-->
- </ul>
- {{if response.success.raw || response.success.parameter.length > 0 || response.error.raw || response.error.parameter.length > 0}}
- <li class="nav-btn" data-id="6" style="display: block"><a href="javascript:;">响应示例</a></li>
- {{else}}
- <li class="nav-btn" data-id="6" style="display: none"><a href="javascript:;">响应示例</a></li>
- <!-- <ul>-->
- <!-- {{if response.success.raw || response.success.parameter.length > 0}}-->
- <!-- <li class="nav-btn" data-id="9"><a href="javascript:;">成功响应示例</a></li>-->
- <!-- {{/if}}-->
- <!---->
- <!-- {{if response.error.raw || response.error.parameter.length > 0}}-->
- <!-- <li class="nav-btn" data-id="10"><a href="javascript:;">失败响应示例</a></li>-->
- <!-- {{/if}}-->
- <!-- </ul>-->
- {{/if}}
- {{if response.success.error_result.length > 0}}
- <li class="nav-btn" data-id="9" style="display: block"><a href="javascript:;">错误码信息</a></li>
- {{else}}
- <li class="nav-btn" data-id="9" style="display: none"><a href="javascript:;">错误码信息</a></li>
- {{/if}}
- </script>
- </ul>
- </ul>
- <ul class="folder">
- <li class="cur nav-folder-btn" data-id="0"><a href="javascript:;">公共参数</a></li>
- <ul>
- <li class="nav-folder-btn" data-id="1"><a href="javascript:;">header参数及说明</a></li>
- <li class="nav-folder-btn" data-id="2"><a href="javascript:;">query参数及说明</a></li>
- <li class="nav-folder-btn" data-id="3"><a href="javascript:;">body参数及说明</a></li>
- <!-- <li class="nav-folder-btn" data-id="4"><a href="javascript:;">预执行脚本</a></li>-->
- <!-- <li class="nav-folder-btn" data-id="5"><a href="javascript:;">后执行脚本</a></li>-->
- </ul>
- </ul>
- </div>
- <script type="text/html" id="template-example-doc-tpl">
- <h2>
- <span>{{name}}</span>
- <span class="metadata">更新时间:{{update_dtime}}</span>
- </h2>
- {{if request.description}}
- <div class="editor-preview desc markdown-section" id="{{request.requestId}}">
-
- </div>
- {{/if}}
- {{if (target_type == 'example' && is_doc == '0') || target_type == 'api'}}
- <h3 class="title"><a href="javascript:;" class="maodian"></a> 基本信息 <i class="fa fa-angle-down"></i></h3>
- <ul class="editor-preview-info">
- <li><strong>接口状态:</strong> <code class="span {{mark}}">{{mark == 'developing' ? '开发中' : mark ==
- 'complated' ?
- '已完成' : mark == 'modifying' ? '修改中' : '开发中'}}</code></li>
- {{if request.url}}
- <li><strong>接口URL:</strong> <code class="span">{{request.url}}</code></li>
- {{/if}}
- <li><strong>请求方式:</strong> <code class="span">{{method}}</code></li>
- <li><strong>Content-Type:</strong><code class="span">{{request.body.mode}}</code></li>
- </ul>
- <h3 class="title"
- style="{{request.header.parameter.length > 0 || request.query.parameter.length > 0 || request.resful.parameter.length > 0 || request.body.parameter.length>0 ||request.body.raw !='' ? 'display:block':'display:none'}}">
- <a href="javascript:;" class="maodian"></a> 请求参数 <i class="fa fa-angle-down"></i></h3>
- {{if request.header.parameter.length > 0 || request.query.parameter.length > 0 || request.resful.parameter.length > 0 || request.body.parameter.length>0 ||request.body.raw !=''}}
- <div class="markdown-request">
- <h4 class="title" style="{{request.header.parameter.length ? 'display:block':'display:none'}}"><a
- href="javascript:;" class="maodian"></a> Header参数及说明</h4>
- {{if request.header.parameter.length > 0}}
- <div>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>是否必填</th>
- <th>参数描述</th>
- </tr>
- {{each request.header.parameter item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.not_null == "1" ? '是' : '否'}}</td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- </table>
- </div>
- {{/if}}
- <h4 class="title" style="{{request.query.parameter.length > 0 ? 'display:block':'display:none'}}"><a
- href="javascript:;" class="maodian"></a> Query参数及说明</h4>
- {{if request.query.parameter.length > 0}}
- <div>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>是否必填</th>
- <th>参数描述</th>
- </tr>
- {{each request.query.parameter item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.not_null == "1" ? '是' : '否'}}</td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- </table>
- </div>
- {{/if}}
- <h4 class="title" style="{{request.resful.parameter.length ? 'display:block':'display:none'}}"><a
- href="javascript:;" class="maodian"></a> 路径参数及说明</h4>
- {{if request.resful.parameter.length > 0}}
- <div>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>是否必填</th>
- <th>参数描述</th>
- </tr>
- {{each request.resful.parameter item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.not_null == "1" ? '是' : '否'}}</td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- </table>
- </div>
- {{/if}}
- <h4 class="title"
- style="{{request.body.parameter.length > 0 || request.body.raw !='' ? 'display:block' : 'display:none'}}">
- <a href="javascript:;" class="maodian"></a> body参数及说明</h4>
- {{if request.body.parameter.length>0 ||request.body.raw !='' }}
- {{if request.body.mode == 'form-data' || request.body.mode == 'multipart/form-data' || request.body.mode == 'application/octet-stream' ||
- request.body.mode =='application/x-www-form-urlencoded' || request.body.mode=="urlencoded"}}
- <div>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>是否必填</th>
- <th>参数描述</th>
- </tr>
- {{if request.body.parameter.length > 0}}
- {{each request.body.parameter item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.not_null == "1" ? '是' : '否'}}</td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- {{else}}
- <tr>
- <td colspan="5" style="text-align:center">暂无数据</td>
- </tr>
- {{/if}}
- </table>
- </div>
- {{else}}
- <div class="editor-preview">
- <pre><code class="hljs json" style="color: #0ad161;background: #373e52;">{{request.body.raw}}</code></pre>
- </div>
- {{if request.body.raw_para.length > 0}}
- <h4><a href="javascript:;" class="maodian"></a> 字段描述</h4>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>是否必填</th>
- <th>参数描述</th>
- </tr>
- {{each request.body.raw_para item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- {{if item.field_type_value == 1 }}
- <td><a style="text-decoration: underline;color: blue;" href="javascript:;" onclick="validateJump('{{item.file_name}}', '{{item.field_type_target_id}}')">{{item.field_type}}</a></td>
- {{else}}
- <td>{{item.field_type}}</td>
- {{/if}}
- <td>{{item.not_null == "1" ? '是' : '否'}}</td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- </table>
- {{/if}}
- {{/if}}
- <!-- {{if request.event.pre_script != ''}}-->
- <!-- <h4 class="title"><a href="javascript:;" class="maodian"></a> 预执行脚本</h4>-->
- <!-- <div class="editor-preview">-->
- <!-- <pre><code class="hljs">{{request.event.pre_script}}</code></pre>-->
- <!-- </div>-->
- <!-- {{/if}}-->
- <!-- {{if request.event.test != ''}}-->
- <!-- <h4 class="title"><a href="javascript:;" class="maodian"></a> 后执行脚本</h4>-->
- <!-- <div class="editor-preview">-->
- <!-- <pre><code class="hljs">{{request.event.test}}</code></pre>-->
- <!-- </div>-->
- <!-- {{/if}}-->
- </div>
- {{/if}}
- {{/if}}
- <!--respond-->
- <h3 class="title"
- style="{{response.success.raw || response.success.parameter.length > 0 || response.error.raw || response.error.parameter.length > 0 ? 'display:block':'display:none'}}"">
- <a href="javascript:;" class="maodian"></a> 响应示例<i class="fa fa-angle-down"></i></h3>
- {{if response.success.raw || response.success.parameter.length > 0 || response.error.raw || response.error.parameter.length > 0}}
- <div class="markdown-response">
- {{if response.success.raw || response.success.parameter.length > 0}}
- <h4 class="title"><a href="javascript:;" class="maodian"></a> 成功响应示例</h4>
- <div class="editor-preview">
- <pre><code class="hljs json" style="color: #0ad161;background: #373e52;">{{response.success.raw}}</code></pre>
- </div>
- {{if response.success.parameter.length > 0}}
- <h4><a href="javascript:;" class="maodian"></a> 字段描述</h4>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>参数描述</th>
- </tr>
- {{each response.success.parameter item}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- {{if item.field_type_value == 1 }}
- <td><a style="text-decoration: underline;color: blue;" href="javascript:;" onclick="validateJump('{{item.file_name}}', '{{item.field_type_target_id}}')">{{item.field_type}}</a></td>
- {{else}}
- <td>{{item.field_type}}</td>
- {{/if}}
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/each}}
- </table>
- {{/if}}
- {{/if}}
- {{if response.error.raw || response.error.parameter.length > 0}}
- <h4 class="title"><a href="javascript:;" class="maodian"></a> 失败响应示例</h4>
- <div class="editor-preview">
- <pre><code class="hljs json" style="color: #0ad161;background: #373e52;">{{response.error.raw}}</code></pre>
- </div>
- {{if response.error.parameter.length > 0}}
- <h4><a href="javascript:;" class="maodian"></a> 字段描述</h4>
- <table>
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>参数描述</th>
- </tr>
- {{each response.error.parameter item}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type}}</td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/each}}
- </table>
- {{/if}}
- {{/if}}
- </div>
- {{/if}}
- <h3 class="title" style="{{response.success.error_result.length > 0 ? 'display:block':'display:none'}}" >
- <a href="javascript:;" class="maodian"></a> 错误码信息<i class="fa fa-angle-down"></i>
- </h3>
- {{if response.success.error_result.length > 0 }}
- <div class="markdown-response">
- {{if response.success.error_result.length > 0}}
- {{each response.success.error_result resultItem}}
- <table>
- <tr>
- {{each resultItem.header item}}
- <th>{{item}}</th>
- {{/each}}
- </tr>
- {{each resultItem.content item}}
- <tr>
- {{each item.content_data content_dataItem}}
- <td>{{content_dataItem}}</td>
- {{/each}}
- </tr>
- {{/each}}
- </table>
- {{/each}}
- {{/if}}
- </div>
- {{/if}}
- {{else if target_type == 'folder'}}
- <h3 class="title"><a href="javascript:;" class="maodian"></a> 公共参数<i class="fa fa-angle-down"></i></h3>
- <div class="markdown-request">
- <h4 class="title"><a href="javascript:;" class="maodian"></a> Header参数及说明</h4>
- <div>
- <table class="header">
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>参数描述</th>
- </tr>
- {{if request.header.length > 0}}
- {{each request.header item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- {{/if}}
- </table>
- </div>
- <h4 class="title"><a href="javascript:;" class="maodian"></a> Query参数及说明</h4>
- <div>
- <table class="query">
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>参数描述</th>
- </tr>
- {{each request.query item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- </table>
- </div>
- <h4 class="title"><a href="javascript:;" class="maodian"></a> Body参数及说明</h4>
- <div>
- <table class="body">
- <tr>
- <th>参数名</th>
- <th>示例值</th>
- <th>参数类型</th>
- <th>参数描述</th>
- </tr>
- {{each request.body item}}
- {{if item.key}}
- <tr>
- <td>{{item.key}}</td>
- <td>{{item.value}}</td>
- <td>{{item.field_type == "" || item.field_type == "[]"? (typeof item.value) :
- item.field_type}}
- </td>
- <td>{{item.description == '' ? '暂无描述' : item.description }}</td>
- </tr>
- {{/if}}
- {{/each}}
- </table>
- </div>
- <!-- {{if script.pre_script != ''}}-->
- <!-- <h4 class="title"><a href="javascript:;" class="maodian"></a> 预执行脚本</h4>-->
- <!-- <div class="editor-preview">-->
- <!-- <pre><code class="hljs">{{script.pre_script}}</code></pre>-->
- <!-- </div>-->
- <!-- {{/if}}-->
- <!-- {{if script.test !=''}}-->
- <!-- <h4 class="title"><a href="javascript:;" class="maodian"></a> 后执行脚本</h4>-->
- <!-- <div class="editor-preview">-->
- <!-- <pre><code class="hljs">{{script.test}}</code></pre>-->
- <!-- </div>-->
- <!-- {{/if}}-->
- </div>
- <!--respond-->
- {{/if}}
- <div class="footer" style="text-align: center;margin: 35px 24px;height: 50px">本文档由Vinno-IDS-云平台文档生成工具生成</div>
- </script>
- </div>
- </div>
- </div>
- <script type="text/html" id="golbal-env-tpl">
- <h2 class="top">
- {{project_name}}
- <span class="metadata">
- 创建时间: {{create_time}}
- {{if expire_day_time}}
- <span style="color: #f44336; margin-left: 15px; font-weight: bold;">过期时间: {{expire_day_time}}</span>
- {{/if}}
- </span>
- </h2>
- <div class="editor-preview desc">
- <p>{{publishInfo}}</p>
- </div>
- <!-- <blockquote></blockquote> -->
- <h3 class="title">
- <a href="javascript:;" class="maodian"></a> 版本历史列表
- {{if versionDatas.length > 0}}
- <i class="fa fa-angle-down"></i>
- {{/if}}
- </h3>
- {{if versionDatas.length > 0}}
- <div>
- {{each versionDatas item}}
- <h4>当前部署包:{{item.currentPackage}}</h4>
- <table>
- <tr>
- <th style="width:22%">部署包</th>
- <th style="width:10%">版本号</th>
- <th style="width:50%">更新描述</th>
- <th style="width:10%">更新时间</th>
- <th style="width:8%">更新人</th>
- </tr>
- {{each item.list childItem}}
- <tr>
- <td>{{childItem["部署包"]}}</td>
- <td>{{childItem["版本号"]}}</td>
- <td>{{childItem["更新描述"]}}</td>
- <td>{{childItem["更新时间"]}}</td>
- <td>{{childItem["更新人"]}}</td>
- </tr>
- {{/each}}
- </table>
- {{/each}}
- </div>
- {{else}}
- <div style="text-align: center;">
- <img src="https://img.cdn.apipost.cn/docs/images/empty.svg"
- style="width: 100px;margin:20px auto 20px;">暂无环境
- </div>
- {{/if}}
- <h3 class="title">
- <a href="javascript:;" class="maodian"></a> 接口更新列表
- {{if interfaceDatas.length > 0}}
- <i class="fa fa-angle-down"></i>
- {{/if}}
- </h3>
- {{if interfaceDatas.length > 0}}
- <div>
- {{each interfaceDatas item}}
- <h4>发布时间:{{item.publishTime}}</h4>
- <table>
- <tr>
- <th style="width:7%">发布时间</th>
- <th style="width:20%">接口名称</th>
- <th style="width:38%">描述</th>
- <th style="width:7%">自动化测试</th>
- <th style="width:4%">增/改</th>
- <th style="width:12%">部署包</th>
- <th style="width:6%">版本号</th>
- <th style="width:6%">开发人员</th>
- </tr>
- {{each item.list childItem}}
- <tr>
- <td>{{childItem["发布时间"]}}</td>
- <td>{{childItem["接口名称"]}}</td>
- <td>{{childItem["描述"]}}</td>
- {{if childItem["自动化测试"] == "无测试用例"}}
- <td style="color: orange; font-weight: 600; ">{{childItem["自动化测试"]}}</td>
- {{else}}
- <td style="color: #40B766; font-weight: 600; ">{{childItem["自动化测试"]}}</td>
- {{/if}}
- <td>{{childItem["增/改"]}}</td>
- <td>{{childItem["部署包"]}}</td>
- <td>{{childItem["版本号"]}}</td>
- <td>{{childItem["开发人员"]}}</td>
- </tr>
- {{/each}}
- </table>
- {{/each}}
- </div>
- {{else}}
- <div style="text-align: center;">
- <img src="https://img.cdn.apipost.cn/docs/images/empty.svg"
- style="width: 100px;margin:20px auto 20px;">暂无参数
- </div>
- {{/if}}
- <div class="footer" style="text-align: center;margin: 35px 24px;height: 50px">本文档由Vinno-IDS-云平台文档生成工具生成</div>
- </script>
- <script>
- template.defaults.imports.marked = function (md) {
- return marked(md);
- }
- function validateJump(fileName, targetId) {
- if (targetId && targetId.length > 0) {
- let newdata = JSON.parse(JSON.stringify(arr))
- let LevelArr = []
- function levelTree(arr1, newarr) {
- arr1.forEach(item => {
- if (item.children && item.children.length > 0) {
- newarr.push(item)
- levelTree(item.children, newarr)
- } else {
- newarr.push(item)
- }
- })
- }
- levelTree(newdata.targets, LevelArr)
- var res = LevelArr.some(item => {
- if (item.local_target_id == targetId) {
- return true;
- }
- return false;
- });
- let url = window.location.href.split('#')[0] + '#';
- if (res) {
- //找到,正常跳转
- var newUrl = url + targetId;
- window.open(newUrl, "新版杏聆荟RPC接口文档_枚举详情");
- }
- else {
- //没找到,页面刷新
- var newUrl = url + "001";
- window.location.href = newUrl;
- window.location.reload(true);
- }
- }
- return false;
- }
- $(document).ready(function () {
- readFile('ReleaseNoteStyle/新版杏聆荟ReleaseNotes.xlsx');
- });
- function readFile(filePath) {
- let xhr = new XMLHttpRequest();
- xhr.responseType = "blob";
- xhr.open('GET', filePath, true);
- xhr.onload = function () {
- if (this.status === 200) {
- var blob = this.response;
- let file = new window.File([blob], 'JSON.xlsx');
- var fileReader = new FileReader();
- fileReader.readAsBinaryString(file);
- fileReader.onload = function (ev) {
- var data = ev.target.result;
- var workbook = XLSX.read(data, {
- type: 'binary'
- }) // 以二进制流方式读取得到整份excel表格对象
- var excelDatas = [];
- // 遍历每张表读取
- for (var sheet in workbook.Sheets) {
- if (workbook.Sheets.hasOwnProperty(sheet)) {
- var dataList = [];
- dataList = dataList.concat(XLSX.utils.sheet_to_json(workbook.Sheets[sheet]));
- var entity = {
- "name": sheet,
- "datas": dataList
- }
- excelDatas.push(entity);
- }
- }
- if (excelDatas && excelDatas.length >= 3) {
- var versionList = excelDatas[0].datas;
- if (versionList && versionList.length > 0) {
- versionList.sort(compare("更新时间", 'inverted'));
- versionList.forEach(x => {
- var tempTime = dateFormat(x["更新时间"], 'yyyy-MM-dd');
- x["更新时间"] = tempTime;
- });
- var str = JSON.stringify(versionList);
- window.localStorage.setItem("CurrentVersionUpdateDatas", str);
- }
- var noteList = excelDatas[1].datas;
- if (noteList && noteList.length > 0) {
- var noteInfo = noteList[0];
- var serverPathStr = "服务器发布地址:" + noteInfo["服务器发布地址"];
- window.localStorage.setItem("CurrentPackagePublishInfo", serverPathStr);
- }
- var interfaceList = excelDatas[2].datas;
- if (interfaceList && interfaceList.length > 0) {
- interfaceList.sort(compare("发布时间", 'inverted'));
- interfaceList.forEach(y => {
- var tempPublishTime = dateFormat(y["发布时间"], 'yyyy-MM-dd');
- y["发布时间"] = tempPublishTime;
- });
- var str = JSON.stringify(interfaceList);
- window.localStorage.setItem("CurrentInterfaceUpdateDatas", str);
- }
- }
- else {
- console.log("数据格式错误,错误数据为:", excelDatas);
- }
- }
- }
- };
- xhr.send();
- }
- //排序
- function compare(prop, align) {
- return function (a, b) {
- var value1 = a[prop];
- var value2 = b[prop];
- if (align == "positive") {//正序
- return new Date(value1) - new Date(value2);
- } else if (align == "inverted") {//倒序
- return new Date(value2) - new Date(value1);
- }
- }
- }
- function dateFormat(date, fmt = 'yyyy-MM-dd hh:mm:ss') {
- date = new Date(date)
- var o = {
- "M+": date.getMonth() + 1, //月份
- "d+": date.getDate(), //日
- "h+": date.getHours(), //小时
- "m+": date.getMinutes(), //分
- "s+": date.getSeconds(), //秒
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
- "S": date.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
- }
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- }
- }
- return fmt;
- }
- function replaceAll(str, f, t) {
- var newStr = str.replaceAll(f, t);
- return newStr;
- }
- String.prototype.replaceAll = function (s1, s2) {
- return this.replace(new RegExp(s1, "gm"), s2);
- }
- function dragControllerDiv(resize, left, mid, box) {
- for (let i = 0; i < resize.length; i++) {
- // 鼠标按下事件
- resize[i].onmousedown = function (e) {
- //颜色改变提醒
- resize[i].style.borderColor = "#9d9d9d";
- var startX = e.clientX;
- resize[i].left = resize[i].offsetLeft;
- // 鼠标拖动事件
- document.onmousemove = function (e) {
- var endX = e.clientX;
- var moveLen = resize[i].left + (endX - startX); // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
- var maxT = box[i].clientWidth - resize[i].offsetWidth; // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
- if (moveLen < 300) moveLen = 300; // 左边区域的最小宽度为32px
- if (moveLen > maxT - 150) moveLen = maxT - 150; //右边区域最小宽度为150px
- resize[i].style.left = moveLen; // 设置左侧区域的宽度
- $('.target.title').css({maxWidth: moveLen + 'px'})
- for (let j = 0; j < left.length; j++) {
- left[j].style.width = moveLen + "px";
- mid[j].style.width = box[i].clientWidth - moveLen - 10 + "px";
- }
- };
- // 鼠标松开事件
- document.onmouseup = function (evt) {
- //颜色恢复
- resize[i].style.borderColor = "#d6d6d6";
- document.onmousemove = null;
- document.onmouseup = null;
- resize[i].releaseCapture && resize[i].releaseCapture(); //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
- };
- resize[i].setCapture && resize[i].setCapture(); //该函数在属于当前线程的指定窗口里设置鼠标捕获
- return false;
- };
- }
- }
- let timer = null
- let dataSources = $GetDocDataSources();
- let arr = $GetExportDocHtml();
- let _html = template('template-target-sidebar-list-tpl', {
- list: arr.targets
- });
- if (arr.project_logo) {
- $('.doc-head .left img').attr('src', arr.project_logo)
- }
- $('.new').html(_html)
- $('.target.folder').find('i.fa').removeClass('fa-angle-down').addClass('fa-angle-right')
- $('.target.folder').nextAll().hide()
-
- function findFatherDom(el) {
- if (el.parent().parent().children(":first").hasClass('folder')) {
- el.parent().parent().show()
- console.log(el.parent().parent());
- el.parent().parent().children().show()
- el.parent().parent().children(":first").find('i').removeClass('fa-angle-right').addClass('fa-angle-down')
- el.parent().parent().children(":first").nextAll('.folder').find('i').removeClass('fa-angle-down').addClass('fa-angle-right')
- findFatherDom(el.parent().prev())
- } else {
- el.parent().children().show()
- return
- }
- }
- function dateFormat(date, fmt = 'yyyy-MM-dd hh:mm:ss') {
- date = new Date(date)
- var o = {
- "M+": date.getMonth() + 1, //月份
- "d+": date.getDate(), //日
- "h+": date.getHours(), //小时
- "m+": date.getMinutes(), //分
- "s+": date.getSeconds(), //秒
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
- "S": date.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
- }
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- }
- }
- return fmt;
- }
- window.onload = function () {
- let url = window.location.href;
- let id = url.split('#')[1] ? url.split('#')[1] : '001';
- if (url.split('?') && url.split('?').length > 1) {
- var keywordUrl = url.split('?')[1];
- if (keywordUrl.split('#') && keywordUrl.split('#').length > 0) {
- var keyword = keywordUrl.split('#')[0].replace("key=", "");
- if (dataSources && dataSources.length > 0) {
- var dataList = dataSources.filter(c => c.Key === keyword);
- if (dataList && dataList.length > 0) {
- id = dataList[0].Value;
- }
- }
- }
- }
- if ($(`.target[data-target_id="${id}"]`).length > 0) {
- if (id != "001") {
- findFatherDom($(`.target[data-target_id="${id}"]`))
- }
- $(`.target[data-target_id="${id}"]`).trigger('click')
- } else {
- location.href = './404.html'
- return
- }
- var resize = document.getElementsByClassName("bar");
- var left = document.getElementsByClassName("box-first");
- var mid = document.getElementsByClassName("box-third");
- var box = document.getElementsByClassName("box");
- dragControllerDiv(resize, left, mid, box);
- }
- $('.body').show()
- $(document).on('click', '.target', function () {
- let target_id = $(this).attr('data-id')
- let _local_target_id = $(this).attr('data-target_id')
- let url = window.location.href.split('#')[0] + '#' + _local_target_id
- history.replaceState(null, null, url)
- $('.target').each((i, el) => {
- $(el).removeClass('active')
- })
- if ($(this).attr('data-type') == 'folder') {
- //$('.box-nav').show()
- //$(this).nextAll().show()
- //$(this).find('i').removeClass('fa-angle-right').addClass('fa-angle-down')
- //$('.box-nav .folder').show()
- //$('.box-nav .api').hide()
- $(this).find(".controlName").each(function (i, dom) {
- $(dom).click();
- });
- return;
- } else if ($(this).attr('data-type') == 'example' || $(this).attr('data-type') == 'api') {
- $('.box-nav').show()
- $('.box-nav .api').show()
- $('.box-nav .folder').hide()
- } else {
- $('.box-nav').hide()
- }
- $(this).addClass('active')
- if (!target_id) {
- $(this).removeClass('active')
- }
- let newdata = JSON.parse(JSON.stringify(arr))
- let LevelArr = []
- function levelTree(arr1, newarr) {
- arr1.forEach(item => {
- if (item.children && item.children.length > 0) {
- newarr.push(item)
- levelTree(item.children, newarr)
- } else {
- newarr.push(item)
- }
- })
- }
- levelTree(newdata.targets, LevelArr)
- LevelArr.forEach(item => {
- if (item.target_id == target_id) {
- if (item.target_type == 'example' || item.target_type == 'api') {
- switch (item.request.body.mode) {
- case "none":
- break;
- case "form-data":
- item.request.body.mode = "multipart/form-data";
- break;
- case "uploadFile":
- item.request.body.mode = "application/octet-stream; multipart/form-data; text/html[base64]";
- break;
- case "byte":
- item.request.body.mode = "application/octet-stream";
- break;
- case "urlencoded":
- item.request.body.mode = "application/x-www-form-urlencoded";
- break;
- case "json":
- item.request.body.mode = "application/json";
- break;
- case "xml":
- item.request.body.mode = "application/xml";
- break;
- case "javascript":
- item.request.body.mode = "application/javascript";
- break;
- case "plain":
- item.request.body.mode = "text/plain";
- break;
- case "html":
- item.request.body.mode = "text/html";
- break;
- }
- $('.template-nav-menu').html(template('template-nav-menu-tpl', item));
- if (item.target_type != 'folder') {
- let _export_data = new ClipboardJS('.CopyCurrentData', {
- text: function (trigger) {
- return trigger.getAttribute('data-clipboard-text');
- }
- });
- console.log(_export_data );
- _export_data.on('success', function (e) {
- $('.CopyCurrentData').text('已复制').addClass('success');
- e.clearSelection();
- });
- _export_data.on('error', function (e) {
- console.log('失败');
- });
- }
- }
- let _html = template('template-example-doc-tpl', item);
- $('.preview-markdown').html(_html)
- if (item.target_type == 'folder') {
- if ($('table.header tr').length <= 1) {
- $('table.header').parent().hide()
- $('table.header').parent().prev().hide()
- $('.nav-folder-btn[data-id="1"]').hide()
- // $('table.header tr').after('<tr><td colspan="4" style="text-align:center">暂无数据</td></tr>')
- }
- if ($('table.query tr').length <= 1) {
- $('table.query').parent().hide()
- $('table.query').parent().prev().hide()
- $('.nav-folder-btn[data-id="2"]').hide()
- // $('table.query tr').after('<tr><td colspan="4" style="text-align:center">暂无数据</td></tr>')
- }
- if ($('table.body tr').length <= 1) {
- $('table.body').parent().hide()
- $('table.body').parent().prev().hide()
- $('.nav-folder-btn[data-id="3"]').hide()
- // $('table.body tr').after('<tr><td colspan="4" style="text-align:center">暂无数据</td></tr>')
- }
- if ($('table.header tr').length <= 1 && $('table.query tr').length <= 1 && $('table.body tr').length <= 1) {
- $('table.header').parents('.markdown-request').prev().hide()
- $('.box-nav .nav-folder-btn[data-id="0"]').hide()
- //$('.preview-markdown .markdown-request').after('<div style="overflow: hidden;text-align: center;height: 100%;"><img src="https://img.cdn.apipost.cn/docs/images/empty.svg" style="width:100px;margin: 70px auto 20px;;">暂无参数</div>')
- $('.preview-markdown .markdown-request').after(item.tableHtml)
- }
- hljs.initHighlighting();
- }
- if (item.target_type == 'doc') {
- console.log("docId:", item.request.requestId);
- document.getElementById(item.request.requestId).innerHTML = item.request.description;
- }
- }
- })
- })
- .on('click', '.control', function (e) {
- e.stopPropagation()
- let type = $(this).find('i').hasClass('fa-angle-down')
- if (type) {
- $(this).find('i').removeClass('fa-angle-down').addClass('fa-angle-right')
- } else {
- $(this).find('i').removeClass('fa-angle-right').addClass('fa-angle-down')
- }
- $(this).parents('.target').nextAll().toggle()
- })
- .on('click', '.controlName', function (e) {
- e.stopPropagation()
- let type = $(this).find('i').hasClass('fa-angle-down')
- if (type) {
- $(this).find('i').removeClass('fa-angle-down').addClass('fa-angle-right')
- } else {
- $(this).find('i').removeClass('fa-angle-right').addClass('fa-angle-down')
- }
- $(this).parents('.target').nextAll().toggle()
- })
- .on('blur', '.search', function (e) {
- var filterValue = $("#txtSearch").val();
- filterMethod(e, filterValue);
- })
- .on('keydown', '.search', function (e) {
- if (e.keyCode == 13)
- {
- var filterValue = $("#txtSearch").val();
- filterMethod(e, filterValue);
- }
- })
- .on('mouseover', '.target.api', function () {
- $(this).find('em').css({visibility: 'visible'})
- })
- .on('mouseleave', '.target.api', function () {
- $(this).find('em').css({visibility: 'hidden'})
- })
- .on('click', '.nav-btn', function () {
- let index = parseInt($(this).attr('data-id'))
- $('.nav-btn').removeClass('cur')
- $(this).addClass('cur')
- let top = $('.box-third .title').eq(index)[0].offsetTop
- $('.box-third').scrollTop(top)
- })
- .on('click', '.nav-folder-btn', function () {
- let index = parseInt($(this).attr('data-id'))
- $('.nav-folder-btn').removeClass('cur')
- $(this).addClass('cur')
- let top = $('.box-third .title').eq(index)[0].offsetTop
- $('.box-third').scrollTop(top)
- })
- .on('click', '.box-first .top', function () {
- arr.project.project_name = arr.project_name
- arr.project.create_time = arr.create_time
- arr.project.expire_day_time = arr.expire_day_time
- //发布信息
- var publishInfo = window.localStorage.getItem("CurrentPackagePublishInfo");
- arr.project["publishInfo"] = publishInfo;
- //更新接口
- var activeInterfaceDatasStr = window.localStorage.getItem("CurrentInterfaceUpdateDatas");
- var activeInterfaceDatas = [];
- if (activeInterfaceDatasStr && activeInterfaceDatasStr.length > 0)
- {
- activeInterfaceDatas = JSON.parse(activeInterfaceDatasStr);
- }
- if (activeInterfaceDatas && activeInterfaceDatas.length > 0)
- {
- var publishTimeStr = dateFormat(activeInterfaceDatas[0]["发布时间"], 'yyyy-MM-dd')
- arr.project["interfaceDatas"] = [{
- publishTime: publishTimeStr,
- list: activeInterfaceDatas
- }];
- }
- //包
- var activeVersionDatasStr = window.localStorage.getItem("CurrentVersionUpdateDatas");
- var activeVersionDatas = [];
- if (activeVersionDatasStr && activeVersionDatasStr.length > 0) {
- activeVersionDatas = JSON.parse(activeVersionDatasStr);
- }
- if (activeVersionDatas && activeVersionDatas.length > 0) {
- var packageStr = activeVersionDatas[0]["部署包"];
- arr.project["versionDatas"] = [{
- currentPackage: packageStr,
- list: activeVersionDatas
- }];
- }
- $(this).addClass('active');
- let _html = template('golbal-env-tpl', arr.project);
- $('.preview-markdown').html(_html);
- })
- .on('click', 'h3.title', function () {
- let type = $(this).find('i').hasClass('fa-angle-down')
- if (type) {
- $(this).find('i').removeClass('fa-angle-down').addClass('fa-angle-left')
- } else {
- $(this).find('i').removeClass('fa-angle-left').addClass('fa-angle-down')
- }
- $(this).next().toggle()
- })
- .on('mouseover', '.export', function () {
- $(this).find('.export_panel').show()
- })
- .on('mouseleave', '.export', function () {
- $(this).find('.export_panel').hide()
- })
- .on('mouseover', '.CopyCurrentData', function () {
- let local_target_id = $(this).attr('data-target_id')
- let newdata = JSON.parse(JSON.stringify(arr))
- let LevelArr = []
- function levelTree(arr1, newarr) {
- arr1.forEach(item => {
- if (item.children && item.children.length > 0) {
- newarr.push(item)
- levelTree(item.children, newarr)
- } else {
- newarr.push(item)
- }
- })
- }
- levelTree(newdata.targets, LevelArr)
- LevelArr.forEach((item) => {
- if (item.target_id == local_target_id) {
- $(this).attr('data-clipboard-text', JSON.stringify(item));
- }
- })
- })
- $(".box-third").scroll(function () {
- let arr = []
- $('.box-third .title').each((i, el) => {
- arr.push($(el)[0].offsetTop)
- })
- arr.push(arr[arr.length - 1] + 1000)
- let topHeight = $(this).scrollTop()
- if ($('.target.active').hasClass('api')) {
- for (let index = 0; index < arr.length; index++) {
- if (arr[index] < topHeight && topHeight < arr[index + 1]) {
- $('.nav-btn').removeClass('cur')
- $('.nav-btn').eq(index).addClass('cur')
- }
- }
- } else {
- for (let index = 0; index < arr.length; index++) {
- if (arr[index] < topHeight && topHeight < arr[index + 1]) {
- $('.nav-folder-btn').removeClass('cur')
- $('.nav-folder-btn').eq(index).addClass('cur')
- }
- }
- }
- });
- function searchClick()
- {
- var filterValue = $("#txtSearch").val();
- filterMethod($("#txtSearch"), filterValue);
- }
-
- function filterMethod(e, filterValue)
- {
- let searchVal = filterValue;
- let TreeData = JSON.parse(JSON.stringify(arr.targets))
- let searchArr = []
- let LevelArr = []
- let fatherArr = []
- function openTree(tree, parent_id) {
- tree.forEach((item) => {
- if (item.children && item.children.length > 0) {
- openTree(item.children, item.target_id)
- }
- item.parent_id = parent_id
- })
- }
- openTree(TreeData, 0);
- function levelTree(arr, newarr) {
- arr.forEach(item => {
- if (item.children && item.children.length > 0) {
- newarr.push(item)
- levelTree(item.children, newarr)
- } else {
- newarr.push(item)
- }
- })
- }
- levelTree(TreeData, LevelArr)
- if ($.trim(searchVal) != '') {
- LevelArr.forEach(item => {
- if (item.target_type == 'folder') {
- if (item.name.toString().indexOf(searchVal) > -1) {
- searchArr.push(item)
- }
- } else {
- if (item.name.toString().indexOf(searchVal) > -1 || item.method.toString().indexOf(searchVal) > -1 || item.technology.toString().indexOf(searchVal) > -1) {
- searchArr.push(item)
- }
- }
- })
- searchArr.forEach(item => {
- findFather(fatherArr, LevelArr, item)
- })
- function findFather(tempArr, arr, self) {
- if (self.parent_id != 0) {
- arr.filter(item => {
- if (self.parent_id == item.target_id) {
- findFather(tempArr, arr, item);
- if (tempArr.indexOf(item) === -1) {
- tempArr.push(item);
- }
- }
- })
- }
- }
- let finnalArr = searchArr.concat(fatherArr);
- $('.target').each((i, el) => {
- $(el).removeClass('active')
- })
- if (finnalArr && finnalArr.length > 0) {
- var tempFinnalArr = finnalArr.filter(d => d.target_type === "api" || d.target_type === "doc");
- if (tempFinnalArr && tempFinnalArr.length === 1) {
- let item = tempFinnalArr[0];
- //先处理枚举
- if (item.target_type === "doc") {
- //直接处理父级
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".target.api");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".controlLevelOne").click();
- }
- }
- }
- else
- {
- if (item.api_level === 3 || item.api_level === "3") {
- //先判断父级的父级的父级是否展开
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().parent().parent().find(".api_level2");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().parent().find(".controlLevelOne").click();
- }
- }
- //先判断父级的父级是否展开
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".api_level3");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".api_level2").click();
- }
- }
- //在判断父级是否展开
- if ($(`.target[data-target_id="${item.local_target_id}"]`).parent().is(':hidden')) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".api_level3").click();
- }
- }
- else if (item.api_level === 2 || item.api_level === "2")
- {
- //先判断父级的父级是否展开
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".api_level2");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".controlLevelOne").click();
- }
- }
- //在判断父级是否展开
- if ($(`.target[data-target_id="${item.local_target_id}"]`).parent().is(':hidden'))
- {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".api_level2").click();
- }
- }
- }
- jumpDefaultPage(item);
- return;
- }
- var tempFolderArr = finnalArr.filter(d => d.target_type === "folder");
- if (tempFolderArr && tempFolderArr.length > 0) {
- //文件夹一级
- var firstFolderArr = tempFolderArr.filter(d => d.local_parent_id === "0");
- if (firstFolderArr && firstFolderArr.length === 1) {
- //展开子菜单及所有
- var firstFolderItem = firstFolderArr[0];
- //展示子节点
- var childNodes = $(`.target[data-target_id="${firstFolderItem.local_target_id}"]`).parent().find(".controlLevelTwo");
- if (childNodes && childNodes.length > 0)
- {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++)
- {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh)
- {
- isExpand = true;
- break;
- }
- }
- if (!isExpand)
- {
- $(`.target[data-target_id="${firstFolderItem.local_target_id}"]`).find(".controlLevelOne").click();
- }
- }
- }
- //文件夹二级
- var secondFolderArr = tempFolderArr.filter(d => d.local_parent_id !== "0" && (d.api_level === 2 || d.api_level === "2"));
- if (secondFolderArr && secondFolderArr.length > 0) {
- //展开子菜单及所有
- secondFolderArr.forEach(secondFolderItem => {
- //处理父菜单
- var childNodes = $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).parent().parent().find(".api_level2");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).parent().parent().find(".controlLevelOne").click();
- }
- }
- //处理子菜单
- if (secondFolderItem.children && secondFolderItem.children.length > 0) {
- var isChildExpand = secondFolderItem.children.some(mc => {
- var childFolder = $(`.target[data-target_id="${mc.local_target_id}"]`).parent();
- if (!childFolder.is(':hidden')) {
- return true;
- }
- return false;
- });
- if (!isChildExpand) {
- $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).find(".api_level2").click();
- }
- }
- });
- }
- //文件夹三级
- var secondFolderArr = tempFolderArr.filter(d => d.local_parent_id !== "0" && (d.api_level === 3 || d.api_level === "3"));
- if (secondFolderArr && secondFolderArr.length > 0) {
- //展开子菜单及所有
- secondFolderArr.forEach(secondFolderItem => {
- //处理父菜单
- var childNodes = $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).parent().parent().parent().parent().find(".api_level2");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).parent().parent().parent().parent().find(".controlLevelOne").click();
- }
- }
- var childNodes = $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).parent().parent().find(".api_level3");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).parent().parent().find(".api_level2").click();
- }
- }
- //处理子菜单
- if (secondFolderItem.children && secondFolderItem.children.length > 0) {
- var isChildExpand = secondFolderItem.children.some(mc => {
- var childFolder = $(`.target[data-target_id="${mc.local_target_id}"]`).parent();
- if (!childFolder.is(':hidden')) {
- return true;
- }
- return false;
- });
- if (!isChildExpand) {
- $(`.target[data-target_id="${secondFolderItem.local_target_id}"]`).find(".api_level3").click();
- }
- }
- });
- }
- }
- //$('.target').hide()
- $('.target[data-target_id="001"]').show();
- finnalArr.forEach(item => {
- if (item.target_type === "api" || item.target_type === "doc") {
- $(`.target[data-target_id="${item.local_target_id}"]`).addClass('active');
- if (item.target_type === "doc") {
- //直接处理父级
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".target.api");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".controlLevelOne").click();
- }
- }
- }
- else {
- if (item.api_level === 3 || item.api_level === "3") {
- //先判断父级的父级的父级是否展开
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().parent().parent().find(".api_level2");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().parent().find(".controlLevelOne").click();
- }
- }
- //先判断父级的父级是否展开
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".api_level3");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".api_level2").click();
- }
- }
- //在判断父级是否展开
- if ($(`.target[data-target_id="${item.local_target_id}"]`).parent().is(':hidden')) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".api_level3").click();
- }
- }
- else if (item.api_level === 2 || item.api_level === "2") {
- //先判断父级的父级是否展开
- var childNodes = $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".api_level2");
- if (childNodes && childNodes.length > 0) {
- var isExpand = false;
- for (var m = 0; m < childNodes.length; m++) {
- var mItem = childNodes[m];
- var mh = $(mItem).parent().parent().is(':hidden');
- if (!mh) {
- isExpand = true;
- break;
- }
- }
- if (!isExpand) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().parent().find(".controlLevelOne").click();
- }
- }
- //在判断父级是否展开
- if ($(`.target[data-target_id="${item.local_target_id}"]`).parent().is(':hidden')) {
- $(`.target[data-target_id="${item.local_target_id}"]`).parent().parent().find(".api_level2").click();
- }
- }
- }
- }
- else {
- $(`.target[data-target_id="${item.local_target_id}"]`).removeClass('active')
- }
- });
- if (tempFinnalArr && tempFinnalArr.length > 0) {
- let firstItem = tempFinnalArr[0];
- jumpDefaultPage(firstItem);
- }
- }
- } else {
- $('.target').parent().show()
- $('.target').show()
- }
-
- }
- function jumpDefaultPage(item)
- {
- //独立处理
- let target_id = item.target_id;
- let _local_target_id = item.local_target_id;
- let url = window.location.href.split('#')[0] + '#' + _local_target_id;
- var curObject = $(`.target[data-target_id="${item.local_target_id}"]`);
- var h6 = $(".new").scrollTop();
- var h5 = curObject.position().top;
- if (h5 > 600) {
- if (h5 > 100) {
- h5 = h5 - 150;
- }
- var newHeight = h5 + h6
- $('.new').scrollTop(newHeight);
- }
- else if (h5 < 0) {
- var newHeight = h5 + h6;
- if (newHeight > 100) {
- newHeight = newHeight - 150;
- }
- $('.new').scrollTop(newHeight);
- }
- history.replaceState(null, null, url);
- if (curObject.attr('data-type') == 'example' || curObject.attr('data-type') == 'api') {
- $('.box-nav').show()
- $('.box-nav .api').show()
- $('.box-nav .folder').hide()
- } else {
- $('.box-nav').hide()
- }
- curObject.addClass('active');
- if (!target_id) {
- curObject.removeClass('active')
- }
- if (item.target_type == 'example' || item.target_type == 'api') {
- switch (item.request.body.mode) {
- case "none":
- break;
- case "form-data":
- item.request.body.mode = "multipart/form-data";
- break;
- case "uploadFile":
- item.request.body.mode = "application/octet-stream; multipart/form-data; text/html[base64]";
- break;
- case "byte":
- item.request.body.mode = "application/octet-stream";
- break;
- case "urlencoded":
- item.request.body.mode = "application/x-www-form-urlencoded";
- break;
- case "json":
- item.request.body.mode = "application/json";
- break;
- case "xml":
- item.request.body.mode = "application/xml";
- break;
- case "javascript":
- item.request.body.mode = "application/javascript";
- break;
- case "plain":
- item.request.body.mode = "text/plain";
- break;
- case "html":
- item.request.body.mode = "text/html";
- break;
- }
- $('.template-nav-menu').html(template('template-nav-menu-tpl', item));
- if (item.target_type != 'folder') {
- let _export_data = new ClipboardJS('.CopyCurrentData', {
- text: function (trigger) {
- return trigger.getAttribute('data-clipboard-text');
- }
- });
- console.log(_export_data);
- _export_data.on('success', function (e) {
- $('.CopyCurrentData').text('已复制').addClass('success');
- e.clearSelection();
- });
- _export_data.on('error', function (e) {
- console.log('失败');
- });
- }
- }
- let _html = template('template-example-doc-tpl', item);
- $('.preview-markdown').html(_html)
- if (item.target_type == 'doc') {
- console.log("docId:", item.request.requestId);
- document.getElementById(item.request.requestId).innerHTML = item.request.description;
- }
- }
- </script>
- </body>
- </html>
|