From a0836fba041a81d55104b3960fdb7d43a856f8d4 Mon Sep 17 00:00:00 2001 From: "gaoxiaolin.gao" Date: Mon, 11 Dec 2017 20:55:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InterfaceList/InterfaceEditForm.js | 20 +++++++++---------- .../Project/Setting/ProjectEnv/ProjectEnv.js | 10 +++------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js b/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js index 7eec6a85..0080c1cd 100755 --- a/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js @@ -171,7 +171,7 @@ class InterfaceEditForm extends Component { values.req_params = values.req_params || []; values.req_headers = values.req_headers || []; let isfile = false, isHavaContentType = false; - if (values.req_body_type === 'form') { + if (values.req_body_type === 'form') { values.req_body_form.forEach((item) => { if (item.type === 'file') { isfile = true; @@ -341,7 +341,7 @@ class InterfaceEditForm extends Component { handlePath = (e) => { let val = e.target.value, queue = []; - let insertParams =(name)=>{ + let insertParams = (name) => { let findExist = _.find(this.state.req_params, { name: name }); if (findExist) { queue.push(findExist) @@ -363,8 +363,8 @@ class InterfaceEditForm extends Component { } } - if(val && val.length > 3){ - val.replace(/\{(.+?)\}/g, function(str, match){ + if (val && val.length > 3) { + val.replace(/\{(.+?)\}/g, function (str, match) { insertParams(match) }) } @@ -608,7 +608,7 @@ class InterfaceEditForm extends Component { return requestBodyTpl(item, index) }) - const DEMOPATH= '/api/user/{id}' + const DEMOPATH = '/api/user/{id}' return (
@@ -726,7 +726,7 @@ class InterfaceEditForm extends Component { - this.props.form.getFieldValue('req_query')} onChange={this.handleDragMove('req_query')} > + this.props.form.getFieldValue('req_query')} onChange={this.handleDragMove('req_query')} > {QueryList} @@ -741,7 +741,7 @@ class InterfaceEditForm extends Component { - this.props.form.getFieldValue('req_headers')} onChange={this.handleDragMove('req_headers')} > + this.props.form.getFieldValue('req_headers')} onChange={this.handleDragMove('req_headers')} > {headerList} @@ -780,8 +780,6 @@ class InterfaceEditForm extends Component { - - : null} @@ -812,7 +810,7 @@ class InterfaceEditForm extends Component { : null } - {this.props.form.getFieldValue('req_body_type') === 'raw' && this.state.hideTabs.req.body !== 'hide'? + {this.props.form.getFieldValue('req_body_type') === 'raw' && this.state.hideTabs.req.body !== 'hide' ? {getFieldDecorator('req_body_other', { initialValue: this.state.req_body_other })( @@ -855,7 +853,7 @@ class InterfaceEditForm extends Component { }> ,具体使用方法请 window.open('http://yapi.qunar.com/mock.html', '_blank')}>查看文档 - ,“全局编辑” 或 “退出全屏” 请按 F9 + ,“全局编辑” 或 “退出全屏” 请按 F9
diff --git a/client/containers/Project/Setting/ProjectEnv/ProjectEnv.js b/client/containers/Project/Setting/ProjectEnv/ProjectEnv.js index 84cf7142..c5f80299 100644 --- a/client/containers/Project/Setting/ProjectEnv/ProjectEnv.js +++ b/client/containers/Project/Setting/ProjectEnv/ProjectEnv.js @@ -75,12 +75,8 @@ class PrpjectEnv extends Component { newValue[name] = curValue.filter((val, index) => { return index !== key; }) - console.log('newValue',newValue); + this.props.form.setFieldsValue(newValue) - setTimeout(()=>{ - console.log('curValue',this.props.form.getFieldValue(name)); - },5000); - // console.log('curValue',this.props.form.getFieldValue(name)); this.setState(newValue) } @@ -230,7 +226,7 @@ class PrpjectEnv extends Component { const envSettingItems = envs.map((item, index) => { return envTpl(item, index) }) - console.log('env',getFieldValue('env')); + return (
@@ -238,7 +234,7 @@ class PrpjectEnv extends Component {

你可以添加多个环境,用于区分不同的使用场景。

- + getFieldValue('env')} onChange={this.handleDragMove('env')} > {envSettingItems}