From 54ef3b3f3af9804d6fd589e79e1fef3065790219 Mon Sep 17 00:00:00 2001 From: zwjamnsss Date: Mon, 25 Sep 2017 16:07:44 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E5=8F=96=E6=B6=88?= =?UTF-8?q?=20loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/Project/Interface/InterfaceList/InterfaceMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js index af601438..cf665639 100755 --- a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js @@ -189,7 +189,7 @@ class InterfaceMenu extends Component { that.props.history.push('/project/' + that.props.match.params.id + '/interface/api') }, - async onCancel() { + onCancel() { ref.destroy() } }); From dcf74196f1592624b3b96d4883855c3cf346250b Mon Sep 17 00:00:00 2001 From: zwjamnsss Date: Mon, 25 Sep 2017 18:29:08 +0800 Subject: [PATCH 2/6] =?UTF-8?q?opti:=20=E6=B7=BB=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E7=BB=84=E5=8F=AF=E4=BB=A5=E4=B8=8D=E6=8C=87=E5=AE=9A=E7=BB=84?= =?UTF-8?q?=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/group.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/server/controllers/group.js b/server/controllers/group.js index c45ac6c3..ce84ff0d 100755 --- a/server/controllers/group.js +++ b/server/controllers/group.js @@ -67,14 +67,18 @@ class groupController extends baseController { return ctx.body = yapi.commons.resReturn(null, 400, '项目分组名不能为空'); } - if (!params.owner_uid) { - return ctx.body = yapi.commons.resReturn(null, 400, '项目分组必须添加一个组长'); - } + // if (!params.owner_uid) { + // return ctx.body = yapi.commons.resReturn(null, 400, '项目分组必须添加一个组长'); + // } - let groupUserdata = await this.getUserdata(params.owner_uid, 'owner'); - if (groupUserdata === null) { - return ctx.body = yapi.commons.resReturn(null, 400, '组长uid不存在') + let groupUserdata = null; + if (params.owner_uid) { + groupUserdata = await this.getUserdata(params.owner_uid, 'owner'); + if (groupUserdata === null) { + return ctx.body = yapi.commons.resReturn(null, 400, '组长uid不存在') + } } + let groupInst = yapi.getInst(groupModel); let checkRepeat = await groupInst.checkRepeat(params.group_name); @@ -89,7 +93,7 @@ class groupController extends baseController { uid: this.getUid(), add_time: yapi.commons.time(), up_time: yapi.commons.time(), - members: [groupUserdata] + members: groupUserdata ? [groupUserdata] : [] }; try { From bb453aceb4dff23175b239a69b36e001ee14984f Mon Sep 17 00:00:00 2001 From: zwjamnsss Date: Mon, 25 Sep 2017 20:13:33 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E6=B8=85=E7=A9=BA=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/containers/Group/GroupList/GroupList.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/containers/Group/GroupList/GroupList.js b/client/containers/Group/GroupList/GroupList.js index 6d3c48ee..049e2935 100755 --- a/client/containers/Group/GroupList/GroupList.js +++ b/client/containers/Group/GroupList/GroupList.js @@ -101,6 +101,9 @@ export default class GroupList extends Component { }); } else { this.setState({ + newGroupName: '', + group_name: '', + owner_uid: 0, addGroupModalVisible: false }); } @@ -111,6 +114,9 @@ export default class GroupList extends Component { const res = await axios.post('/api/group/add', { group_name, group_desc, owner_uid }) if (!res.data.errcode) { this.setState({ + newGroupName: '', + group_name: '', + owner_uid: 0, addGroupModalVisible: false }); await this.props.fetchGroupList(); From 8c36c6f6131ea37a24a251171d5470c34204859e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=B8=8C=E9=87=8C?= Date: Tue, 26 Sep 2017 10:26:38 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9logo=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Header/Header.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/components/Header/Header.js b/client/components/Header/Header.js index ab2a0989..34c05f6e 100755 --- a/client/components/Header/Header.js +++ b/client/components/Header/Header.js @@ -175,12 +175,12 @@ export default class HeaderCom extends Component { return (
-
- + +
{logoSVG('32px')} {/*YApi*/} - -
+
+
{login? From c3a595dd7033fb7d246d2dcae4659c2415e55361 Mon Sep 17 00:00:00 2001 From: "wenbo.dong" Date: Tue, 26 Sep 2017 10:40:44 +0800 Subject: [PATCH 5/6] =?UTF-8?q?opti:=20=E6=8E=A5=E5=8F=A3=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Postman/Postman.js | 379 +++++++++--------- client/components/Postman/Postman.scss | 3 + .../Interface/InterfaceList/Run/Run.scss | 7 +- 3 files changed, 197 insertions(+), 192 deletions(-) diff --git a/client/components/Postman/Postman.js b/client/components/Postman/Postman.js index 7f22093b..8c5e104e 100755 --- a/client/components/Postman/Postman.js +++ b/client/components/Postman/Postman.js @@ -1,7 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import Mock from 'mockjs' -import { Button, Input, Select, Card, Alert, Spin, Icon, Collapse, Tooltip, message, AutoComplete } from 'antd' +import { Button, Input, Select, Alert, Spin, Icon, Collapse, Tooltip, message, AutoComplete } from 'antd' import { autobind } from 'core-decorators'; import constants from '../../constants/variable.js' @@ -517,7 +517,7 @@ export default class Run extends Component { return (
-
+
{hasPlugin ? '' : @@ -547,204 +547,205 @@ export default class Run extends Component { }
- 请求部分 } noHovering className="req-part"> -
- - +

请求部分  + +

+
- + + - - - - { - if (hasPlugin) { - return '发送请求' - } else { - return '请安装cross-request插件' - } - })()}> - - - - - -
- - - + this.changePathParam(e, index, true)} className="key" /> - = - this.changePathParam(e, index)} - className="value" - dataSource={mockDataSource} - placeholder="参数值" - optionLabelProp="value" - /> - this.deletePathParam(index)} /> -
- ) - }) + domains.map((item, index) => ()) } - - - - { - query.map((item, index) => { - return ( -
- this.changeQuery(e, index, true)} className="key" /> - = - this.changeQuery(e, index)} - className="value" - dataSource={mockDataSource} - placeholder="参数值" - optionLabelProp="value" - /> - this.deleteQuery(index)} /> -
- ) - }) - } - -
- - { - headers.map((item, index) => { - return ( -
- this.changeHeader(e, index, true)} className="key" /> - = - this.changeHeader(e, index)} - className="value" - dataSource={mockDataSource} - placeholder="参数值" - optionLabelProp="value" - /> - this.deleteHeader(index)} /> -
- ) - }) - } - -
- -
BODY
-
- } - key="3" - className={HTTP_METHOD[method].request_body ? 'POST' : 'hidden'} - > + -
-
+ + + + { + if (hasPlugin) { + return '发送请求' + } else { + return '请安装cross-request插件' + } + })()}> + + + + + +
+ + + + { + pathParam.map((item, index) => { + return ( +
+ this.changePathParam(e, index, true)} className="key" /> + = + this.changePathParam(e, index)} + className="value" + dataSource={mockDataSource} + placeholder="参数值" + optionLabelProp="value" + /> + this.deletePathParam(index)} /> +
+ ) + }) + } + +
+ + { + query.map((item, index) => { + return ( +
+ this.changeQuery(e, index, true)} className="key" /> + = + this.changeQuery(e, index)} + className="value" + dataSource={mockDataSource} + placeholder="参数值" + optionLabelProp="value" + /> + this.deleteQuery(index)} /> +
+ ) + }) + } + +
+ + { + headers.map((item, index) => { + return ( +
+ this.changeHeader(e, index, true)} className="key" /> + = + this.changeHeader(e, index)} + className="value" + dataSource={mockDataSource} + placeholder="参数值" + optionLabelProp="value" + /> + this.deleteHeader(index)} /> +
+ ) + }) + } + +
+ +
BODY
+ } + key="3" + className={HTTP_METHOD[method].request_body ? 'POST' : 'hidden'} + > - { - HTTP_METHOD[method].request_body && bodyType === 'form' && -
- { - bodyForm.map((item, index) => { - return ( -
- this.changeBody(e, index, 'key')} className="key" /> - [ - - ] - = - {item.type === 'file' ? - this.changeBody(e, index, 'value')} multiple className="value" /> : - this.changeBody(e, index, 'value')} - className="value" - dataSource={mockDataSource} - placeholder="参数值" - optionLabelProp="value" - /> +
+
+
- } - this.deleteBody(index)} /> -
- ) - }) - } - -
- } - { - HTTP_METHOD[method].request_body && bodyType === 'file' && -
- -
- } - {/* - method !== 'POST' && -
GET 请求没有 BODY。
- */} + { + HTTP_METHOD[method].request_body && bodyType === 'form' && +
+ { + bodyForm.map((item, index) => { + return ( +
+ this.changeBody(e, index, 'key')} className="key" /> + [ + + ] + = + {item.type === 'file' ? + this.changeBody(e, index, 'value')} multiple className="value" /> : + this.changeBody(e, index, 'value')} + className="value" + dataSource={mockDataSource} + placeholder="参数值" + optionLabelProp="value" + /> + + } + this.deleteBody(index)} /> +
+ ) + }) + } + +
+ } + { + HTTP_METHOD[method].request_body && bodyType === 'file' && +
+ +
+ } + {/* + method !== 'POST' && +
GET 请求没有 BODY。
+ */} + + + +

