mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-03 04:50:32 +08:00
fix: params editor及时更新 及 editor json 字符串验证
This commit is contained in:
parent
ba34a8d262
commit
ce84bf403d
@ -82,7 +82,7 @@ export default class CaseDesModal extends Component {
|
||||
deplay: 0,
|
||||
headers: [{name: '', value: ''}],
|
||||
paramsArr: [{name: '', value: ''}],
|
||||
params: '',
|
||||
params: {},
|
||||
res_body: ''
|
||||
}
|
||||
const paramsArr = caseData.params && Object.keys(caseData.params).length ? Object.keys(caseData.params).map(key => {
|
||||
@ -145,8 +145,11 @@ export default class CaseDesModal extends Component {
|
||||
if (this.shouldLoadEditor) {
|
||||
this.loadBodyEditor()
|
||||
this.loadParamsEditor()
|
||||
this.shouldLoadEditor = false
|
||||
} else if (this.shouldLoadParamsEditor) {
|
||||
this.loadParamsEditor()
|
||||
}
|
||||
this.shouldLoadEditor = false
|
||||
this.shouldLoadParamsEditor = false
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -205,7 +208,7 @@ export default class CaseDesModal extends Component {
|
||||
container: 'res_body_json',
|
||||
data: that.props.caseData.res_body,
|
||||
onChange: function (d) {
|
||||
if (d.format !== true) return false;
|
||||
// if (d.format !== true) return false;
|
||||
setFieldsValue({ res_body: d.text })
|
||||
}
|
||||
});
|
||||
@ -217,7 +220,7 @@ export default class CaseDesModal extends Component {
|
||||
container: 'case_modal_params',
|
||||
data: that.props.caseData.params,
|
||||
onChange: function (d) {
|
||||
if (d.format !== true) return false;
|
||||
// if (d.format !== true) return false;
|
||||
setFieldsValue({ params: d.text })
|
||||
}
|
||||
});
|
||||
@ -282,6 +285,9 @@ export default class CaseDesModal extends Component {
|
||||
))
|
||||
}
|
||||
getFieldDecorator('params')
|
||||
// if (paramsForm === 'json') {
|
||||
// this.loadParamsEditor()
|
||||
// }
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@ -337,11 +343,10 @@ export default class CaseDesModal extends Component {
|
||||
unCheckedChildren="JSON"
|
||||
checked={paramsForm === 'json'}
|
||||
onChange={bool => {
|
||||
this.setState({ paramsForm: bool ? 'json' : 'form' }, () => {
|
||||
if (paramsForm === 'json') {
|
||||
this.loadParamsEditor()
|
||||
}
|
||||
})
|
||||
if (bool) {
|
||||
this.shouldLoadParamsEditor = true
|
||||
}
|
||||
this.setState({ paramsForm: bool ? 'json' : 'form' })
|
||||
}}
|
||||
/>
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ export default class MockCol extends Component {
|
||||
code: '200',
|
||||
deplay: 0,
|
||||
headers: [{name: '', value: ''}],
|
||||
paramsArr: [{name: '', value: ''}],
|
||||
params: {},
|
||||
res_body: getMockText(currInterface.res_body)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user