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? 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/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(); 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() } }); 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); } } } 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; } } 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 {