From bf4538b9551955c212876b54d65ad68763e84426 Mon Sep 17 00:00:00 2001 From: suxiaoxin Date: Tue, 27 Feb 2018 19:17:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E6=9C=9F=E6=9C=9B?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=E6=8A=A5=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MockCol/CaseDesModal.js | 17 ++++++++--------- .../MockCol/MockCol.js | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/exts/yapi-plugin-advanced-mock/MockCol/CaseDesModal.js b/exts/yapi-plugin-advanced-mock/MockCol/CaseDesModal.js index c6042998..36df2998 100644 --- a/exts/yapi-plugin-advanced-mock/MockCol/CaseDesModal.js +++ b/exts/yapi-plugin-advanced-mock/MockCol/CaseDesModal.js @@ -83,14 +83,12 @@ class CaseDesForm extends Component { // 处理request_body编译器 handleRequestBody = (d) => { - const { setFieldsValue } = this.props.form; - setFieldsValue({ res_body: d.text }) + this.setState({ res_body: d.text }) } // 处理参数编译器 handleParams = (d) => { - const { setFieldsValue } = this.props.form; - setFieldsValue({ params: d.text }) + this.setState({ params: d.text }) } // 增加参数信息 @@ -172,6 +170,8 @@ class CaseDesForm extends Component { const form = this.props.form; form.validateFieldsAndScroll((err, values) => { if (!err) { + values.res_body = this.state.res_body; + values.params = this.state.params; this.props.onOk(this.endProcess(values)); } }) @@ -181,6 +181,8 @@ class CaseDesForm extends Component { const { getFieldDecorator, getFieldValue } = this.props.form; const { isAdd, visible, onCancel } = this.props; const { name, code, headers, ip, ip_enable, params, paramsArr, paramsForm, res_body } = this.state + + this.props.form.initialValue const valuesTpl = (values, title) => { const dataSource = this.getParamsKey(); const display = paramsForm === 'json' ? 'none' : '' @@ -391,16 +393,13 @@ class CaseDesForm extends Component { - - {getFieldDecorator('res_body',{ initialValue: res_body })( - + - )} diff --git a/exts/yapi-plugin-advanced-mock/MockCol/MockCol.js b/exts/yapi-plugin-advanced-mock/MockCol/MockCol.js index ad7df55d..70cdf40e 100644 --- a/exts/yapi-plugin-advanced-mock/MockCol/MockCol.js +++ b/exts/yapi-plugin-advanced-mock/MockCol/MockCol.js @@ -47,7 +47,6 @@ export default class MockCol extends Component { handleOk = async (caseData) => { if(!caseData){ - console.log(12) return null; } const { caseData: currcase } = this.state;