diff --git a/client/containers/AddInterface/AddInterface.js b/client/containers/AddInterface/AddInterface.js index 048bf5b5..5dfdb26e 100644 --- a/client/containers/AddInterface/AddInterface.js +++ b/client/containers/AddInterface/AddInterface.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types' import axios from 'axios' import { connect } from 'react-redux' import { autobind } from 'core-decorators' -import { Button, Tabs } from 'antd' +import { Button, Tabs, message } from 'antd' import ReqMethod from './ReqMethod/ReqMethod.js' import ReqHeader from './ReqHeader/ReqHeader.js' import ReqParams from './ReqParams/ReqParams.js' @@ -19,6 +19,10 @@ import { pushInterfaceName } from '../../actions/addInterface.js' +const success = () => { + message.success('保存成功!') +} + @connect( state => { return { @@ -59,7 +63,8 @@ class AddInterface extends Component { constructor (props) { super(props) this.state = { - isLoading: '' + isLoading: '', + isSave: false } } @@ -108,15 +113,6 @@ 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 } @@ -146,6 +142,12 @@ class AddInterface extends Component { location.href = `${origin}${pathname}#/interface` } + changeState (ifTrue) { + this.setState({ + isSave: ifTrue + }) + } + @autobind saveForms () { let postURL = undefined @@ -174,10 +176,10 @@ class AddInterface extends Component { this.setLoading(true) axios.post(postURL, params) - .then(data => { - console.log(data) + .then(() => { this.setLoading() - this.editState2() + success() + this.changeState(true) // this.routerPage() }) .catch(e => { @@ -187,7 +189,7 @@ class AddInterface extends Component { render () { const TabPane = Tabs.TabPane - const isLoading = this.state.isLoading + const { isLoading, isSave } = this.state return (
@@ -199,7 +201,7 @@ class AddInterface extends Component { - + mock 测试 diff --git a/client/containers/AddInterface/ResParams/ResParams.js b/client/containers/AddInterface/ResParams/ResParams.js index 0c4ab8d9..475aed33 100644 --- a/client/containers/AddInterface/ResParams/ResParams.js +++ b/client/containers/AddInterface/ResParams/ResParams.js @@ -38,6 +38,7 @@ class ResParams extends Component { const reg = /(

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

|<\/div>/g editor.customConfig.menus = [] editor.customConfig.onchange = html => { + console.log(html) html = html.match(/{.*}/g)[0] html = html.replace(reg, '') console.log(html) diff --git a/client/containers/AddInterface/Result/Result.js b/client/containers/AddInterface/Result/Result.js index abd16465..89185937 100644 --- a/client/containers/AddInterface/Result/Result.js +++ b/client/containers/AddInterface/Result/Result.js @@ -16,7 +16,8 @@ import PropTypes from 'prop-types' class Result extends Component { static propTypes = { resParams: PropTypes.string, - reqParams: PropTypes.string + reqParams: PropTypes.string, + isSave: PropTypes.bool } constructor(props) { @@ -24,16 +25,15 @@ class Result extends Component { } 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 (
返回示例 : diff --git a/package.json b/package.json index f234fe0a..513e499c 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,10 @@ "@qnpm/ykit-config-qunar": "^0.8.2", "axios": "^0.16.2", "babel-plugin-transform-decorators-legacy": "^1.3.4", + "copy-webpack-plugin": "^4.0.1", "core-decorators": "^0.17.0", "fs-extra": "^3.0.1", + "jsoneditor": "^5.9.3", "jsonwebtoken": "^7.4.1", "koa": "^2.0.0", "koa-bodyparser": "^3.2.0", @@ -33,11 +35,13 @@ "mock": "^0.1.1", "mockjs": "^1.0.1-beta3", "moment": "^2.18.1", + "monaco-editor": "^0.9.0", "mongoose": "4.10.8", "mongoose-auto-increment": "^5.0.1", "node-sass-china": "^4.5.0", "nodemailer": "^4.0.1", "prop-types": "^15.5.10", + "react-monaco-editor": "^0.8.1", "redux": "^3.7.1", "redux-promise": "^0.5.3", "redux-thunk": "^2.2.0",