opti: docs

This commit is contained in:
suwenxiong 2019-01-30 11:17:31 +08:00
parent 480d96828d
commit 0915d85dd9
31 changed files with 4497 additions and 78 deletions

View File

@ -1,3 +1,9 @@
### v1.5.0
* 优化开放 api功能现在 token 带有用户信息了
* 修复无法获取请求302 跳转前的 headers
### v1.4.4
* 优化了 json-schema 编辑器交互,修复了参数名写到一半提示重复的问题
* 优化了首页体验,提升页面打开速度

View File

@ -75,8 +75,9 @@ class ProjectToken extends Component {
为确保项目内数据的安全性和私密性请勿轻易将该token暴露给项目组外用户
</div>
<br />
{/* <h2 className="token-title">open接口</h2> */}
{/* <div>
<h2 className="token-title">open接口</h2>
<p><a target="_blank" rel="noopener noreferrer" href="https://yapi.ymfe.org/openapi.html">详细接口文档</a></p>
<div>
<ul className="open-api">
<li>/api/open/run_auto_test []</li>
<li>/api/open/import_data []</li>
@ -89,7 +90,7 @@ class ProjectToken extends Component {
<li>/api/interface/add_cat []</li>
<li>/api/interface/getCatMenu []</li>
</ul>
</div> */}
</div>
</div>
);
}

View File

@ -3,4 +3,5 @@
* [教程](documents/index.md)
* [内网部署](devops/index.md)
* [内网部署](devops/index.md)
* [开放Api](openapi.html)