返回结果

+ +
+ + +
+ +

返回 Body 验证结果:

+
+ {validResView} +
+
+ + {/**/} +
- - - - -
- - -
- -

返回 Body 验证结果:

-
- {validResView} -
-
- - {/**/} -
-
-
-
-
+
) } diff --git a/client/components/Postman/Postman.scss b/client/components/Postman/Postman.scss index 1e1e3f9a..73021783 100755 --- a/client/components/Postman/Postman.scss +++ b/client/components/Postman/Postman.scss @@ -14,3 +14,6 @@ min-height: 200px; } } +.interface-test { + padding: .24rem; +} diff --git a/client/containers/Project/Interface/InterfaceList/Run/Run.scss b/client/containers/Project/Interface/InterfaceList/Run/Run.scss index 9c2310bf..9ec23078 100755 --- a/client/containers/Project/Interface/InterfaceList/Run/Run.scss +++ b/client/containers/Project/Interface/InterfaceList/Run/Run.scss @@ -1,6 +1,6 @@ .interface-test { .has-plugin, .req-part, .resp-part { - margin: 8px; + margin-bottom: 16px; } .url { display: flex; @@ -25,7 +25,7 @@ margin-left: 6px; } .icon-btn:hover { - color: #108ee9; + color: #2395f1; } } .add-col-modal { @@ -41,7 +41,8 @@ background: #fa0; } .col-item.selected { - background: #108ee9; + background: #2395f1; + color: rgba(255, 255, 255, 1); } } } From 261a46ee44ca95bd7b089cfb9c3188fa88ece465 Mon Sep 17 00:00:00 2001 From: "wenbo.dong" Date: Tue, 26 Sep 2017 10:41:40 +0800 Subject: [PATCH 6/6] =?UTF-8?q?opti:=20=E6=8E=A5=E5=8F=A3=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/containers/Project/Interface/InterfaceList/View.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/containers/Project/Interface/InterfaceList/View.scss b/client/containers/Project/Interface/InterfaceList/View.scss index 4f4ddb64..cc8acd17 100755 --- a/client/containers/Project/Interface/InterfaceList/View.scss +++ b/client/containers/Project/Interface/InterfaceList/View.scss @@ -120,6 +120,6 @@ transform: translate(0, -50%); } .user-name { - padding-left: .32rem; + padding-left: .38rem; } }