diff --git a/client/containers/AddInterface/AddInterface.js b/client/containers/AddInterface/AddInterface.js index 4e278f53..048bf5b5 100644 --- a/client/containers/AddInterface/AddInterface.js +++ b/client/containers/AddInterface/AddInterface.js @@ -108,6 +108,15 @@ class AddInterface extends Component { props.addReqHeader(req_headers) } + editState2 () { + const props = this.props + props.pushInputValue(props.url) + // props.pushInterfaceName(title) + // props.getReqParams(req_params_other) + props.getResParams(props.resParams) + // props.addReqHeader(req_headers) + } + initInterfaceData (interfaceId) { const params = { id: interfaceId } @@ -165,9 +174,11 @@ class AddInterface extends Component { this.setLoading(true) axios.post(postURL, params) - .then(() => { + .then(data => { + console.log(data) this.setLoading() - this.routerPage() + this.editState2() + // this.routerPage() }) .catch(e => { console.log(e) diff --git a/client/containers/AddInterface/AddInterface.scss b/client/containers/AddInterface/AddInterface.scss index a8d90761..7aa9cec9 100644 --- a/client/containers/AddInterface/AddInterface.scss +++ b/client/containers/AddInterface/AddInterface.scss @@ -8,7 +8,7 @@ max-width: 11rem; margin: 0 auto; background: #FFF; - padding: 10px 20px; + padding: 10px 20px 50px 20px; .save { float: right; @@ -131,13 +131,29 @@ textarea { width: 100%; border: 1px #CCC solid; - height: 200px; + height: 300px; + } + + pre { + padding: 10px; + box-sizing: border-box; + width: 100%; + border: 1px #CCC solid; + height: 300px; + overflow-x: hidden; + overflow-y: auto; + line-height: 1.2; } .ant-tabs { -webkit-box-flex: 1; } } + + .dynamic-delete-button { + margin: 0 0 0 10px; + color: #CCC; + } } .loading { diff --git a/client/containers/AddInterface/ReqHeader/ReqList.js b/client/containers/AddInterface/ReqHeader/ReqList.js index 8e1ae13c..085a4f7c 100644 --- a/client/containers/AddInterface/ReqHeader/ReqList.js +++ b/client/containers/AddInterface/ReqHeader/ReqList.js @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { Select, Input } from 'antd' +import { Select, Input, Icon } from 'antd' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { autobind } from 'core-decorators' @@ -64,7 +64,7 @@ class ReqList extends Component { let newSeqGroup = [] let seqGroup = this.props.seqGroup let id = this.props.value.id - console.log(this.props) + seqGroup.map(value => { if (+id !== value.id) { newSeqGroup.push(value) @@ -91,7 +91,7 @@ class ReqList extends Component { 头部内容 - × + ) } diff --git a/client/containers/AddInterface/ResParams/ResParams.js b/client/containers/AddInterface/ResParams/ResParams.js index b27b935d..0c4ab8d9 100644 --- a/client/containers/AddInterface/ResParams/ResParams.js +++ b/client/containers/AddInterface/ResParams/ResParams.js @@ -35,15 +35,17 @@ class ResParams extends Component { } componentDidMount () { - const reg = /(

)|(<\/p>)| |(
)|\s+/g + const reg = /(

)|(<\/p>)| |(
)|\s+|

|<\/div>/g editor.customConfig.menus = [] editor.customConfig.onchange = html => { + html = html.match(/{.*}/g)[0] html = html.replace(reg, '') + console.log(html) this.props.getResParams(html) } setTimeout(() => { this.initResParams() - }, 200) + }, 400) editor.create() } diff --git a/client/containers/AddInterface/Result/Result.js b/client/containers/AddInterface/Result/Result.js index 5c13c18e..abd16465 100644 --- a/client/containers/AddInterface/Result/Result.js +++ b/client/containers/AddInterface/Result/Result.js @@ -1,24 +1,45 @@ import React, { Component } from 'react' import { Tabs } from 'antd' +import Mock from 'mockjs' +import { connect } from 'react-redux' +import PropTypes from 'prop-types' + +@connect( + state => { + return { + resParams: state.addInterface.resParams, + reqParams: state.addInterface.reqParams + } + } +) class Result extends Component { + static propTypes = { + resParams: PropTypes.string, + reqParams: PropTypes.string + } + constructor(props) { super(props) } - callback () { - - } - - render () { - const TabPane = Tabs.TabPane - + render () { + console.log(1) + let TabPane = Tabs.TabPane + let resParams = '' + let json = '' + + if(this.props.resParams){ + console.log(this.props.resParams) + resParams = JSON.parse(this.props.resParams) + json = JSON.stringify(Mock.mock(resParams), null, 2) + } return (
返回示例 : - + - +
{json}
@@ -26,4 +47,4 @@ class Result extends Component { } } -export default Result \ No newline at end of file +export default Result diff --git a/index.html b/index.html index 09266c11..745af8f9 100644 --- a/index.html +++ b/index.html @@ -10,4 +10,4 @@
- + \ No newline at end of file diff --git a/package.json b/package.json index 8d6ef883..f234fe0a 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "koa-session-minimal": "^3.0.3", "koa-static": "^3.0.0", "koa-views": "^5.2.0", + "mock": "^0.1.1", "mockjs": "^1.0.1-beta3", "moment": "^2.18.1", "mongoose": "4.10.8",