1403
docs/openapi-doc.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,8 @@
"start": " node server/app.js",
"test": "ava",
"build-client": "NODE_ENV=production ykit pack -m",
"npm-publish": "node ./npm-publish.js"
"npm-publish": "node ./npm-publish.js",
"docs": "ydoc build && cp docs/openapi-doc.html static/doc/openapi.html"
},
"scripts-info": {
"start": "运行生产环境服务器",

View File

@ -1,4 +1,4 @@
<html lang="zh-CN"><head><meta charSet="UTF-8"/><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><link rel="apple-touch-icon" sizes="180x180" href="../ydoc/images/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="../ydoc/images/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="../ydoc/images/favicon-16x16.png"/><link rel="manifest" href="../ydoc/images/manifest.json"/><link rel="mask-icon" href="../ydoc/images/safari-pinned-tab.svg&quot;" color="#5bbad5"/><meta name="theme-color" content="#ffffff"/><meta http-equiv="Cache-Control" content="no-transform"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>内网部署</title><link rel="stylesheet" href="../ydoc/styles/style.css"/><meta name="author" content="ymfe"/><meta name="keywords" content="api管理,接口管理,接口文档,api文档"/><meta name="description" content="YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 APIYApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理"/><meta id="releativePath" content=".."/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-img-view/imgView.css"/><link rel="stylesheet" href="../web.css"/></head><body><div class="g-doc"><div class="m-aside"><div class="m-summary" id="js-menu"><div class="m-summary-content" id="js-menu-content"><div class="m-summary-block"><ul class="m-summary-list"><li class="item"><a href="index.html#%e5%ae%89%e8%a3%85" class="href">安装</a></li><li class="item"><a href="index.html#%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%ae%a1%e7%90%86" class="href">服务器管理</a></li><li class="item"><a href="index.html#%e5%8d%87%e7%ba%a7" class="href">升级</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%ae%e9%82%ae%e7%ae%b1" class="href">配置邮箱</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%aeldap%e7%99%bb%e5%bd%95" class="href">配置LDAP登录</a></li><li class="item"><a href="index.html#%e7%a6%81%e6%ad%a2%e6%b3%a8%e5%86%8c" class="href">禁止注册</a></li><li class="item"><a href="index.html#%e7%89%88%e6%9c%ac%e9%80%9a%e7%9f%a5" class="href">版本通知</a></li></ul></div></div></div><div class="m-summary-switch" id="js-summary-switch"><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="bottom"><g transform="translate(904.92214,-879.1482)"><path d="m -673.67664,1221.6502 -231.2455,-231.24803 55.6165,-55.627 c 30.5891,-30.59485 56.1806,-55.627 56.8701,-55.627 0.6894,0 79.8637,78.60862 175.9427,174.68583 l 174.6892,174.6858 174.6892,-174.6858 c 96.079,-96.07721 175.253196,-174.68583 175.942696,-174.68583 0.6895,0 26.281,25.03215 56.8701,55.627 l 55.6165,55.627 -231.245496,231.24803 c -127.185,127.1864-231.5279,231.248 -231.873,231.248 -0.3451,0 -104.688,-104.0616 -231.873,-231.248 z" fill="#fff"></path></g></svg><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="top"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="aaa" fill="#fff" fill-rule="nonzero"><path d="M231.2455,342.502 L0,111.25397 L55.6165,55.62697 C86.2056,25.03212 111.7971,-2.99999998e-05 112.4866,-2.99999998e-05 C113.176,-2.99999998e-05 192.3503,78.60859 288.4293,174.6858 L463.1185,349.3716 L637.8077,174.6858 C733.8867,78.60859 813.060896,-2.99999997e-05 813.750396,-2.99999997e-05 C814.439896,-2.99999997e-05 840.031396,25.03212 870.620496,55.62697 L926.236996,111.25397 L694.9915,342.502 C567.8065,469.6884 463.4636,573.75 463.1185,573.75 C462.7734,573.75 358.4305,469.6884 231.2455,342.502 Z" id="Shape" transform="translate(463.118498, 286.874985) scale(1, -1) translate(-463.118498, -286.874985) "></path></g></g></svg></div></div><div class="m-main" id="js-panel"><header class="m-header" id="js-header"><div class="m-header-title js-logo"><a href="../index.html" target="_self"><img class="logo" width="36" src="../documents/images/logo_header@2x.png"/><h6 class="name">YApi</h6></a></div><div><div class="m-search">
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="UTF-8"/><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><link rel="apple-touch-icon" sizes="180x180" href="../ydoc/images/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="../ydoc/images/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="../ydoc/images/favicon-16x16.png"/><link rel="manifest" href="../ydoc/images/manifest.json"/><link rel="mask-icon" href="../ydoc/images/safari-pinned-tab.svg" color="#5bbad5"/><meta name="theme-color" content="#ffffff"/><meta http-equiv="Cache-Control" content="no-transform"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>内网部署</title><link rel="stylesheet" href="../ydoc/styles/style.css"/><meta name="author" content="ymfe"/><meta name="keywords" content="api管理,接口管理,接口文档,api文档"/><meta name="description" content="YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 APIYApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理"/><meta id="releativePath" content=".."/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-img-view/imgView.css"/><link rel="stylesheet" href="../web.css"/></head><body><div class="g-doc"><div class="m-aside"><div class="m-summary" id="js-menu"><div class="m-summary-content" id="js-menu-content"><div class="m-summary-block"><ul class="m-summary-list"><li class="item"><a href="index.html#%e5%ae%89%e8%a3%85" class="href">安装</a></li><li class="item"><a href="index.html#%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%ae%a1%e7%90%86" class="href">服务器管理</a></li><li class="item"><a href="index.html#%e5%8d%87%e7%ba%a7" class="href">升级</a></li></ul></div><div class="m-summary-block"><ul class="m-summary-list"><li class="item"><a href="index.html#mongodb%e9%9b%86%e7%be%a4" class="href">mongodb集群</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%ae%e9%82%ae%e7%ae%b1" class="href">配置邮箱</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%aeldap%e7%99%bb%e5%bd%95" class="href">配置LDAP登录</a></li><li class="item"><a href="index.html#%e7%a6%81%e6%ad%a2%e6%b3%a8%e5%86%8c" class="href">禁止注册</a></li><li class="item"><a href="index.html#%e7%89%88%e6%9c%ac%e9%80%9a%e7%9f%a5" class="href">版本通知</a></li></ul></div></div></div><div class="m-summary-switch" id="js-summary-switch"><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="bottom"><g transform="translate(904.92214,-879.1482)"><path d="m -673.67664,1221.6502 -231.2455,-231.24803 55.6165,-55.627 c 30.5891,-30.59485 56.1806,-55.627 56.8701,-55.627 0.6894,0 79.8637,78.60862 175.9427,174.68583 l 174.6892,174.6858 174.6892,-174.6858 c 96.079,-96.07721 175.253196,-174.68583 175.942696,-174.68583 0.6895,0 26.281,25.03215 56.8701,55.627 l 55.6165,55.627 -231.245496,231.24803 c -127.185,127.1864-231.5279,231.248 -231.873,231.248 -0.3451,0 -104.688,-104.0616 -231.873,-231.248 z" fill="#fff"></path></g></svg><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="top"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="aaa" fill="#fff" fill-rule="nonzero"><path d="M231.2455,342.502 L0,111.25397 L55.6165,55.62697 C86.2056,25.03212 111.7971,-2.99999998e-05 112.4866,-2.99999998e-05 C113.176,-2.99999998e-05 192.3503,78.60859 288.4293,174.6858 L463.1185,349.3716 L637.8077,174.6858 C733.8867,78.60859 813.060896,-2.99999997e-05 813.750396,-2.99999997e-05 C814.439896,-2.99999997e-05 840.031396,25.03212 870.620496,55.62697 L926.236996,111.25397 L694.9915,342.502 C567.8065,469.6884 463.4636,573.75 463.1185,573.75 C462.7734,573.75 358.4305,469.6884 231.2455,342.502 Z" id="Shape" transform="translate(463.118498, 286.874985) scale(1, -1) translate(-463.118498, -286.874985) "></path></g></g></svg></div></div><div class="m-main" id="js-panel"><header class="m-header" id="js-header"><div class="m-header-title js-logo"><a href="../index.html" target="_self"><img class="logo" width="36" src="../documents/images/logo_header@2x.png"/><h6 class="name">YApi</h6></a></div><div><div class="m-search">
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
@ -7,7 +7,7 @@
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="../documents/index.html">教程</a></li><li class="item active"><a class="href" href="">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div id="markdown-body" class="m-content-container markdown-body"><h1>内网部署</h1>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="../documents/index.html">教程</a></li><li class="item active"><a class="href" href="">内网部署</a></li><li class="item "><a class="href" href="../openapi.html">开放Api</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div id="markdown-body" class="m-content-container markdown-body"><h1>内网部署</h1>
<p>使用我们提供的 yapi-cli 工具,部署 YApi 平台是非常容易的。建议部署成 http 站点,因 chrome 浏览器安全限制,部署成 https 会导致测试功能在请求 http 站点时文件上传功能异常。</p>
<p>如果您是将服务器代理到 nginx 服务器,请配置 nginx 支持 websocket。</p>
<pre><code>&#x5728;location /&#x6DFB;&#x52A0;
@ -103,7 +103,7 @@ yapi update -v v1.1.0 //升级到指定版本
<span class="token property">"mail"</span><span class="token operator">:</span> <span class="token punctuation">{</span>...<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"ldapLogin"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"enable"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
<span class="token property">"server"</span><span class="token operator">:</span> <span class="token string">"ldap://l-ldapt1.ops.dev.cn0.qunar.com"</span><span class="token punctuation">,</span>
<span class="token property">"server"</span><span class="token operator">:</span> <span class="token string">"ldap://l-ldapt1.com"</span><span class="token punctuation">,</span>
<span class="token property">"baseDn"</span><span class="token operator">:</span> <span class="token string">"CN=Admin,CN=Users,DC=test,DC=com"</span><span class="token punctuation">,</span>
<span class="token property">"bindPassword"</span><span class="token operator">:</span> <span class="token string">"password123"</span><span class="token punctuation">,</span>
<span class="token property">"searchDn"</span><span class="token operator">:</span> <span class="token string">"OU=UserContainer,DC=test,DC=com"</span><span class="token punctuation">,</span>
@ -146,6 +146,20 @@ yapi update -v v1.1.0 //升级到指定版本
<span class="token punctuation">}</span>
</code></pre>
<h3 id="版本通知-如何配置mongodb集群">如何配置mongodb集群</h3>
<p>请升级到 yapi &gt;= <strong>1.4.0</strong>以上版本,然后在 config.json db项配置 connectString:</p>
<pre><code class="language-json">
<span class="token punctuation">{</span>
<span class="token property">"port"</span><span class="token operator">:</span> <span class="token string">"***"</span><span class="token punctuation">,</span>
<span class="token property">"db"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"connectString"</span><span class="token operator">:</span> <span class="token string">"mongodb://127.0.0.100:8418,127.0.0.101:8418,127.0.0.102:8418/yapidb?slaveOk=true"</span><span class="token punctuation">,</span>
<span class="token property">"user"</span><span class="token operator">:</span> <span class="token string">"******"</span><span class="token punctuation">,</span>
<span class="token property">"pass"</span><span class="token operator">:</span> <span class="token string">"******"</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span>
</code></pre>
<p>详细配置参考: <a href="https://mongoosejs.com/docs/connections.html#multiple_connections" target="_blank">wiki</a></p>
</div></div></div></div><div><div class="m-mask js-mask">
<div class="container">
<img src="" alt="" class="img js-mask-img" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
<html lang="zh-CN"><head><meta charSet="UTF-8"/><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><link rel="apple-touch-icon" sizes="180x180" href="ydoc/images/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="ydoc/images/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="ydoc/images/favicon-16x16.png"/><link rel="manifest" href="ydoc/images/manifest.json"/><link rel="mask-icon" href="ydoc/images/safari-pinned-tab.svg&quot;" color="#5bbad5"/><meta name="theme-color" content="#ffffff"/><meta http-equiv="Cache-Control" content="no-transform"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>YApi 接口管理平台</title><link rel="stylesheet" href="ydoc/styles/style.css"/><meta name="author" content="ymfe"/><meta name="keywords" content="api管理,接口管理,接口文档,api文档"/><meta name="description" content="YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 APIYApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理"/><meta id="releativePath" content=""/><link rel="stylesheet" href="ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="ydoc/ydoc-plugin-img-view/imgView.css"/><link rel="stylesheet" href="web.css"/></head><body><div class="g-doc"><div class="m-main" id="js-panel"><header class="m-header" id="js-header"><div class="m-header-title js-logo"><a href="" target="_self"><img class="logo" width="36" src="documents/images/logo_header@2x.png"/><h6 class="name">YApi</h6></a></div><div><div class="m-search">
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="UTF-8"/><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><link rel="apple-touch-icon" sizes="180x180" href="ydoc/images/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="ydoc/images/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="ydoc/images/favicon-16x16.png"/><link rel="manifest" href="ydoc/images/manifest.json"/><link rel="mask-icon" href="ydoc/images/safari-pinned-tab.svg" color="#5bbad5"/><meta name="theme-color" content="#ffffff"/><meta http-equiv="Cache-Control" content="no-transform"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>YApi 接口管理平台</title><link rel="stylesheet" href="ydoc/styles/style.css"/><meta name="author" content="ymfe"/><meta name="keywords" content="api管理,接口管理,接口文档,api文档"/><meta name="description" content="YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 APIYApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理"/><meta id="releativePath" content=""/><link rel="stylesheet" href="ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="ydoc/ydoc-plugin-img-view/imgView.css"/><link rel="stylesheet" href="web.css"/></head><body><div class="g-doc"><div class="m-main" id="js-panel"><header class="m-header" id="js-header"><div class="m-header-title js-logo"><a href="" target="_self"><img class="logo" width="36" src="documents/images/logo_header@2x.png"/><h6 class="name">YApi</h6></a></div><div><div class="m-search">
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
@ -7,7 +7,7 @@
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="documents/index.html">教程</a></li><li class="item "><a class="href" href="devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div><div class="g-home"><section class="m-section home"><div class="m-section-container"><div class="m-section-title"><h4 class="name">YApi</h4><p class="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API</p><div class="m-section-btngroup"><a href="./documents/index.html"><div class="btn ">开始</div></a><a href="https://github.com/ymfe/yapi"><div class="btn btn-ghost">Github &gt;</div></a></div><p class="caption">当前版本: v1.3.22</p></div><div class="m-section-banner"><img src="./ydoc/images/dogbg@1x.png" alt="bg" srcSet="./ydoc/images/dogbg@2x.png 2x"/></div></div></section><section class="m-section feature"><div class="m-section-container"><div class="m-section-box"><div class="item"><h6 class="title">权限管理</h6><p class="desc">YApi 成熟的团队管理扁平化项目权限配置满足各类企业的需求</p></div><div class="item"><h6 class="title">可视化接口管理</h6><p class="desc">基于 websocket 的多人协作接口编辑功能和类 postman 测试工具,让多人协作成倍提升开发效率</p></div><div class="item"><h6 class="title">Mock Server</h6><p class="desc">易用的 Mock Server再也不用担心 mock 数据的生成了</p></div><div class="item"><h6 class="title">自动化测试</h6><p class="desc">完善的接口自动化测试,保证数据的正确性</p></div><div class="item"><h6 class="title">数据导入</h6><p class="desc">支持导入 swagger, postman, har 数据格式,方便迁移旧项目</p></div><div class="item"><h6 class="title">插件机制</h6><p class="desc">强大的插件机制,满足各类业务需求</p></div></div></div></section></div><footer class="m-footer"><div class="m-footer-container"><div class="m-footer-links"><div class="group"><p class="title">团队网址</p><ul><li><a class="href" href="https://ymfe.org/">YMFE</a></li><li><a class="href" href="https://blog.ymfe.org/">YMFE Blog</a></li></ul></div><div class="group"><p class="title">Git仓库</p><ul><li><a class="href" href="https://github.com/YMFE/yapi">Github</a></li><li><a class="href" href="https://github.com/YMFE/yapi/issues">Github Issue</a></li></ul></div></div><div class="m-footer-title"><p class="copyright">© 2018 <a class="href" href="https://ymfe.org/">YMFE Team</a></p><p>Build by <a class="href" href="https://ydoc.ymfe.org/">ydoc</a></p></div></div></footer></div></div></div></div><div><div class="m-mask js-mask">
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="documents/index.html">教程</a></li><li class="item "><a class="href" href="devops/index.html">内网部署</a></li><li class="item "><a class="href" href="openapi.html">开放Api</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div><div class="g-home"><section class="m-section home"><div class="m-section-container"><div class="m-section-title"><h4 class="name">YApi</h4><p class="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API</p><div class="m-section-btngroup"><a href="./documents/index.html"><div class="btn ">开始</div></a><a href="https://github.com/ymfe/yapi"><div class="btn btn-ghost">Github &gt;</div></a></div><p class="caption">当前版本: v1.5.0</p></div><div class="m-section-banner"><img src="./ydoc/images/dogbg@1x.png" alt="bg" srcSet="./ydoc/images/dogbg@2x.png 2x"/></div></div></section><section class="m-section feature"><div class="m-section-container"><div class="m-section-box"><div class="item"><h6 class="title">权限管理</h6><p class="desc">YApi 成熟的团队管理扁平化项目权限配置满足各类企业的需求</p></div><div class="item"><h6 class="title">可视化接口管理</h6><p class="desc">基于 websocket 的多人协作接口编辑功能和类 postman 测试工具,让多人协作成倍提升开发效率</p></div><div class="item"><h6 class="title">Mock Server</h6><p class="desc">易用的 Mock Server再也不用担心 mock 数据的生成了</p></div><div class="item"><h6 class="title">自动化测试</h6><p class="desc">完善的接口自动化测试,保证数据的正确性</p></div><div class="item"><h6 class="title">数据导入</h6><p class="desc">支持导入 swagger, postman, har 数据格式,方便迁移旧项目</p></div><div class="item"><h6 class="title">插件机制</h6><p class="desc">强大的插件机制,满足各类业务需求</p></div></div></div></section></div><footer class="m-footer"><div class="m-footer-container"><div class="m-footer-links"><div class="group"><p class="title">团队网址</p><ul><li><a class="href" href="https://ymfe.org/">YMFE</a></li><li><a class="href" href="https://blog.ymfe.org/">YMFE Blog</a></li></ul></div><div class="group"><p class="title">Git仓库</p><ul><li><a class="href" href="https://github.com/YMFE/yapi">Github</a></li><li><a class="href" href="https://github.com/YMFE/yapi/issues">Github Issue</a></li></ul></div></div><div class="m-footer-title"><p class="copyright">© 2019 <a class="href" href="https://ymfe.org/">YMFE Team</a></p><p>Build by <a class="href" href="https://ydoc.ymfe.org/">ydoc</a></p></div></div></footer></div></div></div></div><div><div class="m-mask js-mask">
<div class="container">
<img src="" alt="" class="img js-mask-img" />
</div>

1403
static/doc/openapi-doc.html Normal file

File diff suppressed because one or more lines are too long

1403
static/doc/openapi.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -702,6 +702,11 @@ window.ydoc_plugin_search_json = {
"title": "详细使用方法",
"url": "/documents/case.html#服务端自动化测试-详细使用方法",
"content": "详细使用方法点击服务端测试,出现如下弹窗,用户访问该 url 就可以获取当前测试用例的所有测试结果。"
},
{
"title": "配置通用规则",
"url": "/documents/case.html#配置通用规则",
"content": "配置通用规则配置通用规则能够使自动化测试可以基于通用的规则去控制无需手动一个一个维护case."
}
]
},
@ -759,6 +764,11 @@ window.ydoc_plugin_search_json = {
"title": "详细使用方法",
"url": "/documents/case.html#服务端自动化测试-详细使用方法",
"content": "详细使用方法点击服务端测试,出现如下弹窗,用户访问该 url 就可以获取当前测试用例的所有测试结果。"
},
{
"title": "配置通用规则",
"url": "/documents/case.html#配置通用规则",
"content": "配置通用规则配置通用规则能够使自动化测试可以基于通用的规则去控制无需手动一个一个维护case."
}
]
},
@ -1209,10 +1219,35 @@ window.ydoc_plugin_search_json = {
"content": "",
"url": "/documents/CHANGELOG.html",
"children": [
{
"title": "v1.5.0",
"url": "/documents/CHANGELOG.html#v1.5.0",
"content": "v1.5.0优化开放 api功能现在 token 带有用户信息了\n修复无法获取请求302 跳转前的 headers\n"
},
{
"title": "v1.4.4",
"url": "/documents/CHANGELOG.html#v1.4.4",
"content": "v1.4.4优化了 json-schema 编辑器交互,修复了参数名写到一半提示重复的问题\n优化了首页体验提升页面打开速度\n新增自动化测试通用规则配置功能\n"
},
{
"title": "v1.4.3",
"url": "/documents/CHANGELOG.html#v1.4.3",
"content": "v1.4.3修复了可视化安装mongodb 报错的问题\n支持了 swagger 导出功能\n支持了克隆测试用例\n"
},
{
"title": "v1.4.2",
"url": "/documents/CHANGELOG.html#v1.4.2",
"content": "v1.4.2优化数据导入对 headers 处理,如果 requestType 是 json自动增加header \"content-type/json\"\nfix: 修改了测试集合有多个项目接口时,切换执行环境相互覆盖不生效的问题 #692\nfix: mongoose warning 'Error: (node:3819) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead'\nopti: 去掉没必要的redux-thunk\n接口更新没有变化时不记录日志避免cron多次导入swagger的接口时导致动态里展示一大堆的无意义日志\n"
},
{
"title": "v1.4.1",
"url": "/documents/CHANGELOG.html#v1.4.1",
"content": "v1.4.1支持任何人都可以添加分组,只有管理员才能修改项目是否公开\n支持 mongodb 集群\nBug Fixed修改 mock严格模式GET带有 JSON BODY 导致的验证问题\n对 queryPath 改动导致的bug支持通过 xxx?controller=name 等 query 参数区分路径\n因 tui-editor 需要安装github 依赖,导致部分机器无法部署成功的问题\n"
},
{
"title": "v1.3.23",
"url": "/documents/CHANGELOG.html#v1.3.23",
"content": "v1.3.23接口tag功能\n数据导入增加 merge 功能\n增加参数的批量导入功能\nBug Fixed接口path中写入 ?name=xxx bug\n高级mock 匹配 data: [{item: XXX}] 时匹配不成功\n接口运行 query params 自动勾选\nmock get 带 cookie 时跨域\njson schema 嵌套多层 array 预览不展示 bug\nswagger URL 导入 跨域问题\n"
"content": "v1.3.23接口tag功能\n数据导入增加 merge 功能\n增加参数的批量导入功能\njson schema 可视化编辑器增加 mock 功能\nBug Fixed接口path中写入 ?name=xxx bug\n高级mock 匹配 data: [{item: XXX}] 时匹配不成功\n接口运行 query params 自动勾选\nmock get 带 cookie 时跨域\njson schema 嵌套多层 array 预览不展示 bug\nswagger URL 导入 跨域问题\n"
},
{
"title": "v1.3.22",
@ -1391,10 +1426,35 @@ window.ydoc_plugin_search_json = {
"content": "",
"url": "/documents/CHANGELOG.html",
"children": [
{
"title": "v1.5.0",
"url": "/documents/CHANGELOG.html#v1.5.0",
"content": "v1.5.0优化开放 api功能现在 token 带有用户信息了\n修复无法获取请求302 跳转前的 headers\n"
},
{
"title": "v1.4.4",
"url": "/documents/CHANGELOG.html#v1.4.4",
"content": "v1.4.4优化了 json-schema 编辑器交互,修复了参数名写到一半提示重复的问题\n优化了首页体验提升页面打开速度\n新增自动化测试通用规则配置功能\n"
},
{
"title": "v1.4.3",
"url": "/documents/CHANGELOG.html#v1.4.3",
"content": "v1.4.3修复了可视化安装mongodb 报错的问题\n支持了 swagger 导出功能\n支持了克隆测试用例\n"
},
{
"title": "v1.4.2",
"url": "/documents/CHANGELOG.html#v1.4.2",
"content": "v1.4.2优化数据导入对 headers 处理,如果 requestType 是 json自动增加header \"content-type/json\"\nfix: 修改了测试集合有多个项目接口时,切换执行环境相互覆盖不生效的问题 #692\nfix: mongoose warning 'Error: (node:3819) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead'\nopti: 去掉没必要的redux-thunk\n接口更新没有变化时不记录日志避免cron多次导入swagger的接口时导致动态里展示一大堆的无意义日志\n"
},
{
"title": "v1.4.1",
"url": "/documents/CHANGELOG.html#v1.4.1",
"content": "v1.4.1支持任何人都可以添加分组,只有管理员才能修改项目是否公开\n支持 mongodb 集群\nBug Fixed修改 mock严格模式GET带有 JSON BODY 导致的验证问题\n对 queryPath 改动导致的bug支持通过 xxx?controller=name 等 query 参数区分路径\n因 tui-editor 需要安装github 依赖,导致部分机器无法部署成功的问题\n"
},
{
"title": "v1.3.23",
"url": "/documents/CHANGELOG.html#v1.3.23",
"content": "v1.3.23接口tag功能\n数据导入增加 merge 功能\n增加参数的批量导入功能\nBug Fixed接口path中写入 ?name=xxx bug\n高级mock 匹配 data: [{item: XXX}] 时匹配不成功\n接口运行 query params 自动勾选\nmock get 带 cookie 时跨域\njson schema 嵌套多层 array 预览不展示 bug\nswagger URL 导入 跨域问题\n"
"content": "v1.3.23接口tag功能\n数据导入增加 merge 功能\n增加参数的批量导入功能\njson schema 可视化编辑器增加 mock 功能\nBug Fixed接口path中写入 ?name=xxx bug\n高级mock 匹配 data: [{item: XXX}] 时匹配不成功\n接口运行 query params 自动勾选\nmock get 带 cookie 时跨域\njson schema 嵌套多层 array 预览不展示 bug\nswagger URL 导入 跨域问题\n"
},
{
"title": "v1.3.22",
@ -1613,7 +1673,7 @@ window.ydoc_plugin_search_json = {
{
"title": "配置LDAP登录",
"url": "/devops/index.html#配置ldap登录",
"content": "配置LDAP登录打开项目目录 config.json 文件,添加如下字段:{ \"port\": \"*****\",\n \"adminAccount\": \"********\",\n \"db\": {...},\n \"mail\": {...},\n \"ldapLogin\": {\n \"enable\": true,\n \"server\": \"ldap://l-ldapt1.ops.dev.cn0.qunar.com\",\n \"baseDn\": \"CN=Admin,CN=Users,DC=test,DC=com\",\n \"bindPassword\": \"password123\",\n \"searchDn\": \"OU=UserContainer,DC=test,DC=com\",\n \"searchStandard\": \"mail\", // 自定义格式: \"searchStandard\": \"&(objectClass=user)(cn=%s)\"\n \"emailPostfix\": \"@163.com\",\n \"emailKey\": \"mail\",\n \"usernameKey\": \"name\"\n }\n}\n\n这里面的配置项含义如下enable 表示是否配置 LDAP 登录true(支持 LDAP登录 )/false(不支持LDAP登录);\nserver LDAP 服务器地址,前面需要加上 ldap:// 前缀,也可以是 ldaps:// 表示是通过 SSL 连接;\nbaseDn LDAP 服务器的登录用户名,必须是从根结点到用户节点的全路径(非必须);\nbindPassword 登录该 LDAP 服务器的密码(非必须);\nsearchDn 查询用户数据的路径,类似数据库中的一张表的地址,注意这里也必须是全路径;\nsearchStandard 查询条件,这里是 mail 表示查询用户信息是通过邮箱信息来查询的。注意该字段信息与LDAP数据库存储数据的字段相对应如果如果存储用户邮箱信息的字段是 email, 这里就需要修改成 email.1.3.18+支持自定义filter表达式基本形式为&(objectClass=user)(cn=%s), 其中%s会被username替换\nemailPostfix 登陆邮箱后缀(非必须)\nemailKey: ldap数据库存放邮箱信息的字段v1.3.21 新增 非必须)\nusernameKey: ldap数据库存放用户名信息的字段v1.3.21 新增 非必须)\n重启服务器后可以在登录页看到如下画面说明 ladp 配置成功"
"content": "配置LDAP登录打开项目目录 config.json 文件,添加如下字段:{ \"port\": \"*****\",\n \"adminAccount\": \"********\",\n \"db\": {...},\n \"mail\": {...},\n \"ldapLogin\": {\n \"enable\": true,\n \"server\": \"ldap://l-ldapt1.com\",\n \"baseDn\": \"CN=Admin,CN=Users,DC=test,DC=com\",\n \"bindPassword\": \"password123\",\n \"searchDn\": \"OU=UserContainer,DC=test,DC=com\",\n \"searchStandard\": \"mail\", // 自定义格式: \"searchStandard\": \"&(objectClass=user)(cn=%s)\"\n \"emailPostfix\": \"@163.com\",\n \"emailKey\": \"mail\",\n \"usernameKey\": \"name\"\n }\n}\n\n这里面的配置项含义如下enable 表示是否配置 LDAP 登录true(支持 LDAP登录 )/false(不支持LDAP登录);\nserver LDAP 服务器地址,前面需要加上 ldap:// 前缀,也可以是 ldaps:// 表示是通过 SSL 连接;\nbaseDn LDAP 服务器的登录用户名,必须是从根结点到用户节点的全路径(非必须);\nbindPassword 登录该 LDAP 服务器的密码(非必须);\nsearchDn 查询用户数据的路径,类似数据库中的一张表的地址,注意这里也必须是全路径;\nsearchStandard 查询条件,这里是 mail 表示查询用户信息是通过邮箱信息来查询的。注意该字段信息与LDAP数据库存储数据的字段相对应如果如果存储用户邮箱信息的字段是 email, 这里就需要修改成 email.1.3.18+支持自定义filter表达式基本形式为&(objectClass=user)(cn=%s), 其中%s会被username替换\nemailPostfix 登陆邮箱后缀(非必须)\nemailKey: ldap数据库存放邮箱信息的字段v1.3.21 新增 非必须)\nusernameKey: ldap数据库存放用户名信息的字段v1.3.21 新增 非必须)\n重启服务器后可以在登录页看到如下画面说明 ladp 配置成功"
},
{
"title": "禁止注册",
@ -1624,6 +1684,11 @@ window.ydoc_plugin_search_json = {
"title": "版本通知",
"url": "/devops/index.html#版本通知",
"content": "版本通知v1.3.19+ 增加)在 config.json 添加 \"versionNotify\": true 配置项,就可以开启版本通知功能,默认为 false修改完成后请重启 yapi 服务器。{ \"port\": \"******\",\n \"adminAccount\": \"*****\",\n \"versionNotify\": true\n}\n\n"
},
{
"title": "如何配置mongodb集群",
"url": "/devops/index.html#版本通知-如何配置mongodb集群",
"content": "如何配置mongodb集群请升级到 yapi >= 1.4.0以上版本,然后在 config.json db项配置 connectString:{\n \"port\": \"***\",\n \"db\": {\n \"connectString\": \"mongodb://127.0.0.100:8418,127.0.0.101:8418,127.0.0.102:8418/yapidb?slaveOk=true\",\n \"user\": \"******\",\n \"pass\": \"******\"\n },\n}\n\n详细配置参考 wiki"
}
]
},
@ -1670,7 +1735,7 @@ window.ydoc_plugin_search_json = {
{
"title": "配置LDAP登录",
"url": "/devops/index.html#配置ldap登录",
"content": "配置LDAP登录打开项目目录 config.json 文件,添加如下字段:{ \"port\": \"*****\",\n \"adminAccount\": \"********\",\n \"db\": {...},\n \"mail\": {...},\n \"ldapLogin\": {\n \"enable\": true,\n \"server\": \"ldap://l-ldapt1.ops.dev.cn0.qunar.com\",\n \"baseDn\": \"CN=Admin,CN=Users,DC=test,DC=com\",\n \"bindPassword\": \"password123\",\n \"searchDn\": \"OU=UserContainer,DC=test,DC=com\",\n \"searchStandard\": \"mail\", // 自定义格式: \"searchStandard\": \"&(objectClass=user)(cn=%s)\"\n \"emailPostfix\": \"@163.com\",\n \"emailKey\": \"mail\",\n \"usernameKey\": \"name\"\n }\n}\n\n这里面的配置项含义如下enable 表示是否配置 LDAP 登录true(支持 LDAP登录 )/false(不支持LDAP登录);\nserver LDAP 服务器地址,前面需要加上 ldap:// 前缀,也可以是 ldaps:// 表示是通过 SSL 连接;\nbaseDn LDAP 服务器的登录用户名,必须是从根结点到用户节点的全路径(非必须);\nbindPassword 登录该 LDAP 服务器的密码(非必须);\nsearchDn 查询用户数据的路径,类似数据库中的一张表的地址,注意这里也必须是全路径;\nsearchStandard 查询条件,这里是 mail 表示查询用户信息是通过邮箱信息来查询的。注意该字段信息与LDAP数据库存储数据的字段相对应如果如果存储用户邮箱信息的字段是 email, 这里就需要修改成 email.1.3.18+支持自定义filter表达式基本形式为&(objectClass=user)(cn=%s), 其中%s会被username替换\nemailPostfix 登陆邮箱后缀(非必须)\nemailKey: ldap数据库存放邮箱信息的字段v1.3.21 新增 非必须)\nusernameKey: ldap数据库存放用户名信息的字段v1.3.21 新增 非必须)\n重启服务器后可以在登录页看到如下画面说明 ladp 配置成功"
"content": "配置LDAP登录打开项目目录 config.json 文件,添加如下字段:{ \"port\": \"*****\",\n \"adminAccount\": \"********\",\n \"db\": {...},\n \"mail\": {...},\n \"ldapLogin\": {\n \"enable\": true,\n \"server\": \"ldap://l-ldapt1.com\",\n \"baseDn\": \"CN=Admin,CN=Users,DC=test,DC=com\",\n \"bindPassword\": \"password123\",\n \"searchDn\": \"OU=UserContainer,DC=test,DC=com\",\n \"searchStandard\": \"mail\", // 自定义格式: \"searchStandard\": \"&(objectClass=user)(cn=%s)\"\n \"emailPostfix\": \"@163.com\",\n \"emailKey\": \"mail\",\n \"usernameKey\": \"name\"\n }\n}\n\n这里面的配置项含义如下enable 表示是否配置 LDAP 登录true(支持 LDAP登录 )/false(不支持LDAP登录);\nserver LDAP 服务器地址,前面需要加上 ldap:// 前缀,也可以是 ldaps:// 表示是通过 SSL 连接;\nbaseDn LDAP 服务器的登录用户名,必须是从根结点到用户节点的全路径(非必须);\nbindPassword 登录该 LDAP 服务器的密码(非必须);\nsearchDn 查询用户数据的路径,类似数据库中的一张表的地址,注意这里也必须是全路径;\nsearchStandard 查询条件,这里是 mail 表示查询用户信息是通过邮箱信息来查询的。注意该字段信息与LDAP数据库存储数据的字段相对应如果如果存储用户邮箱信息的字段是 email, 这里就需要修改成 email.1.3.18+支持自定义filter表达式基本形式为&(objectClass=user)(cn=%s), 其中%s会被username替换\nemailPostfix 登陆邮箱后缀(非必须)\nemailKey: ldap数据库存放邮箱信息的字段v1.3.21 新增 非必须)\nusernameKey: ldap数据库存放用户名信息的字段v1.3.21 新增 非必须)\n重启服务器后可以在登录页看到如下画面说明 ladp 配置成功"
},
{
"title": "禁止注册",
@ -1681,6 +1746,11 @@ window.ydoc_plugin_search_json = {
"title": "版本通知",
"url": "/devops/index.html#版本通知",
"content": "版本通知v1.3.19+ 增加)在 config.json 添加 \"versionNotify\": true 配置项,就可以开启版本通知功能,默认为 false修改完成后请重启 yapi 服务器。{ \"port\": \"******\",\n \"adminAccount\": \"*****\",\n \"versionNotify\": true\n}\n\n"
},
{
"title": "如何配置mongodb集群",
"url": "/devops/index.html#版本通知-如何配置mongodb集群",
"content": "如何配置mongodb集群请升级到 yapi >= 1.4.0以上版本,然后在 config.json db项配置 connectString:{\n \"port\": \"***\",\n \"db\": {\n \"connectString\": \"mongodb://127.0.0.100:8418,127.0.0.101:8418,127.0.0.102:8418/yapidb?slaveOk=true\",\n \"user\": \"******\",\n \"pass\": \"******\"\n },\n}\n\n详细配置参考 wiki"
}
]
}

View File

@ -74,7 +74,7 @@ function initComponents() {
navigation = responsiveNav('.js-nav', {
customToggle: '#js-nav-btn',
open: function() {
$menu.classList.remove('active');
if ($menu) $menu.classList.remove('active');
setTimeout(itemAddActive, 0);
}
});

View File

@ -26,6 +26,7 @@ body {
::-webkit-scrollbar {
width: 6px;
height: 4px;
}
::-webkit-scrollbar-track {
@ -90,7 +91,7 @@ h6, .h6 {
::before,
::after {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html {
@ -216,7 +217,7 @@ input::-moz-focus-inner {
}
mark {
background-color: transparent;
background-color: rgba(0, 0, 0, 0);
}
a,
@ -582,7 +583,7 @@ a:link, a:visited {
}
.nav-toggle {
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
@ -606,6 +607,10 @@ a:link, a:visited {
}
}
html {
height: 100%;
}
body {
width: 100%;
height: 100%;
@ -1371,6 +1376,14 @@ body {
font-weight: 500;
}
.markdown-body h2 {
margin: .54rem 0 .24rem;
}
.markdown-body h3 {
margin: .32rem 0 .16rem;
}
.markdown-body a {
text-decoration: none;
background-color: rgba(187, 239, 253, 0.3);
@ -1385,6 +1398,25 @@ body {
border-bottom-color: rgba(3, 17, 31, 0.87);
}
.markdown-body .type {
color: #1890ff;
font-size: 16px;
}
.markdown-body .versionTag {
background: #1890ff;
color: white;
border-radius: 4px;
padding: 2px 4px;
font-size: 14px;
}
.markdown-body .desc {
font-size: 16px;
font-weight: normal;
color: rgba(0, 0, 0, 0.65);
}
/* PrismJS 1.14.0
http://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
@ -1608,15 +1640,25 @@ pre[class*="language-"] {
.m-header-nav .m-header-subtitle .link {
display: inline-block;
padding-left: .5em;
padding-right: .5em;
width: 100%;
background-color: transparent;
border-radius: 4px;
line-height: .32rem;
transition: all 0.2s;
}
.m-header-nav .m-header-subtitle .link:hover {
color: #1890ff;
background-color: #d9edff;
}
.m-header-nav .item {
margin-bottom: 0.08rem;
width: 100%;
display: inline-block;
line-height: 1.8;
margin: 0 0.08rem;
padding: 0 0.08rem;
position: relative;
cursor: pointer;
transition: all 0.2s;
@ -1629,15 +1671,24 @@ pre[class*="language-"] {
.m-header-nav .item.active {
font-weight: bold;
color: rgba(3, 17, 31, 0.87);
}
.m-header-nav .item.active .href {
border-bottom: 2px solid #1890ff;
color: #1890ff;
}
.m-header-nav .href {
padding: .5em;
display: inline-block;
padding-left: .5em;
padding-right: .5em;
height: .32rem;
line-height: .32rem;
width: 100%;
background-color: transparent;
border-radius: 4px;
transition: all 0.2s;
}
.m-header-nav .href:active {
color: #1890ff;
background-color: #d9edff;
}
.m-header-btn {
@ -1651,7 +1702,7 @@ pre[class*="language-"] {
padding: .12rem;
cursor: pointer;
transition: color 0.2s;
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
@ -1676,7 +1727,8 @@ pre[class*="language-"] {
padding: 0;
}
.m-header-nav .m-header-items > .item:hover .m-header-subtitle {
display: block;
display: flex;
flex-wrap: wrap;
}
.m-header-nav .m-header-subtitle {
display: none;
@ -1710,16 +1762,37 @@ pre[class*="language-"] {
top: -.16rem;
transform: translateX(-50%);
}
.m-header-nav .m-header-subtitle .link {
display: inline-block;
padding: 0;
width: auto;
}
.m-header-nav .m-header-subtitle .link:hover {
font-weight: bold;
color: rgba(3, 17, 31, 0.87);
background-color: transparent;
}
.m-header-nav .href {
border-radius: 0;
}
.m-header-nav .href:hover {
font-weight: bold;
color: rgba(3, 17, 31, 0.87);
background-color: transparent;
}
.m-header-nav .item {
margin: 0 0.16rem;
line-height: .64rem;
width: auto;
transition: color 0.2s;
}
.m-header-nav .item:hover {
.m-header-nav .item.active {
font-weight: bold;
color: rgba(3, 17, 31, 0.87);
}
.m-header-nav .item.active .href {
border-bottom: 2px solid #1890ff;
}
.m-header .m-header-nav {
overflow: inherit;
}
@ -1779,8 +1852,9 @@ pre[class*="language-"] {
margin-bottom: .16rem;
}
.m-summary-block .m-summary-block {
margin-bottom: 0;
.m-summary-block.active > .href {
font-weight: bold;
color: #1890ff;
}
.m-summary-title {

View File

@ -10,10 +10,10 @@ $(function(){
// 判断是否为空对象
function realObj(obj) {
for (var i in obj) {
return true;
if (JSON.stringify(obj) === '{}') {
return false; // 如果为空,返回false
}
return false;
return true;
}
// 防抖函数
@ -35,15 +35,16 @@ $(function(){
var index = str.indexOf(val);
var startIndex = index > highlightTextPrevNum ? index - highlightTextPrevNum : 0;
var sliceStr = str.slice(startIndex, index + val.length + highlightTextNextNum);
var addHighlightStr = sliceStr.replace(val, '<span class="highlight">' + val + '</span>');
var reg = new RegExp('(' + val + ')', 'gi'); // 搜索的值进行高亮替换时, 忽略大小写
var addHighlightStr = sliceStr.replace(reg, '<span class="highlight">' + '$1' + '</span>');
var ellipsis = (sliceStr.lastIndexOf(val) != -1) || (sliceStr.lastIndexOf(val) > highlightTextNextNum) ? '...' : '';
return addHighlightStr + ellipsis;
}
// 隐藏搜索结果框
function hideSearchResult() {
$searchResult.hide();
}
// function hideSearchResult() {
// $searchResult.hide();
// }
// 监听输入的内容
$searchInput.on('input', debounce(function(e) {
@ -97,6 +98,7 @@ $(function(){
activeIndex = (activeIndex + 1) % length;
$captions[activeIndex].classList.add('active');
} else if (e.keyCode == 13) {
$searchResult.hide();
window.open($captions[activeIndex].href, '_self');
}
});
@ -113,7 +115,7 @@ $(function(){
}
}, 300));
$searchResult.on('click', function(e){
$searchResult.on('click', function (e) {
return false;
})