From e4e48dc79fc7341db2b42361e5cde14d2f42156c Mon Sep 17 00:00:00 2001 From: suxiaoxin Date: Wed, 8 Nov 2017 17:51:12 +0800 Subject: [PATCH 1/2] opti: icon --- static/doc/adv_mock.html | 9 +++++---- static/doc/api.html | 19 ++++++++++--------- static/doc/case.html | 9 +++++---- static/doc/data.html | 9 +++++---- static/doc/devops.html | 9 +++++---- static/doc/getfamiliar.html | 9 +++++---- static/doc/index.html | 9 +++++---- static/doc/interface.html | 9 +++++---- static/doc/manage.html | 9 +++++---- static/doc/mock.html | 31 ++++++++++++++++--------------- static/doc/plugin-dev.html | 9 +++++---- static/doc/plugin-hooks.html | 9 +++++---- static/doc/plugin-index.html | 9 +++++---- static/doc/plugin-list.html | 9 +++++---- static/doc/plugin.html | 9 +++++---- static/doc/project.html | 9 +++++---- static/doc/qa.html | 9 +++++---- static/doc/quickstart.html | 9 +++++---- static/doc/redev.html | 9 +++++---- static/doc/releases.html | 9 +++++---- static/doc/usage.html | 9 +++++---- 21 files changed, 121 insertions(+), 100 deletions(-) diff --git a/static/doc/adv_mock.html b/static/doc/adv_mock.html index 77a1248e..a148d847 100644 --- a/static/doc/adv_mock.html +++ b/static/doc/adv_mock.html @@ -1,15 +1,16 @@ - + YApi 接口管理平台 使用手册 - + - + - + + diff --git a/static/doc/api.html b/static/doc/api.html index 55496fde..622fdfab 100644 --- a/static/doc/api.html +++ b/static/doc/api.html @@ -1,15 +1,16 @@ - + YApi 接口管理平台 - + - + - + + @@ -3022,7 +3023,7 @@
示例:

