mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
fix: 修改bug
This commit is contained in:
parent
1b9c4ccf73
commit
a0836fba04
@ -171,7 +171,7 @@ class InterfaceEditForm extends Component {
|
|||||||
values.req_params = values.req_params || [];
|
values.req_params = values.req_params || [];
|
||||||
values.req_headers = values.req_headers || [];
|
values.req_headers = values.req_headers || [];
|
||||||
let isfile = false, isHavaContentType = false;
|
let isfile = false, isHavaContentType = false;
|
||||||
if (values.req_body_type === 'form') {
|
if (values.req_body_type === 'form') {
|
||||||
values.req_body_form.forEach((item) => {
|
values.req_body_form.forEach((item) => {
|
||||||
if (item.type === 'file') {
|
if (item.type === 'file') {
|
||||||
isfile = true;
|
isfile = true;
|
||||||
@ -341,7 +341,7 @@ class InterfaceEditForm extends Component {
|
|||||||
handlePath = (e) => {
|
handlePath = (e) => {
|
||||||
let val = e.target.value, queue = [];
|
let val = e.target.value, queue = [];
|
||||||
|
|
||||||
let insertParams =(name)=>{
|
let insertParams = (name) => {
|
||||||
let findExist = _.find(this.state.req_params, { name: name });
|
let findExist = _.find(this.state.req_params, { name: name });
|
||||||
if (findExist) {
|
if (findExist) {
|
||||||
queue.push(findExist)
|
queue.push(findExist)
|
||||||
@ -363,8 +363,8 @@ class InterfaceEditForm extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(val && val.length > 3){
|
if (val && val.length > 3) {
|
||||||
val.replace(/\{(.+?)\}/g, function(str, match){
|
val.replace(/\{(.+?)\}/g, function (str, match) {
|
||||||
insertParams(match)
|
insertParams(match)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ class InterfaceEditForm extends Component {
|
|||||||
return requestBodyTpl(item, index)
|
return requestBodyTpl(item, index)
|
||||||
})
|
})
|
||||||
|
|
||||||
const DEMOPATH= '/api/user/{id}'
|
const DEMOPATH = '/api/user/{id}'
|
||||||
return (
|
return (
|
||||||
<Form onSubmit={this.handleSubmit}>
|
<Form onSubmit={this.handleSubmit}>
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ class InterfaceEditForm extends Component {
|
|||||||
|
|
||||||
<Row className={'interface-edit-item ' + this.state.hideTabs.req.query}>
|
<Row className={'interface-edit-item ' + this.state.hideTabs.req.query}>
|
||||||
<Col>
|
<Col>
|
||||||
<EasyDragSort data={()=>this.props.form.getFieldValue('req_query')} onChange={this.handleDragMove('req_query')} >
|
<EasyDragSort data={() => this.props.form.getFieldValue('req_query')} onChange={this.handleDragMove('req_query')} >
|
||||||
{QueryList}
|
{QueryList}
|
||||||
</EasyDragSort>
|
</EasyDragSort>
|
||||||
</Col>
|
</Col>
|
||||||
@ -741,7 +741,7 @@ class InterfaceEditForm extends Component {
|
|||||||
|
|
||||||
<Row className={'interface-edit-item ' + this.state.hideTabs.req.headers}>
|
<Row className={'interface-edit-item ' + this.state.hideTabs.req.headers}>
|
||||||
<Col>
|
<Col>
|
||||||
<EasyDragSort data={()=>this.props.form.getFieldValue('req_headers')} onChange={this.handleDragMove('req_headers')} >
|
<EasyDragSort data={() => this.props.form.getFieldValue('req_headers')} onChange={this.handleDragMove('req_headers')} >
|
||||||
{headerList}
|
{headerList}
|
||||||
</EasyDragSort>
|
</EasyDragSort>
|
||||||
</Col>
|
</Col>
|
||||||
@ -780,8 +780,6 @@ class InterfaceEditForm extends Component {
|
|||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
@ -812,7 +810,7 @@ class InterfaceEditForm extends Component {
|
|||||||
:
|
:
|
||||||
null
|
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' ?
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
{getFieldDecorator('req_body_other', { initialValue: this.state.req_body_other })(
|
{getFieldDecorator('req_body_other', { initialValue: this.state.req_body_other })(
|
||||||
@ -855,7 +853,7 @@ class InterfaceEditForm extends Component {
|
|||||||
</pre>}>
|
</pre>}>
|
||||||
<Icon type="question-circle-o" style={{ color: "#086dbf" }} />
|
<Icon type="question-circle-o" style={{ color: "#086dbf" }} />
|
||||||
</Tooltip> ,具体使用方法请 <span className="href" onClick={() => window.open('http://yapi.qunar.com/mock.html', '_blank')}>查看文档</span>
|
</Tooltip> ,具体使用方法请 <span className="href" onClick={() => window.open('http://yapi.qunar.com/mock.html', '_blank')}>查看文档</span>
|
||||||
,“全局编辑” 或 “退出全屏” 请按 F9
|
,“全局编辑” 或 “退出全屏” 请按 F9
|
||||||
</h3>
|
</h3>
|
||||||
<div id="res_body_json" style={{ minHeight: "300px", display: this.state.jsonType === 'tpl' ? 'block' : 'none' }} ></div>
|
<div id="res_body_json" style={{ minHeight: "300px", display: this.state.jsonType === 'tpl' ? 'block' : 'none' }} ></div>
|
||||||
<div id="mock-preview" style={{ backgroundColor: "#eee", lineHeight: "20px", minHeight: "300px", display: this.state.jsonType === 'preview' ? 'block' : 'none' }}></div>
|
<div id="mock-preview" style={{ backgroundColor: "#eee", lineHeight: "20px", minHeight: "300px", display: this.state.jsonType === 'preview' ? 'block' : 'none' }}></div>
|
||||||
|
@ -75,12 +75,8 @@ class PrpjectEnv extends Component {
|
|||||||
newValue[name] = curValue.filter((val, index) => {
|
newValue[name] = curValue.filter((val, index) => {
|
||||||
return index !== key;
|
return index !== key;
|
||||||
})
|
})
|
||||||
console.log('newValue',newValue);
|
|
||||||
this.props.form.setFieldsValue(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)
|
this.setState(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +226,7 @@ class PrpjectEnv extends Component {
|
|||||||
const envSettingItems = envs.map((item, index) => {
|
const envSettingItems = envs.map((item, index) => {
|
||||||
return envTpl(item, index)
|
return envTpl(item, index)
|
||||||
})
|
})
|
||||||
console.log('env',getFieldValue('env'));
|
|
||||||
return (
|
return (
|
||||||
<div className="m-panel env">
|
<div className="m-panel env">
|
||||||
<div className="panel-title">
|
<div className="panel-title">
|
||||||
@ -238,7 +234,7 @@ class PrpjectEnv extends Component {
|
|||||||
<p className="desc">你可以添加多个环境,用于区分不同的使用场景。</p>
|
<p className="desc">你可以添加多个环境,用于区分不同的使用场景。</p>
|
||||||
</div>
|
</div>
|
||||||
<FormItem {...formItemLayout}>
|
<FormItem {...formItemLayout}>
|
||||||
<EasyDragSort data={getFieldValue('env')} onChange={this.handleDragMove('env')} >
|
<EasyDragSort data={()=>getFieldValue('env')} onChange={this.handleDragMove('env')} >
|
||||||
{envSettingItems}
|
{envSettingItems}
|
||||||
</EasyDragSort>
|
</EasyDragSort>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user