-//请求示例
+//请求示例
 {
     "id": 8,
     "env": [{
@@ -3032,7 +3033,7 @@
     "desc": "yapi项目"
 }
 
-//返回示例
+//返回示例
 {
     "errcode": 0,
     "errmsg": "success",
@@ -3482,8 +3483,8 @@
     
     
示例:

-//请求  /interface/add
-//header Content-Type:application/json
+//请求  /interface/add
+//header Content-Type:application/json
 
 {
    "title": "testapi",
@@ -3514,7 +3515,7 @@
    "res_body": "{\"tt\": 222}"
 }
 
-//返回结果
+//返回结果
 {
     "errcode": 0,
     "errmsg": "success",
diff --git a/static/doc/case.html b/static/doc/case.html
index 185418e4..676d4502 100644
--- a/static/doc/case.html
+++ b/static/doc/case.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/data.html b/static/doc/data.html
index df350d7f..4478d1ec 100644
--- a/static/doc/data.html
+++ b/static/doc/data.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/devops.html b/static/doc/devops.html
index b5475c7e..ffb479a0 100644
--- a/static/doc/devops.html
+++ b/static/doc/devops.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 内网部署
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/getfamiliar.html b/static/doc/getfamiliar.html
index 839d5421..2a98d883 100644
--- a/static/doc/getfamiliar.html
+++ b/static/doc/getfamiliar.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/index.html b/static/doc/index.html
index bd2664a6..e0f7fa76 100644
--- a/static/doc/index.html
+++ b/static/doc/index.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/interface.html b/static/doc/interface.html
index 34f60ea2..29ae220f 100644
--- a/static/doc/interface.html
+++ b/static/doc/interface.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/manage.html b/static/doc/manage.html
index 2dab0234..dc16ea37 100644
--- a/static/doc/manage.html
+++ b/static/doc/manage.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/mock.html b/static/doc/mock.html
index 066e254a..5a750d5e 100644
--- a/static/doc/mock.html
+++ b/static/doc/mock.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
@@ -194,14 +195,14 @@
 

注:项目 id 可以在项目设置里查看到

定义 mock 数据示例 #

{
-    "status|0-1": 0, //接口状态
+    "status|0-1": 0, //接口状态
     "message": "请求完成", //消息提示
     "data": {
         "counts":"@integer", //统计数量
-        "totalSubjectType|4-10": [ //4-10意味着可以随机生成4-10组数据
+        "totalSubjectType|4-10": [ //4-10意味着可以随机生成4-10组数据
             { 
-              "subjectName|regexp": "大数据|机器学习|工具", //主题名
-              "subjectType|+1": 1 //类型
+              "subjectName|regexp": "大数据|机器学习|工具", //主题名
+              "subjectType|+1": 1 //类型
             }
         ],
         "data":[
@@ -215,8 +216,8 @@
 

YApi-Mock 跟 Mockjs 区别 #

Mockjs 官网

1 因为 yapi 基于 json 定义 mock ,无法使用 mockjs 原有的函数功能,正则表达式需要基于 rule 书写,示例如下:

{
-  "name|regexp": "[a-z0-9_]+?",
-  "type|regexp": "json|text|xml" //枚举数据类型可这样实现
+  "name|regexp": "[a-z0-9_]+?",
+  "type|regexp": "json|text|xml" //枚举数据类型可这样实现
 }
 

2 支持替换请求的 query, body 参数

{
@@ -226,13 +227,13 @@
 

如何使用 Mock #

1 在 js 代码直接请求yapi提供的 mock 地址(不用担心跨域问题) #

在代码直接请求 yapi 提供的 mock 地址,以 jQuery 为例:

let prefix = 'http://yapi.xxx.com/mock/2817'
 $.post(prefix+'/baseapi/path', {username: 'xxx'}, function(res){
-    console.log(res) //返回上图预览部分的数据
+    console.log(res) //返回上图预览部分的数据
 })
 

2 基于本地服务器反向代理 #

优点:不用修改项目代码

2.1 基于 nginx 反向代理 #

location /baseapi
 {
-proxy_pass   http://yapi.xxx.com/mock/2817/baseapi; #baseapi后面没有"/"
+proxy_pass   http://yapi.xxx.com/mock/2817/baseapi; #baseapi后面没有"/"
 }
 

2.2 基于 ykit mock功能 #

{
@@ -253,9 +254,9 @@ $.post2. 数据占位符定义规范(Data Placeholder Definition,DPD)

数据模板定义规范(Data Template Definition,DTD) #

数据模板中的每个属性由 3 部分构成:属性名、生成规则、属性值:

-
// 属性名   name (与生成规则之间用 "|" 隔开)
-// 生成规则 rule(生成规则有7种详见下面的生成规则)
-// 属性值   value(可以含有 "@占位符" 同时也指定了最终值的初始值和类型)
+
// 属性名   name (与生成规则之间用 "|" 隔开)
+// 生成规则 rule(生成规则有7种详见下面的生成规则)
+// 属性值   value(可以含有 "@占位符" 同时也指定了最终值的初始值和类型)
 
 'name|rule': value
 
diff --git a/static/doc/plugin-dev.html b/static/doc/plugin-dev.html
index 8101dd5e..457b138b 100644
--- a/static/doc/plugin-dev.html
+++ b/static/doc/plugin-dev.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 插件 Wiki
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/plugin-hooks.html b/static/doc/plugin-hooks.html
index 1c4e9da3..a52d7206 100644
--- a/static/doc/plugin-hooks.html
+++ b/static/doc/plugin-hooks.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 插件 Wiki
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/plugin-index.html b/static/doc/plugin-index.html
index 06ed421e..62558383 100644
--- a/static/doc/plugin-index.html
+++ b/static/doc/plugin-index.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 插件 Wiki
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/plugin-list.html b/static/doc/plugin-list.html
index 2eae461c..3b89638d 100644
--- a/static/doc/plugin-list.html
+++ b/static/doc/plugin-list.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 插件 Wiki
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/plugin.html b/static/doc/plugin.html
index 99179390..22e6f4e3 100644
--- a/static/doc/plugin.html
+++ b/static/doc/plugin.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 插件 Wiki
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/project.html b/static/doc/project.html
index 79c59808..f0532dc0 100644
--- a/static/doc/project.html
+++ b/static/doc/project.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/qa.html b/static/doc/qa.html
index f357ff56..185c60e2 100644
--- a/static/doc/qa.html
+++ b/static/doc/qa.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 常见问题
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/quickstart.html b/static/doc/quickstart.html
index fdbc4b2c..3df75ba8 100644
--- a/static/doc/quickstart.html
+++ b/static/doc/quickstart.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/redev.html b/static/doc/redev.html
index 73bb4272..c48e8fab 100644
--- a/static/doc/redev.html
+++ b/static/doc/redev.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 插件 Wiki
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/releases.html b/static/doc/releases.html
index 4046a487..412489d1 100644
--- a/static/doc/releases.html
+++ b/static/doc/releases.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 版本记录
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     
diff --git a/static/doc/usage.html b/static/doc/usage.html
index 4693aa65..d878a0dd 100644
--- a/static/doc/usage.html
+++ b/static/doc/usage.html
@@ -1,15 +1,16 @@
 
 
 
-    
+
     YApi 接口管理平台 使用手册
-            
+    
         
     
-            
+    
         
     
-    
+
+    
     
     
     

From fb55bf20af251cdf9e311b0eedc5b71735bd7c1d Mon Sep 17 00:00:00 2001
From: suxiaoxin 
Date: Fri, 10 Nov 2017 19:35:11 +0800
Subject: [PATCH 2/2] =?UTF-8?q?opti:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?=
 =?UTF-8?q?=E4=B8=8B=E8=8F=9C=E5=8D=95=E6=8C=89=E9=92=AE=E4=B8=8D=E5=8F=AF?=
 =?UTF-8?q?=E8=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 doc/styles/theme.css        | 8 ++++++++
 static/doc/styles/theme.css | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/doc/styles/theme.css b/doc/styles/theme.css
index 507e24af..ce50a5c7 100755
--- a/doc/styles/theme.css
+++ b/doc/styles/theme.css
@@ -190,4 +190,12 @@ body, h1, h2, h3, h4, h5, h6 {
   background: #552d84;
   border: 1px solid;
   border-color: #fff;
+}
+
+.ydoc .navbar-toggle{
+  color: #333; 
+}
+
+.ydoc .ydoc-nav .navbar-left li:nth-child(1){
+  display: none;
 }
\ No newline at end of file
diff --git a/static/doc/styles/theme.css b/static/doc/styles/theme.css
index 507e24af..ce50a5c7 100755
--- a/static/doc/styles/theme.css
+++ b/static/doc/styles/theme.css
@@ -190,4 +190,12 @@ body, h1, h2, h3, h4, h5, h6 {
   background: #552d84;
   border: 1px solid;
   border-color: #fff;
+}
+
+.ydoc .navbar-toggle{
+  color: #333; 
+}
+
+.ydoc .ydoc-nav .navbar-left li:nth-child(1){
+  display: none;
 }
\ No newline at end of file